[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/LOOLForKit.cpp loolwsd/LOOLKit.cpp loolwsd/LOOLKit.hpp loolwsd/LOOLWSD.cpp

Michael Meeks michael.meeks at collabora.com
Thu Oct 6 10:26:50 UTC 2016


 loolwsd/LOOLForKit.cpp |    6 ++++--
 loolwsd/LOOLKit.cpp    |    8 ++++++--
 loolwsd/LOOLKit.hpp    |    3 ++-
 loolwsd/LOOLWSD.cpp    |    2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 9667a2d363a29acfcfc728861f16041d6e939afb
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Oct 6 11:17:36 2016 +0100

    Improve and standardize version details: display on start.

diff --git a/loolwsd/LOOLForKit.cpp b/loolwsd/LOOLForKit.cpp
index e7c977e..1c4144e 100644
--- a/loolwsd/LOOLForKit.cpp
+++ b/loolwsd/LOOLForKit.cpp
@@ -46,6 +46,7 @@ using Poco::Thread;
 using Poco::Util::Application;
 
 static bool NoCapsForKit = false;
+static bool DisplayVersion = false;
 static std::string UnitTestLibrary;
 static std::atomic<unsigned> ForkCounter( 0 );
 
@@ -158,7 +159,7 @@ static int createLibreOfficeKit(const std::string& childRoot,
             Thread::sleep(std::stoul(std::getenv("SLEEPKITFORDEBUGGER")) * 1000);
         }
 
-        lokit_main(childRoot, sysTemplate, loTemplate, loSubPath, NoCapsForKit, queryVersion);
+        lokit_main(childRoot, sysTemplate, loTemplate, loSubPath, NoCapsForKit, queryVersion, DisplayVersion);
     }
     else
     {
@@ -255,7 +256,8 @@ int main(int argc, char** argv)
         {
             std::string version, hash;
             Util::getVersionInfo(version, hash);
-            std::cout << "loolforkit " << version << " - " << hash << std::endl;
+            std::cout << "loolforkit version details: " << version << " - " << hash << std::endl;
+            DisplayVersion = true;
         }
 #if ENABLE_DEBUG
         // this process has various privileges - don't run arbitrary code.
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 67d6d24..e989d9f 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -1192,7 +1192,8 @@ void lokit_main(const std::string& childRoot,
                 const std::string& loTemplate,
                 const std::string& loSubPath,
                 bool noCapabilities,
-                bool queryVersion)
+                bool queryVersion,
+                bool displayVersion)
 {
     // Reinitialize logging when forked.
     Log::initialize("kit");
@@ -1348,8 +1349,11 @@ void lokit_main(const std::string& childRoot,
         if (queryVersion)
         {
             char* versionInfo = loKit->pClass->getVersionInfo(loKit);
+            std::string versionString(versionInfo);
+            if (displayVersion)
+                std::cout << "office version details: " << versionString << std::endl;
             std::string encodedVersionStr;
-            URI::encode(std::string(versionInfo), "", encodedVersionStr);
+            URI::encode(versionString, "", encodedVersionStr);
             requestUrl += "&version=" + encodedVersionStr;
             free(versionInfo);
         }
diff --git a/loolwsd/LOOLKit.hpp b/loolwsd/LOOLKit.hpp
index 4206133..7a0784a 100644
--- a/loolwsd/LOOLKit.hpp
+++ b/loolwsd/LOOLKit.hpp
@@ -14,7 +14,8 @@ void lokit_main(const std::string& childRoot,
                 const std::string& loTemplate,
                 const std::string& loSubPath,
                 bool noCapabilities,
-                bool queryVersionInfo);
+                bool queryVersionInfo,
+                bool displayVersion);
 
 bool globalPreinit(const std::string &loTemplate);
 
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 81c26bd..be5a2c0 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1661,7 +1661,7 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
     {
         std::string version, hash;
         Util::getVersionInfo(version, hash);
-        std::cout << "loolwsd " << version << " - " << hash << std::endl;
+        std::cout << "loolwsd version details: " << version << " - " << hash << std::endl;
     }
 
     initializeSSL();


More information about the Libreoffice-commits mailing list