Hello community,

here is the log from the commit of package biblesync for openSUSE:Factory 
checked in at 2018-08-20 16:21:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/biblesync (Old)
 and      /work/SRC/openSUSE:Factory/.biblesync.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "biblesync"

Mon Aug 20 16:21:14 2018 rev:2 rq:630390 version:2.0.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/biblesync/biblesync.changes      2015-05-15 
07:43:17.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.biblesync.new/biblesync.changes 2018-08-20 
16:21:18.888983036 +0200
@@ -1,0 +2,8 @@
+Sun Aug 12 09:49:42 UTC 2018 - [email protected]
+
+- Update to 2.0.1
+  + Protocol change, so, the major revision is bumped to v2
+  + Chat message support. A new message type BSP_CHAT (0x04)
+    is supported
+
+-------------------------------------------------------------------

Old:
----
  biblesync-1.1.2.tar.gz

New:
----
  biblesync-2.0.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ biblesync.spec ++++++
--- /var/tmp/diff_new_pack.eokhwU/_old  2018-08-20 16:21:19.296983614 +0200
+++ /var/tmp/diff_new_pack.eokhwU/_new  2018-08-20 16:21:19.296983614 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package biblesync
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,17 +16,17 @@
 #
 
 
-%define _soversion 1.1
-%define _shlibname libbiblesync1_1
+%define _soversion 2.0
+%define _shlibname libbiblesync2_0
 
 Name:           biblesync
-Version:        1.1.2
+Version:        2.0.1
 Release:        0
 Summary:        A Cross-platform library for sharing Bible navigation
 License:        SUSE-Public-Domain
 Group:          Development/Libraries/C and C++
 Url:            https://github.com/karlkleinpaste/biblesync
-Source0:        
http://downloads.sourceforge.net/gnomesword/biblesync-%{version}.tar.gz
+Source0:        
https://github.com/karlkleinpaste/biblesync/releases/download/%{version}/%{name}-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  gcc-c++
 BuildRequires:  intltool
@@ -89,7 +89,7 @@
 
 %files devel
 %defattr(-,root,root)
-%doc AUTHORS COPYING ChangeLog README WIRESHARK
+%doc AUTHORS COPYING ChangeLog README.md WIRESHARK
 %{_includedir}/biblesync
 %{_libdir}/pkgconfig/biblesync.pc
 %{_libdir}/libbiblesync.so

++++++ biblesync-1.1.2.tar.gz -> biblesync-2.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/.gitignore 
new/biblesync-2.0.1/.gitignore
--- old/biblesync-1.1.2/.gitignore      2014-12-19 16:26:47.000000000 +0100
+++ new/biblesync-2.0.1/.gitignore      2018-04-28 06:33:32.000000000 +0200
@@ -1,2 +1,3 @@
 **.swp
+*~
 build/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/CMakeLists.txt 
new/biblesync-2.0.1/CMakeLists.txt
--- old/biblesync-1.1.2/CMakeLists.txt  2014-12-19 16:26:47.000000000 +0100
+++ new/biblesync-2.0.1/CMakeLists.txt  2018-04-28 06:33:32.000000000 +0200
@@ -6,7 +6,7 @@
 # - INCLUDEDIR (default "CMAKE_INSTALL_PREFIX/include") - set to directory 
where header files should be installed
 # - BIBLESYNC_SOVERSION (defaults to BIBLESYNC_VERSION) - Manually set the 
SOVERSION of the installed file
 PROJECT(libbiblesync CXX)
-SET(BIBLESYNC_VERSION 1.1.2)
+SET(BIBLESYNC_VERSION 2.0.1)
 # A required CMake line
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
 # Where our custom Find* files are located
@@ -94,7 +94,7 @@
 # End of copy from Sword's code
 
##########################################################################################
 
-# Set the SOVERSION of the package, for binary compatability tracking
+# Set the SOVERSION of the package, for binary compatibility tracking
 INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/soversion.cmake")
 
 # Set the variables in the .in file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/INSTALL new/biblesync-2.0.1/INSTALL
--- old/biblesync-1.1.2/INSTALL 2014-12-19 16:26:47.000000000 +0100
+++ new/biblesync-2.0.1/INSTALL 2018-04-28 06:33:32.000000000 +0200
@@ -1,5 +1,5 @@
 Linux:
-  $ mkdir build/linux && cd build/linux
+  $ mkdir -p build/linux && cd build/linux
   $ cmake -DBUILD_SHARED_LIBS=TRUE -DCMAKE_INSTALL_PREFIX=/usr 
-DLIBDIR=/usr/lib64 ../..
   $ make && sudo make install
 Note use of /usr/lib64, which is appropriate for Fedora x86_64; perhaps
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/README new/biblesync-2.0.1/README
--- old/biblesync-1.1.2/README  2014-12-19 16:26:47.000000000 +0100
+++ new/biblesync-2.0.1/README  1970-01-01 01:00:00.000000000 +0100
@@ -1,34 +0,0 @@
----------
-BibleSync
----------
-
-This is a C++ single class library encapsulating a protocol conduit.  The
-premise is that there is a local network over which to multicast Bible
-navigation, and someone, possibly several someones, will transmit, and
-others will receive.  The choices for when you decide to xmit and what to
-do when you recv are up to you as the application designer.
-
-Access to the conduit is by creating the object, setting the mode, calling
-Transmit() to xmit nav events, and arranging the frequent polling of
-Receive() to recv nav events.  There is more than just navigation to be
-handled; there are live/dead events for potential Speakers as well as
-mismatches, presence announcements, and errors.  There is a programming
-reference biblesync.7 which explains the details, both from a high level
-view of the essentials of the protocol's behavior and at a low level of
-how you create, access, and use the conduit class.  The (single) BibleSync
-object should persist throughout the life of your application, but at any
-time you can set the mode to "disable," and preferably stop the receive
-polling, and then re-enable it later as the user needs.
-
-Much work has been done in integrating this library into its first
-application, Xiphos.  It is useful to examine Xiphos' code to see where
-and how integration has been done.  Get a Xiphos source tree using...
-    svn checkout svn://svn.code.sf.net/p/gnomesword/code/trunk xiphos
-...and see:
-- main/biblesync-glue.* for incoming event handling and "glue" routines.
-- main/sword.cc for initialization + how xmit is handled.
-- gnome2/search_dialog.c and gnome2/sidebar.c for verse list xmit.
-- gnome2/preferences_dialog.c and ui/prefs.glade for configuration UI.
-
-Karl Kleinpaste
-May 2014
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/README.md 
new/biblesync-2.0.1/README.md
--- old/biblesync-1.1.2/README.md       1970-01-01 01:00:00.000000000 +0100
+++ new/biblesync-2.0.1/README.md       2018-04-28 06:33:32.000000000 +0200
@@ -0,0 +1,34 @@
+# BibleSync
+
+This is a C++ single class library encapsulating a protocol conduit.  The
+premise is that there is a local network over which to multicast Bible
+navigation, and someone, possibly several someones, will transmit, and others
+will receive.  The choices for when you decide to xmit and what to do when you
+recv are up to you as the application designer.
+
+Access to the conduit is by creating the object, setting the mode, calling
+Transmit() to xmit nav events, and arranging the frequent polling of Receive()
+to recv nav events.  There is more than just navigation to be handled; there
+are live/dead events for potential Speakers as well as mismatches, presence
+announcements, and errors.  There is a programming reference biblesync.7 which
+explains the details, both from a high level view of the essentials of the
+protocol's behavior and at a low level of how you create, access, and use the
+conduit class.  The (single) BibleSync object should persist throughout the
+life of your application, but at any time you can set the mode to "disable,"
+and preferably stop the receive polling, and then re-enable it later as the
+user needs.
+
+Much work has been done in integrating this library into its first application,
+Xiphos.  It is useful to examine Xiphos' code to see where and how integration
+has been done.  Get a Xiphos source tree using:
+
+~~~
+git clone https://github.com/crosswire/xiphos
+~~~
+
+...and see:
+
+- `main/biblesync-glue.*` for incoming event handling and "glue" routines.
+- `main/sword.cc` for initialization + how xmit is handled.
+- `gnome2/search_dialog.c` and `gnome2/sidebar.c` for verse list xmit.
+- `gnome2/preferences_dialog.c` and `ui/prefs.glade` for configuration UI.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/include/biblesync.hh 
new/biblesync-2.0.1/include/biblesync.hh
--- old/biblesync-1.1.2/include/biblesync.hh    2014-12-19 16:26:47.000000000 
+0100
+++ new/biblesync-2.0.1/include/biblesync.hh    2018-04-28 06:33:32.000000000 
+0200
@@ -71,18 +71,22 @@
 //                bible, ref, alt, group, domain as arrived.
 //                info + dump available.
 //             3. 'M' (mismatch) against passphrase or mode or listen status.
