[Libreoffice-commits] online.git: 2 commits - loolwsd/ChildSession.hpp loolwsd/ClientSession.cpp loolwsd/LOOLKit.cpp loolwsd/LOOLSession.cpp

Pranav Kant pranavk at collabora.co.uk
Tue Aug 30 07:46:27 UTC 2016


 loolwsd/ChildSession.hpp  |    4 ----
 loolwsd/ClientSession.cpp |    6 +++++-
 loolwsd/LOOLKit.cpp       |   22 +++-------------------
 loolwsd/LOOLSession.cpp   |    4 +++-
 4 files changed, 11 insertions(+), 25 deletions(-)

New commits:
commit 76884fc020fdadf87247e23ebaac1245139a68c7
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Aug 30 12:04:36 2016 +0530

    loolwsd: Remove unused method
    
    Change-Id: I9fcd2610c9cd27a32a9a835801ef627a631a85da
    Reviewed-on: https://gerrit.libreoffice.org/28485
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loolwsd/ChildSession.hpp b/loolwsd/ChildSession.hpp
index 3295ab4..f181ef9 100644
--- a/loolwsd/ChildSession.hpp
+++ b/loolwsd/ChildSession.hpp
@@ -40,10 +40,6 @@ public:
     virtual
     void onUnload(const ChildSession& session) = 0;
 
-    /// Get a list of all current view IDs.
-    virtual
-    std::vector<int> getViewIds() const = 0;
-
     /// Send message to all other sessions except 'sessionId'
     virtual
     void notifyOtherSessions(const std::string& sessionId, const std::string& message) const = 0;
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 161921c..ac72c4d 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -930,24 +930,6 @@ private:
         }
     }
 
-    std::vector<int> getViewIds() const override
-    {
-        std::unique_lock<std::mutex> lock(_mutex);
-
-        std::vector<int> v;
-        v.reserve(_connections.size());
-        for (const auto& connection : _connections)
-        {
-            const auto& session = connection.second->getSession();
-            if (session)
-            {
-                v.push_back(session->getViewId());
-            }
-        }
-
-        return v;
-    }
-
     void notifyOtherSessions(const std::string& sessionId, const std::string& message) const override
     {
         std::unique_lock<std::mutex> lock(_mutex);
commit db5efae2b81449186552ae6838806304e1d61a48
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Aug 30 11:38:07 2016 +0530

    loolwsd: Handle user names with spaces; encode/decode properly
    
    Change-Id: I209bbd63686db8112529a3442a13a6162ce14d60
    Reviewed-on: https://gerrit.libreoffice.org/28484
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loolwsd/ClientSession.cpp b/loolwsd/ClientSession.cpp
index c4ac637..901d138 100644
--- a/loolwsd/ClientSession.cpp
+++ b/loolwsd/ClientSession.cpp
@@ -229,7 +229,11 @@ bool ClientSession::loadDocument(const char* /*buffer*/, int /*length*/, StringT
         oss << " jail=" << _docBroker->getJailedUri().toString();
 
         if (!_userName.empty())
-            oss << " author=" + _userName;
+        {
+            std::string encodedUserName;
+            Poco::URI::encode(_userName, "", encodedUserName);
+            oss << " author=" + encodedUserName;
+        }
 
         if (_loadPart >= 0)
             oss << " part=" + std::to_string(_loadPart);
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 781610f..161921c 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -1118,7 +1118,9 @@ private:
             Object::Ptr authorContainer = new Object();
             Object::Ptr authorObj = new Object();
             authorObj->set("type", "string");
-            authorObj->set("value", userName);
+            std::string decodedUserName;
+            URI::decode(userName, decodedUserName);
+            authorObj->set("value", decodedUserName);
 
             renderOptsObj->set(".uno:Author", authorObj);
         }
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 1e0686f..3664bd0 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -31,6 +31,7 @@
 #include <Poco/Path.h>
 #include <Poco/String.h>
 #include <Poco/StringTokenizer.h>
+#include <Poco/URI.h>
 
 #include "ChildSession.hpp"
 #include "Common.hpp"
@@ -161,7 +162,8 @@ void LOOLSession::parseDocOptions(const StringTokenizer& tokens, int& part, std:
         }
         else if (tokens[i].find("author=") == 0)
         {
-            _userName = tokens[i].substr(strlen("author="));
+            std::string userName = tokens[i].substr(strlen("author="));
+            Poco::URI::decode(userName, _userName);
             ++offset;
         }
         else if (tokens[i].find("timestamp=") == 0)


More information about the Libreoffice-commits mailing list