kit/ChildSession.cpp | 2 +- kit/Kit.cpp | 10 +++++----- kit/Kit.hpp | 41 +++++++++++++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 16 deletions(-)
New commits: commit 54d788e69bce6c0595cf2df695144a63587de774 Author: Miklos Vajna <[email protected]> AuthorDate: Tue Oct 30 08:41:46 2018 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Tue Oct 30 08:41:52 2018 +0100 UserInfo: make members private diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index fe2fc458c..dbdc2f250 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -517,7 +517,7 @@ void insertUserNames(const std::map<int, UserInfo>& viewInfo, std::string& json) int viewId = action->getValue<int>("viewId"); auto it = viewInfo.find(viewId); if (it != viewInfo.end()) - action->set("userName", Poco::Dynamic::Var(it->second.Username)); + action->set("userName", Poco::Dynamic::Var(it->second.getUserName())); } } } diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 3654865ca..cbfa9f01e 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1477,12 +1477,12 @@ private: } else { - oss << "\"userid\":\"" << itView->second.UserId << "\","; - const std::string username = itView->second.Username; + oss << "\"userid\":\"" << itView->second.getUserId() << "\","; + const std::string username = itView->second.getUserName(); oss << "\"username\":\"" << username << "\","; - if (!itView->second.UserExtraInfo.empty()) - oss << "\"userextrainfo\":" << itView->second.UserExtraInfo << ","; - const bool readonly = itView->second.IsReadOnly; + if (!itView->second.getUserExtraInfo().empty()) + oss << "\"userextrainfo\":" << itView->second.getUserExtraInfo() << ","; + const bool readonly = itView->second.isReadOnly(); oss << "\"readonly\":\"" << readonly << "\","; const auto it = viewColorsMap.find(username); if (it != viewColorsMap.end()) diff --git a/kit/Kit.hpp b/kit/Kit.hpp index 1ccfcb0f8..cf7d34d46 100644 --- a/kit/Kit.hpp +++ b/kit/Kit.hpp @@ -63,20 +63,41 @@ struct UserInfo } UserInfo(const std::string& userId, - const std::string& username, + const std::string& userName, const std::string& userExtraInfo, - const bool readonly) : - UserId(userId), - Username(username), - UserExtraInfo(userExtraInfo), - IsReadOnly(readonly) + bool readOnly) : + _userId(userId), + _userName(userName), + _userExtraInfo(userExtraInfo), + _readOnly(readOnly) { } - std::string UserId; - std::string Username; - std::string UserExtraInfo; - bool IsReadOnly; + const std::string& getUserId() const + { + return _userId; + } + + const std::string& getUserName() const + { + return _userName; + } + + const std::string& getUserExtraInfo() const + { + return _userExtraInfo; + } + + bool isReadOnly() const + { + return _readOnly; + } + +private: + std::string _userId; + std::string _userName; + std::string _userExtraInfo; + bool _readOnly; }; /// Check the ForkCounter, and if non-zero, fork more of them accordingly. _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