-//                info == "announce" or "sync" or "beacon" (+ user @ [ipaddr])
+//                info == "announce"/"sync"/"beacon"/"chat" (+ user @ [ipaddr])
 //                        sync:     bible, ref, alt, group, domain as arrived.
 //                        announce: presence message in alt.
 //                           also, individual elements are also available:
 //                           overload: bible   ref       group    domain
 //                                     user    [ipaddr]  app+ver  device
+//                        chat:     message in alt.
 //                dump available.
 //             4. 'S' (new speaker)
 //                param overload as above. alt unused. see listenToSpeaker().
 //             5. 'D' (dead speaker)
 //                opposite of new speaker. only param is speakerkey.
-//             6. 'E' (error) for network errors & malformed packets.
+//             6. 'C' (chat)
+//                human chat message to be displayed to user.
+//                message in alt.
+//             7. 'E' (error) for network errors & malformed packets.
 //                only info + dump are useful.
 //
 // - get current mode.
@@ -97,10 +101,8 @@
 //
 // - send navigation.
 //     BibleSync_xmit_status retval =
-//             Transmit(BSP_SYNC,
-//                      "NASB", "John.3.16", "some alt ref",
-//                      "1", "BIBLE-VERSE");
-//       params: type (sync only), bible, ref, alt-ref, group, domain.
+//             Transmit("NASB", "John.3.16", "some alt ref", "1", 
"BIBLE-VERSE");
+//       params: bible, ref, alt-ref, group, domain.
 //       all params have defaults.
 //     => it is the application's responsibility to send well-formed verse
 //        references.
@@ -110,10 +112,24 @@
 //       sets outgoing TTL to zero so no one hears you off-machine.
 //       applicable only to BSP_PERSONAL mode.
 //
+// - set beacon count based on frequency of calling Receive()
+//      void setBeaconCount(int);
+//        how often will your app call Receive()?
+//        divide 10 by that, call setBeaconCount(result).
+//
+// - set new username
+//      void setUser(string);
+//        for apps (such as Bishop) which allow the user to set the friendly 
name
+//        and which may be changed at some point whle BibleSync runs.
+//
 // - allow another speaker to drive us
 //     void listenToSpeaker(bool listen, string speakerkey)
 //             say yes/no to listening.
 //
+// - send a human chat message to others listening.
+//     BibleSync_xmit_status retval = Chat("your message for others here");
+//       sends your message to all other listeners. not restricted to Speakers.
+//
 // Receive() USAGE NOTE:
 // the application must call BibleSync::Receive(YourBibleSyncObjPtr)
 // frequently.  For example:
@@ -213,13 +229,15 @@
 #define        BSP_MAX_PAYLOAD (BSP_MAX_SIZE - BSP_HEADER_SIZE)
 
 // message indications
-#define        BSP_MAGIC       htonl(0x409CAF11)
-#define        BSP_PROTOCOL    2
+#define        BSP_MAGIC               htonl(0x409CAF11)
+#define        BSP_PROTOCOL            3
+#define        BSP_OLD_PROTOCOL        2
 
 // message types
 #define        BSP_ANNOUNCE    1       // presence announcement.
 #define        BSP_SYNC        2       // navigation synchronization.
 #define        BSP_BEACON      3       // speaker availability beacon.
+#define        BSP_CHAT        4       // human chat message.
 // beacon packet is identical to presence announcement except for type.
 
 // beacon constants
@@ -239,11 +257,15 @@
 #define BSP_MSG_SYNC_BIBLEABBREV       "msg.sync.bibleAbbrev"  // req'd
 #define BSP_MSG_SYNC_GROUP             "msg.sync.group"        // req'd
 #define BSP_MSG_PASSPHRASE             "msg.sync.passPhrase"   // req'd
+#define BSP_MSG_CHAT                   "msg.chat"              // req'd for 
BSP_CHAT
 
 // required number of fields to send (out) or verify (in).
 #define        BSP_FIELDS_RECV_ANNOUNCE        4
+#define        BSP_FIELDS_RECV_CHAT            5
 #define        BSP_FIELDS_RECV_SYNC            8
+
 #define        BSP_FIELDS_XMIT_ANNOUNCE        7
+#define        BSP_FIELDS_XMIT_CHAT            8
 #define        BSP_FIELDS_XMIT_SYNC            12
 
 #ifdef linux
@@ -300,7 +322,8 @@
     bool receiving;
 
     // when xmit-capable, we xmit BSP_BEACON every N calls of Receive().
-    uint8_t beacon_countdown;
+    uint8_t beacon_countdown;  // progress toward our next beacon xmit
+    uint8_t beacon_count;      // how many Receive() calls between beacon xmits
 
     // track currently-known speaker set.
     BibleSyncSpeakerMap speakers;
@@ -337,6 +360,15 @@
     int ReceiveInternal();             // C++ object context.
     int InitSelectRead(char *, struct sockaddr_in *, BibleSyncMessage *);
 
+    // real transmitter.
+    BibleSync_xmit_status
+    TransmitInternal(char message_type = BSP_SYNC,
+                    string bible  = "KJV",
+                    string ref    = "Gen.1.1",
+                    string alt    = "",
+                    string group  = "1",
+                    string domain = "BIBLE-VERSE");
+
     // speaker list management.
     void ageSpeakers();
     void clearSpeakers();
@@ -376,18 +408,48 @@
     static int Receive(void *myself); // assume C context: poll from timeout.
 
     // speaker transmitter
-    BibleSync_xmit_status Transmit(char message_type = BSP_SYNC,
-                                  string bible  = "KJV",
-                                  string ref    = "Gen.1.1",
-                                  string alt    = "",
-                                  string group  = "1",
-                                  string domain = "BIBLE-VERSE");
+    // public interface permits only BSP_SYNC transmission.
+    // there is no reason for an app to send presence or beacon on its own.
+    inline BibleSync_xmit_status Transmit(string bible  = "KJV",
+                                         string ref    = "Gen.1.1",
+                                         string alt    = "",
+                                         string group  = "1",
+                                         string domain = "BIBLE-VERSE")
+    {
+       return TransmitInternal(BSP_SYNC, bible, ref, alt, group, domain);
+    }
+
+    // simple chat interface
+    inline BibleSync_xmit_status Chat(string message)
+    {
+       return TransmitInternal(BSP_CHAT, message);
+    }
 
     // set privacy using TTL 0 in personal mode.
     bool setPrivate(bool privacy);
 
     // say whether you want to hear from this speaker.
     void listenToSpeaker(bool listen, string speakerkey);
