loleaflet/dist/loleaflet.html |    2 +-
 loleaflet/src/core/Socket.js  |   12 ++++++++----
 loolwsd/ClientSession.cpp     |    6 +++++-
 3 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 8bba9da761af5c2b253174128e380936036dad13
Author: Pranav Kant <pran...@collabora.com>
Date:   Tue Jun 21 22:11:33 2016 +0530

    Make new version string as a JSON string
    
    ... easy to differentiate on client side among various version
    info parts, especially for LOKit version information.
    
    Change-Id: I4ba18c60367fb9166462b535bc46953a82a8435d

diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index 0a1bb9a..501dbc3 100644
--- a/loleaflet/dist/loleaflet.html
+++ b/loleaflet/dist/loleaflet.html
@@ -139,7 +139,7 @@
     <div id="about-dialog" style="display:none; text-align: center;">
       <h1 class="translatable">About LibreOffice Online</h1>
       <hr/>
-      <h3 class="translatable">This version of LibreOffice Online is powered 
by<h3>
+      <h3 class="translatable">This version of LibreOffice Online is powered 
by</h3>
       <p>
         <h3>LOOLWSD</h3>
         <div id="loolwsd-version"></div>
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 08402ab..f8b5564 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -127,16 +127,20 @@ L.Socket = L.Class.extend({
                var command = this.parseServerCmd(textMsg);
                if (textMsg.startsWith('loolserver ')) {
                        // This must be the first message, unless we reconnect.
-                       var versionStr = textMsg.split(' ');
-                       $('#loolwsd-version').text(versionStr[1] + ' ' + 
versionStr[2]);
+                       var loolwsdVersionObj = 
JSON.parse(textMsg.substring(textMsg.indexOf('{')));
+                       $('#loolwsd-version').text(loolwsdVersionObj.Version +
+                                                  ' (git hash: ' + 
loolwsdVersionObj.Hash + ')');
 
                        // TODO: For now we expect perfect match in protocol 
versions
-                       if (versionStr[3] !== this.ProtocolVersionNumber) {
+                       if (loolwsdVersionObj.Protocol !== 
this.ProtocolVersionNumber) {
                                this.fire('error', {msg: _('Unsupported server 
version.')});
                        }
                }
                else if (textMsg.startsWith('lokitversion ')) {
-                       $('#lokit-version').text(textMsg.substring(13));
+                       var lokitVersionObj = 
JSON.parse(textMsg.substring(textMsg.indexOf('{')));
+                       $('#lokit-version').text(lokitVersionObj.ProductName + 
' ' +
+                                                lokitVersionObj.ProductVersion 
+ lokitVersionObj.ProductExtension +
+                                                ' (git hash: ' + 
lokitVersionObj.BuildId.substring(0, 7) + ')');
                }
                else if (textMsg.startsWith('error:') && command.errorCmd === 
'load') {
                        this.close();
diff --git a/loolwsd/ClientSession.cpp b/loolwsd/ClientSession.cpp
index ad73943..e23272d 100644
--- a/loolwsd/ClientSession.cpp
+++ b/loolwsd/ClientSession.cpp
@@ -81,7 +81,11 @@ bool ClientSession::_handleInput(const char *buffer, int 
length)
         // Send LOOL version information
         std::string version, hash;
         Util::getVersionInfo(version, hash);
-        sendTextFrame("loolserver " + version + " " + hash + " " + 
GetProtocolVersion());
+        std::string versionStr =
+            "{ \"Version\":  \"" + version + "\", " +
+            "\"Hash\":     \"" + hash + "\", " +
+            "\"Protocol\": \"" + GetProtocolVersion() + "\" }";
+        sendTextFrame("loolserver " + versionStr);
         // Send LOKit version information
         sendTextFrame("lokitversion " + LOOLWSD::LOKitVersion);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to