+
+    // Speaker beacon must go out roughly every 10 seconds,
+    // set count to approx divisor. how often does your app call Receive()?
+    // every second, default 10.
+    // every 2 seconds, use 5.
+    // every 3 seconds, use 3 (9 seconds, fine).
+    // value is force-bounded [3..10].
+    inline void setBeaconCount(uint8_t count)
+    {
+       if (count > 10) count = 10;
+       if (count < 3)  count = 3;
+       beacon_count = count;
+    }
+
+    // set new user name
+    // useful for apps that can change the name on the fly (e.g. Bishop).
+    inline void setUser(string u)
+    {
+       user = u;
+    }
 };
 
 #endif // __BIBLESYNC_HH__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/man/biblesync.7 
new/biblesync-2.0.1/man/biblesync.7
--- old/biblesync-1.1.2/man/biblesync.7 2014-12-19 16:26:47.000000000 +0100
+++ new/biblesync-2.0.1/man/biblesync.7 2018-04-28 06:33:32.000000000 +0200
@@ -8,7 +8,7 @@
 .\" make back to the origin repository.  These obligations are non-
 .\" binding for public domain software, but they are to be seriously
 .\" handled nonetheless.
-.TH BIBLESYNC 7 2014-10-31 "Linux" "Linux Programmer's Manual"
+.TH BIBLESYNC 7 2018-04-27 "Linux" "Linux Programmer's Manual"
 .SH NAME
 biblesync \- multicast navigation synchronization in Bible programs
 .SH SYNOPSIS
@@ -47,12 +47,6 @@
 .br
 .BI "} BibleSync_xmit_status;"
 .sp
-.BI "#define BSP_ANNOUNCE   1"
-.br
-.BI "#define BSP_SYNC       2"
-.br
-.BI "#define BSP_BEACON     3"
-.sp
 .BI "typedef void (*BibleSync_navigate)(char " cmd ", string " speakerkey ","
 .br
 .BI "                                   string " bible ", string " ref ", 
string " alt ","
@@ -81,16 +75,20 @@
 .br
 .BI "string BibleSync::getPassphrase(void);"
 .br
-.BI "BibleSync_xmit_status BibleSync::Transmit(char " type ","
-.br
-.BI "                                          string " bible ", string " ref 
", string " alt ","
+.BI "BibleSync_xmit_status BibleSync::Transmit(string " bible ", string " ref 
", string " alt ","
 .br
 .BI "                                          string " group ", string " 
domain ");"
 .br
+.BI "BibleSync_xmit_status BibleSync::Chat(string " message ");"
+.br
 .BI "static int BibleSync::Receive(void *" object ");"
 .br
 .BI "bool BibleSync::setPrivate(bool " privacy ");"
 .br
+.BI "void BibleSync::setBeaconCount(uint8_t " count ");"
+.br
+.BI "void BibleSync::setUser(string " user ");"
+.br
 .BI "void BibleSync::listenToSpeaker(bool " listen ", string " speakerkey ");"
 .fi
 .SH DESCRIPTION
@@ -108,7 +106,7 @@
 all of which he wishes to follow along together.
 
 Similarly, a group of people working closely together, such as
-translators, can stay together as they work.
+translators or a group Bible study, can stay together as they work.
 
 In an instructional motif,
 .I BibleSync
@@ -148,12 +146,12 @@
 
 Transmitters (Personal and Speaker modes) issue availability beacons every
 10 seconds.  Received beacons for previously-unknown Speakers are handed
-up to the application.  These beacons provide for receivers (Personal and
-Audience modes) to maintain a managed list of available Speakers.
-Furthermore, when a transmitter ceases to issue beacons, its presence in
-the list of available Speakers is aged out until being removed after 30
-seconds of beacon silence.  The application is again informed when a
-Speaker goes dead.
+up to the application as "new Speaker" events.  These beacons provide for
+receivers (Personal and Audience modes) to maintain a managed list of
+available Speakers.  Furthermore, when a transmitter ceases to issue
+beacons, its presence in the list of available Speakers is aged out until
+being removed after 30 seconds of beacon silence.  The application is
+again informed as a Speaker ages out with a "dead Speaker" event.
 
 Default listening behavior is that the first Speaker heard via beacon is
 marked for listening.  Other transmitters claiming Speaker status via
@@ -189,9 +187,6 @@
 
 .I BibleSync
 transmits no packet when the application leaves the conversation.
-
-Only the 3 packet types BSP_ANNOUNCE, BSP_SYNC, and BSP_BEACON are defined
-in the protocol.
 .SH PUBLIC INTERFACE
 .SS Object creation
 The application must create a single BibleSync object, identifying the
@@ -216,13 +211,14 @@
 Intended for use when preparing to enter any active mode, the application
 may request the current passphrase, so as to provide a default.
 .SS Transmit
-The application must provide the message type, which in the normal case
-should be
-.I BSP_SYNC.
 The protocol requires all the indicated parameters, but all have defaults
 in
 .BI Transmit:
 KJV, Gen.1.1, empty alternate, 1, and BIBLE-VERSE.
+.SS Chat
+This is a method for transmission of casual text messages to all others in
+the conversation.  It is expected to be received by applications who will
+display them in a suitable manner to the user.
 .SS Receive
 This is a static method accessible from either C or C++.  It must be
 called with the object pointer so as to re-enter object context for the
@@ -238,12 +234,22 @@
 single system, when in Personal mode, the application may also request
 privacy.  The effect is to set multicast TTL to zero, meaning that packets
 will not go out on the wire.
+.SS setBeaconCount
+Beacon transmission occurs during every Nth call to Receive(); the default
+value is 10. This presumes the application will call Receive() once per
+second. If the application will call Receive() less frequently, divide
+that time (say, 2 seconds) into 10 to get a value (5) to use with this
+call. Use setBeaconCount() prior to enabling Personal or Speaker mode.
+.SS setUser
+If the application allows the user to set a name via settings dialog,
+setUser() is available to re-assign the associated user name as seen by
+others.
 .SS listenToSpeaker
 Aside from default listen behavior detailed above, the application
 specifically asks to listen or not to listen to specific Speakers.  The
 key is as provided during the notification of a new Speaker.
 .SH RECEIVE USE CASES
-There are 6 values for the
+There are 7 values for the
 .I cmd
 parameter of the
 .I nav_func.
@@ -281,6 +287,11 @@
 .I speakerkey
 holds the UUID key of a previously-identified application which is no
 longer a candidate for listening.
+.SS 'C'
+Chat.
+Message text is in
+.I alt
+and other parameters are overloaded as per announce, above.
 .SS 'M'
 Mismatch.  The incoming event packet is mismatched, either against the
 current passphrase or for a navigation synchronization packet when
@@ -321,7 +332,12 @@
 mode, Receive is again scheduled for polled use.
 
 A 1-second poll interval is expected.  Brief experience during development
-has shown that longer intervals lead to a perception of lag.
+has shown that longer intervals lead to a perception of lag. If the
+application designer nonetheless expects to call
+.BI Receive()
+less frequently, it is necessary to use
+.BI setBeaconCount()
+to change the number of calls to it between beacon transmissions.
 
 During every
 .BI Receive()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/man/biblesync.7.txt 
new/biblesync-2.0.1/man/biblesync.7.txt
--- old/biblesync-1.1.2/man/biblesync.7.txt     2014-12-19 16:26:47.000000000 
+0100
+++ new/biblesync-2.0.1/man/biblesync.7.txt     2018-04-28 06:33:32.000000000 
+0200
@@ -1,7 +1,5 @@
 BIBLESYNC(7)               Linux Programmer's Manual              BIBLESYNC(7)
 
-
-
 NAME
        biblesync - multicast navigation synchronization in Bible programs
 
@@ -26,10 +24,6 @@
            N_BSP_XMIT
        } BibleSync_xmit_status;
 
-       #define BSP_ANNOUNCE   1
-       #define BSP_SYNC       2
-       #define BSP_BEACON     3
-
        typedef void (*BibleSync_navigate)(char cmd, string speakerkey,
                                           string bible, string ref, string alt,
                                           string group, string domain,
@@ -47,11 +41,13 @@
        BibleSync_mode BibleSync::getMode(void);
        string BibleSync::getVersion(void);
        string BibleSync::getPassphrase(void);
-       BibleSync_xmit_status BibleSync::Transmit(char type,
-                                                 string bible, string ref, 
string alt,
+       BibleSync_xmit_status BibleSync::Transmit(string bible, string ref, 
string alt,
                                                  string group, string domain);
+       BibleSync_xmit_status BibleSync::Chat(string message);
        static int BibleSync::Receive(void *object);
        bool BibleSync::setPrivate(bool privacy);
+       void BibleSync::setBeaconCount(uint8_t count);
+       void BibleSync::setUser(string user);
        void BibleSync::listenToSpeaker(bool listen, string speakerkey);
 
 DESCRIPTION
@@ -66,7 +62,7 @@
        ers/devices, all of which he wishes to follow along together.
 
        Similarly, a group of people working closely together, such as transla-
-       tors, can stay together as they work.
+       tors or a group Bible study, can stay together as they work.
 
        In an instructional motif, BibleSync takes either the active or passive
        mode, providing for a unidirectional navigation control.
@@ -102,34 +98,35 @@
 
        Transmitters  (Personal  and  Speaker modes) issue availability beacons
        every 10 seconds.  Received beacons for previously-unknown Speakers are
-       handed  up  to  the  application.   These beacons provide for receivers
-       (Personal and Audience modes) to maintain a managed list  of  available
-       Speakers.  Furthermore, when a transmitter ceases to issue beacons, its
-       presence in the list of available Speakers  is  aged  out  until  being
-       removed  after  30 seconds of beacon silence.  The application is again
-       informed when a Speaker goes dead.
-
-       Default listening behavior is that the first Speaker heard  via  beacon
-       is  marked  for  listening.  Other transmitters claiming Speaker status
-       via beacon are initially ignored, but their presence is made  known  to
-       the  application.  This provides for the application to maintain a list
-       from which the user can select Speakers he wishes  to  synchronize  his
+       handed  up  to  the application as "new Speaker" events.  These beacons
+       provide for receivers (Personal and Audience modes) to maintain a  man-
+       aged  list  of  available  Speakers.   Furthermore,  when a transmitter
+       ceases to issue beacons, its presence in the list of available Speakers
+       is  aged  out  until  being removed after 30 seconds of beacon silence.
+       The application is again informed as a Speaker ages out  with  a  "dead
+       Speaker" event.
+
+       Default  listening  behavior is that the first Speaker heard via beacon
+       is marked for listening.  Other transmitters  claiming  Speaker  status
+       via  beacon  are initially ignored, but their presence is made known to
+       the application.  This provides for the application to maintain a  list
+       from  which  the  user can select Speakers he wishes to synchronize his
        application.  It is useful for the application to provide blanket "lis-
-       ten to all" and "listen to none"  functions,  as  well  as  per-Speaker
-       selections,  informing  BibleSync  of these choices.  In any case, this
-       default "first Speaker only" policy can be overridden by  the  applica-
-       tion  with  any  other  policy  desired,  through the use of listenToS-
+       ten  to  all"  and  "listen  to none" functions, as well as per-Speaker
+       selections, informing BibleSync of these choices.  In  any  case,  this
+       default  "first  Speaker only" policy can be overridden by the applica-
+       tion with any other policy  desired,  through  the  use  of  listenToS-
        peaker() as the application designer requires.
 
        Synchronization events include 5 data elements: The Bible abbreviation;
-       the  verse reference; an alternate reference (if desired; not required)
-       which may allow the application to interpret better  based  on  variant
+       the verse reference; an alternate reference (if desired; not  required)
+       which  may  allow  the application to interpret better based on variant
        versification; a synchronization group identifier; and the domain.
 
        The group identifier is a single digit between 1 and 9.  The specifica-
-       tion is imprecise as to this parameter's use.  The initial  implementa-
-       tion  of BibleSync in Xiphos uses the synchronization group as an indi-
-       cator of the tab number in its tabbed interface: Not only is the  Bible
+       tion  is imprecise as to this parameter's use.  The initial implementa-
+       tion of BibleSync in Xiphos uses the synchronization group as an  indi-
+       cator  of the tab number in its tabbed interface: Not only is the Bible
        navigated, but the tab in which to navigate is selected.
 
        The domain parameter is currently fixed as "BIBLE-VERSE".  This will be
@@ -138,9 +135,6 @@
        BibleSync transmits no packet when the application leaves the conversa-
        tion.
 
-       Only  the  3  packet  types  BSP_ANNOUNCE, BSP_SYNC, and BSP_BEACON are
-       defined in the protocol.
-
 PUBLIC INTERFACE
    Object creation
        The application must create a single BibleSync object, identifying  the
@@ -167,33 +161,50 @@
        tion may request the current passphrase, so as to provide a default.
 
    Transmit
-       The application must provide the message type, which in the normal case
-       should be BSP_SYNC.  The protocol requires all  the  indicated  parame-
-       ters, but all have defaults in Transmit: KJV, Gen.1.1, empty alternate,
-       1, and BIBLE-VERSE.
+       The  protocol  requires  all  the  indicated  parameters,  but all have
+       defaults in Transmit: KJV, Gen.1.1,  empty  alternate,  1,  and  BIBLE-
+       VERSE.
+
+   Chat
+       This is a method for transmission of casual text messages to all others
+       in the conversation.  It is expected to be received by applications who
+       will display them in a suitable manner to the user.
 
    Receive
-       This is a static method accessible from either C or C++.   It  must  be
+       This  is  a  static method accessible from either C or C++.  It must be
        called with the object pointer so as to re-enter object context for the
-       private internal receiver.  Receive() must be  called  regularly  (i.e.
+       private  internal  receiver.   Receive() must be called regularly (i.e.
        polled) as long as it continues to return TRUE.  When it returns FALSE,
-       it means that the mode has changed to BSP_MODE_DISABLE, and the  sched-
+       it  means that the mode has changed to BSP_MODE_DISABLE, and the sched-
        uled polling should stop.  See also the note below on polled reception.
 
    setPrivate
-       In  the  circumstance where the user has multiple programs running on a
+       In the circumstance where the user has multiple programs running  on  a
        single computer and does not want his navigation broadcast outside that
-       single  system, when in Personal mode, the application may also request
-       privacy.  The effect is to set multicast  TTL  to  zero,  meaning  that
+       single system, when in Personal mode, the application may also  request
+       privacy.   The  effect  is  to  set multicast TTL to zero, meaning that
        packets will not go out on the wire.
 
+   setBeaconCount
+       Beacon transmission occurs during every  Nth  call  to  Receive();  the
+       default  value is 10. This presumes the application will call Receive()
+       once per second. If the  application  will  call  Receive()  less  fre-
+       quently,  divide  that time (say, 2 seconds) into 10 to get a value (5)
+       to use with this call. Use setBeaconCount() prior to enabling  Personal
+       or Speaker mode.
+
+   setUser
+       If  the  application allows the user to set a name via settings dialog,
+       setUser() is available to re-assign the associated user name as seen by
+       others.
+
    listenToSpeaker
        Aside  from  default  listen  behavior  detailed above, the application
        specifically asks to listen or not to listen to specific Speakers.  The
        key is as provided during the notification of a new Speaker.
 
 RECEIVE USE CASES
-       There  are  6  values  for  the  cmd parameter of the nav_func.  In all
+       There  are  7  values  for  the  cmd parameter of the nav_func.  In all
        cases, the dump parameter provides  the  raw  content  of  an  arriving
        packet.
 
@@ -216,34 +227,41 @@
        Dead Speaker.  speakerkey holds the UUID key of a previously-identified
        application which is no longer a candidate for listening.
 
+   'C'
+       Chat.  Message text is in alt and other parameters  are  overloaded  as
+       per announce, above.
+
    'M'
-       Mismatch.  The incoming event packet is mismatched, either against  the
-       current  passphrase  or  for  a  navigation synchronization packet when
-       BibleSync is in Speaker mode.  The info parameter  begins  with  either
+       Mismatch.   The incoming event packet is mismatched, either against the
+       current passphrase or for  a  navigation  synchronization  packet  when
+       BibleSync  is  in  Speaker mode.  The info parameter begins with either
        "announce" or "sync", plus the user and IP address from whom the packet
-       came.  As well, in the sync case, the regular bible, ref,  alt,  group,
-       and  domain  parameters are available.  In the announce case, the pres-
+       came.   As  well, in the sync case, the regular bible, ref, alt, group,
+       and domain parameters are available.  In the announce case,  the  pres-
        ence message is in alt, with overloaded individual parameters as previ-
        ously described.
 
    'E'
-       Error.   This  indicates  network  errors  and  malformed packets.  The
+       Error.  This indicates  network  errors  and  malformed  packets.   The
        application's nav_func is provided only the info and dump parameters.
 
 NOTES
    Polled reception
-       The application must provide a means by which  to  poll  regularly  for
-       incoming  packets.   In Xiphos, which is built on GTK and GLib, this is
+       The  application  must  provide  a means by which to poll regularly for
+       incoming packets.  In Xiphos, which is built on GTK and GLib,  this  is
        readily provided by mechanisms like g_timeout_add(), which sets a regu-
        lar interval call of the indicated function.  GLib will re-schedule the
-       call as long as the called function  returns  TRUE.   When  it  returns
+       call  as  long  as  the  called function returns TRUE.  When it returns
        FALSE, GLib un-schedules the call.  Receive() adheres to this straight-
-       forward convention.  Therefore, it is imperative that  every  time  the
-       application  moves  from  disabled to any non-disabled mode, Receive is
+       forward  convention.   Therefore,  it is imperative that every time the
+       application moves from disabled to any non-disabled  mode,  Receive  is
        again scheduled for polled use.
 
        A 1-second poll interval is expected.  Brief experience during develop-
-       ment has shown that longer intervals lead to a perception of lag.
+       ment has shown that longer intervals lead to a perception  of  lag.  If
+       the  application  designer  nonetheless  expects to call Receive() less
+       frequently, it is necessary to use setBeaconCount() to change the  num-
+       ber of calls to it between beacon transmissions.
 
        During every Receive() call, all waiting packets are processed.
 
@@ -295,6 +313,4 @@
        and  ip(7),  especially sections on IP_ADD_MEMBERSHIP, IP_MULTICAST_IF,
        IP_MULTICAST_LOOP, and IP_MULTICAST_TTL.
 
-
-
-Linux                             2014-10-31                      BIBLESYNC(7)
+Linux                             2018-04-27                      BIBLESYNC(7)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/man/specification.n 
new/biblesync-2.0.1/man/specification.n
--- old/biblesync-1.1.2/man/specification.n     2014-12-19 16:26:47.000000000 
+0100
+++ new/biblesync-2.0.1/man/specification.n     2018-04-28 06:33:32.000000000 
+0200
@@ -64,8 +64,6 @@
 0, so the user's entirely internal navigation is not also heard over the
 wire.
 
-
-
 .ti 0
 Packet Structure
 
@@ -90,10 +88,11 @@
 The magic value is 0x409CAF11, by which to determine that a packet is
 intended for BibleSync.
 
-The protocol version is 2.
+The protocol version is 3. The protocol interoperates with the previous
+version 2, though lacking the distinguishing feature of chat messages.
 
-Three message types are defined: 1 = presence announcement, 2 = navigation
-synchronization, 3 = speaker availability beacon.
+Four message types are defined: 1 = presence announcement, 2 = navigation
+synchronization, 3 = speaker availability beacon, 4 = chat message.
 
 Currently BibleSync is specified as a single packet protocol, but the
 number of packets and packet index fields are included for possible future
@@ -127,7 +126,10 @@
 
 The speaker beacon packet is identical to the presence announcement except
 for having message type 3, and is sent by transmitting applications every
-10 seconds.
+10 seconds. Beacon silence for 30 seconds indicates a dead Speaker.
+
+The chat message packet contains only 1 field, the message content, beyond
+those found in announce and beacon.
 
 .ti 0
 Speaker Beacons
@@ -181,7 +183,7 @@
 
 Continuation lines are not supported.
 
-There are 12 names defined for use in the body.  The application may
+There are 13 names defined for use in the body.  The application may
 provide any others its designer finds useful, but these names define the
 protocol's interoperability.
 
@@ -277,6 +279,14 @@
 Required in navigation.  This field has a fixed value of "BIBLE-VERSE" but
 its use will be expanded in future revisions.
 
+.in 3
+13. msg.chat
+
+.in 7
+Required for chat and useful only there. A free-from, newline-less text
+string to be shared in the conversation, intended to be displayed to all
+users.
+
 
 .in 3
 .ti 0
@@ -309,7 +319,7 @@
 Presence announcement:
 
     magic: 0x409caf11
-    version: 0x02
+    version: 0x03
     type: 0x01
     uuid: 00112233-4455-6677-8899-aabbccddeeff
     #pkt: 1
@@ -319,12 +329,12 @@
     app.user=John Doe (jdoe)
     msg.sync.passPhrase=qwerty
 
-Beacon is identical to presence announcement except for being type 3.
+Beacon is identical to presence announcement except for being type 0x03.
 
 Navigation:
 
     magic: 0x409caf11
-    version: 0x02
+    version: 0x03
     type: 0x02
     uuid: 00112233-4455-6677-8899-aabbccddeeff
     #pkt: 1
@@ -338,6 +348,20 @@
     msg.sync.bibleAbbrev=NET
     msg.sync.verse=Rom.14.4
 
+Chat:
+
+    magic: 0x409caf11
+    version: 0x03
+    type: 0x04
+    uuid: 00112233-4455-6677-8899-aabbccddeeff
+    #pkt: 1
+    pkt index: 0
+    app.name=TestBibleApp
+    app.inst.uuid=00112233-4455-6677-8899-aabbccddeeff
+    app.user=John Doe (jdoe)
+    msg.sync.passPhrase=qwerty
+    msg.chat=This is just a test message. No newlines permitted.
+
 Additional name/value examples, optional use:
 
     app.version=2.7a
@@ -345,16 +369,16 @@
     app.device=i686
     msg.sync.altVerse=1Mac.1.2
 
-Real-world example, using all defined names:
+Real-world example, navigation synchronization, using all defined names:
 
     magic: 0x409caf11
-    version: 0x02
+    version: 0x03
     type: 0x02 (sync)
     uuid: 49b387bd-6324-4a2e-871a-4b24e065bff7
     #pkt: 1
     pkt index: 0
     app.name=Xiphos
-    app.version=3.2.1
+    app.version=4.1.1
     app.inst.uuid=49b387bd-6324-4a2e-871a-4b24e065bff7
     app.os=Linux
     app.device=x86_64: Linux @ awol.kleinpaste.org
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/man/specification.txt 
new/biblesync-2.0.1/man/specification.txt
--- old/biblesync-1.1.2/man/specification.txt   2014-12-19 16:26:47.000000000 
+0100
+++ new/biblesync-2.0.1/man/specification.txt   2018-04-28 06:33:32.000000000 
+0200
@@ -50,7 +50,7 @@
        available by setting multicast TTL to 0, so the user’s entirely
        internal navigation is not also heard over the wire.
 
-
+    Packet Structure
 
 
 
@@ -64,8 +64,6 @@
     RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
 
 
-    Packet Structure
-
        Payload maximum length is 1280 bytes.  Within this, the first 32
        bytes are a header identifying the sender’s protocol version, message
        type, and UUID, and the remaining space consists of name/value pairs,
@@ -87,10 +85,13 @@
        The magic value is 0x409CAF11, by which to determine that a packet is
        intended for BibleSync.
 
-       The protocol version is 2.
-
-       Three message types are defined: 1 = presence announcement, 2 =
-       navigation synchronization, 3 = speaker availability beacon.
+       The protocol version is 3. The protocol interoperates with the
+       previous version 2, though lacking the distinguishing feature of chat
+       messages.
+
+       Four message types are defined: 1 = presence announcement, 2 =
+       navigation synchronization, 3 = speaker availability beacon, 4 = chat
+       message.
 
        Currently BibleSync is specified as a single packet protocol, but the
        number of packets and packet index fields are included for possible
@@ -111,7 +112,6 @@
 
        The presence packet announces the application’s participation in the
        conversation.  It is non-essential, but useful if the application
-       designer chooses to make it visible to the user.
 
 
 
@@ -124,6 +124,8 @@
     RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
 
 
+       designer chooses to make it visible to the user.
+
        The navigation packet specifies a Bible name and a reference.  It may
        also contain an alternate reference to provide a second means of
        interpretation so that e.g. differing Bible versifications might be
@@ -134,7 +136,11 @@
 
        The speaker beacon packet is identical to the presence announcement
        except for having message type 3, and is sent by transmitting
-       applications every 10 seconds.
+       applications every 10 seconds. Beacon silence for 30 seconds
+       indicates a dead Speaker.
+
+       The chat message packet contains only 1 field, the message content,
+       beyond those found in announce and beacon.
 
     Speaker Beacons
 
@@ -166,12 +172,6 @@
        claiming speaker status by sending beacons, and a newly-started
        application begins to listen, it may first hear the interloper’s
        beacon and begin listening to it.  The user must be able to consult a
-       list of potential speakers and pick the one(s) actually needed.
-
-       Beacons must be sent at least every 10 seconds.  Receivers must track
-       speaker beacons, aging speakers toward removal.  Each new beacon for
-       a speaker restarts its aging countdown.  A potential speaker that has
-       gone beacon-silent for 30 seconds is considered a dead speaker and is
 
 
 
@@ -184,6 +184,12 @@
     RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
 
 
+       list of potential speakers and pick the one(s) actually needed.
+
+       Beacons must be sent at least every 10 seconds.  Receivers must track
+       speaker beacons, aging speakers toward removal.  Each new beacon for
+       a speaker restarts its aging countdown.  A potential speaker that has
+       gone beacon-silent for 30 seconds is considered a dead speaker and is
        removed from the list of available speakers.
 
        Navigation synchronization received without beacon support is
@@ -200,7 +206,7 @@
 
        Continuation lines are not supported.
 
-       There are 12 names defined for use in the body.  The application may
+       There are 13 names defined for use in the body.  The application may
        provide any others its designer finds useful, but these names define
        the protocol’s interoperability.
 
@@ -227,12 +233,6 @@
 
            Optional; recommended.  The application’s version stamp.
 
-        6. app.os
-
-           Optional.  Identification of the OS under which the application
-           runs.
-
-
 
 
     Stergiou et al                                                 [Page 4]
@@ -244,6 +244,11 @@
     RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
 
 
+        6. app.os
+
+           Optional.  Identification of the OS under which the application
+           runs.
+
         7. app.device
 
            Optional.  Identification of the application’s device (hardware).
@@ -288,20 +293,25 @@
 
        12. msg.sync.domain
 
-           Required in navigation.  This field has a fixed value of "BIBLE-
-           VERSE" but its use will be expanded in future revisions.
 
 
+    Stergiou et al                                                 [Page 5]
 
 
 
-    Stergiou et al                                                 [Page 5]
 
 
+    RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
 
 
+           Required in navigation.  This field has a fixed value of "BIBLE-
+           VERSE" but its use will be expanded in future revisions.
 
-    RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
+       13. msg.chat
+
+           Required for chat and useful only there. A free-from, newline-
+           less text string to be shared in the conversation, intended to be
+           displayed to all users.
 
 
     Security Considerations
@@ -332,7 +342,7 @@
        Presence announcement:
 
            magic: 0x409caf11
-           version: 0x02
+           version: 0x03
            type: 0x01
            uuid: 00112233-4455-6677-8899-aabbccddeeff
            #pkt: 1
@@ -342,16 +352,6 @@
            app.user=John Doe (jdoe)
            msg.sync.passPhrase=qwerty
 
-       Beacon is identical to presence announcement except for being type 3.
-
-       Navigation:
-
-           magic: 0x409caf11
-           version: 0x02
-           type: 0x02
-           uuid: 00112233-4455-6677-8899-aabbccddeeff
-           #pkt: 1
-           pkt index: 0
 
 
 
@@ -364,6 +364,16 @@
     RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
 
 
+       Beacon is identical to presence announcement except for being type 0x03.
+
+       Navigation:
+
+           magic: 0x409caf11
+           version: 0x03
+           type: 0x02
+           uuid: 00112233-4455-6677-8899-aabbccddeeff
+           #pkt: 1
+           pkt index: 0
            app.name=TestBibleApp
            app.inst.uuid=00112233-4455-6677-8899-aabbccddeeff
            app.user=John Doe (jdoe)
@@ -373,6 +383,20 @@
            msg.sync.bibleAbbrev=NET
            msg.sync.verse=Rom.14.4
 
+       Chat:
+
+           magic: 0x409caf11
+           version: 0x03
+           type: 0x04
+           uuid: 00112233-4455-6677-8899-aabbccddeeff
+           #pkt: 1
+           pkt index: 0
+           app.name=TestBibleApp
+           app.inst.uuid=00112233-4455-6677-8899-aabbccddeeff
+           app.user=John Doe (jdoe)
+           msg.sync.passPhrase=qwerty
+           msg.chat=This is just a test message. No newlines permitted.
+
        Additional name/value examples, optional use:
 
            app.version=2.7a
@@ -380,16 +404,28 @@
            app.device=i686
            msg.sync.altVerse=1Mac.1.2
 
-       Real-world example, using all defined names:
+       Real-world example, navigation synchronization, using all defined names:
 
            magic: 0x409caf11
-           version: 0x02
+           version: 0x03
            type: 0x02 (sync)
            uuid: 49b387bd-6324-4a2e-871a-4b24e065bff7
            #pkt: 1
            pkt index: 0
+
+
+
+    Stergiou et al                                                 [Page 7]
+
+
+
+
+
+    RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
+
+
            app.name=Xiphos
-           app.version=3.2.1
+           app.version=4.1.1
            app.inst.uuid=49b387bd-6324-4a2e-871a-4b24e065bff7
            app.os=Linux
            app.device=x86_64: Linux @ awol.kleinpaste.org
@@ -412,18 +448,6 @@
        UUID:
            RFC 4122
 
-
-
-
-    Stergiou et al                                                 [Page 7]
-
-
-
-
-
-    RFC -BSP-              BibleSync Protocol - DRAFT           15 June 2014
-
-
        This specification alters and extends technical aspects of the original
        specification (cf. wikispaces, above), notably max packet size, size and
        alignment of header, speaker beacons, use of app.user, and stipulations
@@ -445,30 +469,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/src/biblesync.cc 
new/biblesync-2.0.1/src/biblesync.cc
--- old/biblesync-1.1.2/src/biblesync.cc        2014-12-19 16:26:47.000000000 
+0100
+++ new/biblesync-2.0.1/src/biblesync.cc        2018-04-28 06:33:32.000000000 
+0200
@@ -21,21 +21,33 @@
 
 using namespace std;
 
-// sync is a proper superset of announce & beacon,
+// chat is a proper superset of announce/beacon,
+// sync is a proper superset of chat,
 // both inbound as well as outbound.
-// in these 2 arrays of strings, sync-specific
-// fields are placed after announce fields.
-// see field_count in ReceiveInternal and Transmit.
+// in these 2 arrays of strings, chat-specific fields follow
+// announce fields, and sync-specific follow chat fields.
+// (chat overloads bible for this purpose.)
+// see field_count in ReceiveInternal + TransmitInternal.
 static string inbound_required[] = {
     BSP_APP_NAME,
     BSP_APP_INSTANCE_UUID,
     BSP_APP_USER,
     BSP_MSG_PASSPHRASE,
+    BSP_MSG_SYNC_BIBLEABBREV,
     BSP_MSG_SYNC_DOMAIN,
     BSP_MSG_SYNC_VERSE,
-    BSP_MSG_SYNC_BIBLEABBREV,
     BSP_MSG_SYNC_GROUP
 };
+#define        CHAT_INBOUND_INDEX      4       // index in list above.
+
+static int inbound_required_count[5] =
+{
+       0,                              // unused
+       BSP_FIELDS_RECV_ANNOUNCE,
+       BSP_FIELDS_RECV_SYNC,
+       BSP_FIELDS_RECV_ANNOUNCE,       // beacon identical to announce
+       BSP_FIELDS_RECV_CHAT
+};
 
 static string outbound_fill[] = {
     BSP_APP_NAME,
@@ -45,12 +57,24 @@
     BSP_APP_DEVICE,
     BSP_APP_USER,
     BSP_MSG_PASSPHRASE,
+    BSP_MSG_SYNC_BIBLEABBREV,
     BSP_MSG_SYNC_DOMAIN,
     BSP_MSG_SYNC_GROUP,
-    BSP_MSG_SYNC_BIBLEABBREV,
     BSP_MSG_SYNC_ALTVERSE,
     BSP_MSG_SYNC_VERSE         // last: could go overly long, risk cutoff.
 };
+#define        CHAT_OUTBOUND_INDEX     7       // index in list above.
+
+static int outbound_fill_count[5] =
+{
+       0,                              // unused
+       BSP_FIELDS_XMIT_ANNOUNCE,
+       BSP_FIELDS_XMIT_SYNC,
+       BSP_FIELDS_XMIT_ANNOUNCE,       // beacon identical to announce
+       BSP_FIELDS_XMIT_CHAT
+};
+
+static string chat_field = BSP_MSG_CHAT;       // for referential substitution.
 
 // BibleSync class constructor.
 // args identify the user of the class, by application, version, and user.
@@ -61,6 +85,7 @@
       user(u),
       receiving(false),
       beacon_countdown(0),
+      beacon_count(BSP_BEACON_COUNT),
       mode(BSP_MODE_DISABLE),
       nav_func(NULL),
       passphrase("BibleSync"),
@@ -196,7 +221,8 @@
 
        // one way or another, if we got this far with a valid socket,
        // and the app is in a public mode, "TTL 0" privacy makes no sense.
-       if ((client_fd >= 0) &&
+       if (ok_so_far &&
+           (client_fd >= 0) &&
            ((mode == BSP_MODE_SPEAKER) ||
             (mode == BSP_MODE_AUDIENCE)))
        {
@@ -254,8 +280,8 @@
        // user to start faking his own beacons & nav using our uuid.
        if ((mode == BSP_MODE_PERSONAL) || (mode == BSP_MODE_SPEAKER))
        {
-           Transmit(BSP_BEACON);
-           beacon_countdown = BSP_BEACON_COUNT;
+           TransmitInternal(BSP_BEACON);
+           beacon_countdown = beacon_count;
 
            // speaker mode => speaker list has become irrelevant.
            if (mode == BSP_MODE_SPEAKER)
@@ -270,7 +296,7 @@
 
        // now that we're alive, tell the network world that we're here.
        if (retval == "")
-           Transmit(BSP_ANNOUNCE);
+           TransmitInternal(BSP_ANNOUNCE);
     }
 
     return retval;
@@ -366,7 +392,9 @@
                                   ? "sync"
                                   : ((bsp.msg_type == BSP_BEACON)
                                      ? "beacon"
-                                     : "*???*"))),
+                                     : ((bsp.msg_type == BSP_CHAT)
+                                        ? "chat"
+                                        : "*???*")))),
                 uuid_dump_string,
                 bsp.num_packets, bsp.index_packet,
                 bsp.body);
@@ -376,13 +404,15 @@
            (*nav_func)('E', EMPTY,
                        EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
                        BSP + _("bad magic"), dump);
-       else if (bsp.version != BSP_PROTOCOL)
+       else if ((bsp.version != BSP_PROTOCOL) && (bsp.version != 
BSP_OLD_PROTOCOL))
+           // we are fine with previous v2 protocol that lacks chat messages.
            (*nav_func)('E', EMPTY,
                        EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
                        BSP + _("bad protocol version"), dump);
        else if ((bsp.msg_type != BSP_ANNOUNCE) &&
                 (bsp.msg_type != BSP_SYNC) &&
-                (bsp.msg_type != BSP_BEACON))
+                (bsp.msg_type != BSP_BEACON) &&
+                (bsp.msg_type != BSP_CHAT))
            (*nav_func)('E', EMPTY,
                        EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
                        BSP + _("bad msg type"), dump);
@@ -442,13 +472,16 @@
            else
            {
                // verify minimum body content.
-               int field_count = ((bsp.msg_type == BSP_SYNC)
-                                  ? BSP_FIELDS_RECV_SYNC
-                                  : BSP_FIELDS_RECV_ANNOUNCE); // or beacon.
+               int field_count = inbound_required_count[bsp.msg_type];
 
                for (int i = 0; i < field_count; ++i)
                {
-                   if (content.find(inbound_required[i]) == content.end())
+                   string &locator = (((bsp.msg_type == BSP_CHAT) &&
+                                       (i == CHAT_INBOUND_INDEX))
+                                      ? chat_field
+                                      : inbound_required[i]);
+
+                   if (content.find(locator) == content.end())
                    {
                        ok_so_far = false;
                        string info = BSP + _("missing required header ")
@@ -525,7 +558,25 @@
                        version = (string)"(version?)";
                
                    // generally good, so extract interesting content.
-                   if (bsp.msg_type == BSP_SYNC)
+                   if (bsp.msg_type == BSP_CHAT)
+                   {
+                       bible  = content.find(BSP_APP_USER)->second;
+                       ref    = source_addr;
+                       group  = content.find(BSP_APP_NAME)->second
+                           + " " + version;
+                       domain = content.find(BSP_APP_DEVICE)->second;
+                       alt    = content.find(BSP_MSG_CHAT)->second;
+
+                       info = (string)"chat: "
+                           + content.find(BSP_APP_USER)->second
+                           + " @ " + source_addr;
+
+                       cmd = ((passphrase ==
+                               content.find(BSP_MSG_PASSPHRASE)->second)
+                              ? 'C'    // chat message
+                              : 'M');  // mismatch
+                   }
+                   else if (bsp.msg_type == BSP_SYNC)
                    {
                        // regular synchronized navigation
                        bible  = content.find(BSP_MSG_SYNC_BIBLEABBREV)->second;
@@ -616,7 +667,7 @@
                            // whether previously known or not,
                            // a beacon (re)starts the aging countdown.
                            speakers[pkt_uuid].countdown =
-                               BSP_BEACON_COUNT * BSP_BEACON_MULTIPLIER;
+                               beacon_count * BSP_BEACON_MULTIPLIER;
 
                            new_speakers_size = speakers.size();
 
@@ -670,8 +721,8 @@
         (mode == BSP_MODE_SPEAKER)) &&
        (--beacon_countdown == 0))
     {
-       Transmit(BSP_BEACON);
-       beacon_countdown = BSP_BEACON_COUNT;
+       TransmitInternal(BSP_BEACON);
+       beacon_countdown = beacon_count;
     }
 
     return TRUE;
@@ -724,12 +775,13 @@
 // speaker transmitter
 // sanity checks for permission to xmit,
 // then format and ship it.
-BibleSync_xmit_status BibleSync::Transmit(char message_type,
-                                         string bible,
-                                         string ref,
-                                         string alt,
-                                         string group,
-                                         string domain)
+BibleSync_xmit_status
+BibleSync::TransmitInternal(char message_type,
+                           string bible,
+                           string ref,
+                           string alt,
+                           string group,
+                           string domain)
 {
     if (mode == BSP_MODE_DISABLE)
        return BSP_XMIT_FAILED;
@@ -742,7 +794,8 @@
 
     if ((message_type != BSP_ANNOUNCE) &&
        (message_type != BSP_SYNC) &&
-       (message_type != BSP_BEACON))
+       (message_type != BSP_BEACON) &&
+       (message_type != BSP_CHAT))
        return BSP_XMIT_BAD_TYPE;
 
     if ((mode == BSP_MODE_AUDIENCE) &&
@@ -754,18 +807,25 @@
     string body = "";
 
     // all name/value pairs.
-    content[BSP_APP_NAME]             = application;
-    content[BSP_APP_VERSION]          = version;
-    content[BSP_APP_USER]             = user;
-    content[BSP_APP_DEVICE]           = device;
-    content[BSP_APP_OS]               = BSP_OS;
-    content[BSP_APP_INSTANCE_UUID]    = uuid_string;
-    content[BSP_MSG_SYNC_BIBLEABBREV] = bible;
-    content[BSP_MSG_SYNC_VERSE]       = ref;
-    content[BSP_MSG_SYNC_ALTVERSE]    = alt;
-    content[BSP_MSG_SYNC_GROUP]       = group;
-    content[BSP_MSG_SYNC_DOMAIN]      = domain;
-    content[BSP_MSG_PASSPHRASE]       = passphrase;
+    content[BSP_APP_NAME]                 = application;
+    content[BSP_APP_VERSION]              = version;
+    content[BSP_APP_USER]                 = user;
+    content[BSP_APP_DEVICE]               = device;
+    content[BSP_APP_OS]                   = BSP_OS;
+    content[BSP_APP_INSTANCE_UUID]        = uuid_string;
+    if (message_type != BSP_CHAT)
+       content[BSP_MSG_SYNC_BIBLEABBREV] = bible;
+    else {
+       content[BSP_MSG_CHAT]             = bible;      // overload.
+       // innoculate chat content against internal \n.
+       for (char *chase = (char *)bible.c_str(); chase = strchr(chase, '\n'); 
++chase)
+           *chase = '\t';
+    }
+    content[BSP_MSG_SYNC_VERSE]           = ref;
+    content[BSP_MSG_SYNC_ALTVERSE]        = alt;
+    content[BSP_MSG_SYNC_GROUP]           = group;
+    content[BSP_MSG_SYNC_DOMAIN]          = domain;
+    content[BSP_MSG_PASSPHRASE]           = passphrase;
 
     // header.
     bsp.magic = BSP_MAGIC;
@@ -777,13 +837,15 @@
     memset((void *)&bsp.reserved, 0, BSP_RES_SIZE);
 
     // body prep.
-    int field_count = ((message_type == BSP_SYNC)
-                      ? BSP_FIELDS_XMIT_SYNC
-                      : BSP_FIELDS_XMIT_ANNOUNCE);     // or beacon.
+    int field_count = outbound_fill_count[message_type];
 
     for (int i = 0; i < field_count; ++i)
     {
-       body += outbound_fill[i] + "=" + content[outbound_fill[i]] + "\n";
+       string &filler = (((message_type == BSP_CHAT) &&
+                          (i == CHAT_OUTBOUND_INDEX))
+                         ? chat_field
+                         : outbound_fill[i]);
+       body += filler + "=" + content[filler] + "\n";
     }
 
     // ship it.
@@ -792,6 +854,7 @@
                                 BSP_HEADER_SIZE + body.length());
 
     // force last == newline: attempt to preserve body format when long.
+    // (cuts off excessively long verse references and chat messages.)
     ((unsigned char*)&bsp)[BSP_MAX_SIZE-1] = '\n';
 
     BibleSync_xmit_status retval;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/win32.opts 
new/biblesync-2.0.1/win32.opts
--- old/biblesync-1.1.2/win32.opts      2014-12-19 16:26:47.000000000 +0100
+++ new/biblesync-2.0.1/win32.opts      2018-04-28 06:33:32.000000000 +0200
@@ -8,7 +8,7 @@
 WIN32_OPTS="$WIN32_OPTS 
-DSHARE_INSTALL_PREFIX:PATH=/usr/i686-w64-mingw32/sys-root/mingw/share"
 WIN32_OPTS="$WIN32_OPTS -DCMAKE_SKIP_RPATH:BOOL=ON"
 WIN32_OPTS="$WIN32_OPTS -DBUILD_SHARED_LIBS:BOOL=ON"
-WIN32_OPTS="$WIN32_OPTS 
-DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/Toolchain-mingw32.cmake"
+WIN32_OPTS="$WIN32_OPTS 
-DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw32.cmake"
 WIN32_OPTS="$WIN32_OPTS -DLIBBIBLESYNC_LIBRARY_TYPE=Shared"
 WIN32_OPTS="$WIN32_OPTS -DCMAKE_BUILD_TYPE=Debug"
 WIN32_OPTS="$WIN32_OPTS -DCROSS_COMPILE_MINGW32=TRUE"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/biblesync-1.1.2/win64.opts 
new/biblesync-2.0.1/win64.opts
--- old/biblesync-1.1.2/win64.opts      1970-01-01 01:00:00.000000000 +0100
+++ new/biblesync-2.0.1/win64.opts      2018-04-28 06:33:32.000000000 +0200
@@ -0,0 +1,15 @@
+#!/bin/sh
+WIN64_OPTS=
+WIN64_OPTS="$WIN64_OPTS -DCMAKE_VERBOSE_MAKEFILE=ON"
+WIN64_OPTS="$WIN64_OPTS 
-DCMAKE_INSTALL_PREFIX:PATH=/usr/x86_64-w64-mingw32/sys-root/mingw"
+WIN64_OPTS="$WIN64_OPTS 
-DCMAKE_INSTALL_LIBDIR:PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/lib"
+WIN64_OPTS="$WIN64_OPTS 
-DINCLUDE_INSTALL_DIR:PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/include"
+WIN64_OPTS="$WIN64_OPTS 
-DLIB_INSTALL_DIR:PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/lib"
+WIN64_OPTS="$WIN64_OPTS 
-DSHARE_INSTALL_PREFIX:PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/share"
+WIN64_OPTS="$WIN64_OPTS -DCMAKE_SKIP_RPATH:BOOL=ON"
+WIN64_OPTS="$WIN64_OPTS -DBUILD_SHARED_LIBS:BOOL=ON"
+WIN64_OPTS="$WIN64_OPTS 
-DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw64.cmake"
+WIN64_OPTS="$WIN64_OPTS -DLIBBIBLESYNC_LIBRARY_TYPE=Shared"
+WIN64_OPTS="$WIN64_OPTS -DCMAKE_BUILD_TYPE=Debug"
+WIN64_OPTS="$WIN64_OPTS -DCROSS_COMPILE_MINGW32=TRUE"
+export WIN64_OPTS


Reply via email to