diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-20 16:14:19 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-20 16:14:19 +0200 |
commit | d6844595c9b47dab1db4b970ff6cc7fb3f64f107 (patch) | |
tree | c334db5dba4ae65636ad0b57c8ed7814e08b823b /src/modules/UserListManager/RequestHandlers | |
parent | d0cc9153d53dd4bc8dadf8bbcbe4ac72dfbbb61e (diff) | |
download | mad-d6844595c9b47dab1db4b970ff6cc7fb3f64f107.tar mad-d6844595c9b47dab1db4b970ff6cc7fb3f64f107.zip |
UserListManager: Added copy and rename requests
Diffstat (limited to 'src/modules/UserListManager/RequestHandlers')
-rw-r--r-- | src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp | 40 | ||||
-rw-r--r-- | src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h | 4 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp index 99d2818..61bbf07 100644 --- a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp +++ b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp @@ -55,6 +55,24 @@ void UserListRequestHandlerGroup::handleUserListDownloadRequest(boost::shared_pt Util::serializeUserList(userList.get(), ret); } +void UserListRequestHandlerGroup::handleUserListCopyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { + if(!connection->isAuthenticated()) + throw(Core::Exception(Core::Exception::PERMISSION)); + + userListManager->copyUserList(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName")); + + ret->setType("OK"); +} + +void UserListRequestHandlerGroup::handleUserListRenameRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { + if(!connection->isAuthenticated()) + throw(Core::Exception(Core::Exception::PERMISSION)); + + userListManager->renameUserList(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName")); + + ret->setType("OK"); +} + void UserListRequestHandlerGroup::handleUserListRemoveRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -94,6 +112,24 @@ void UserListRequestHandlerGroup::handleUserListDiffDownloadRequest(boost::share Util::serializeUserListDiff(diff.get(), ret); } +void UserListRequestHandlerGroup::handleUserListDiffCopyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { + if(!connection->isAuthenticated()) + throw(Core::Exception(Core::Exception::PERMISSION)); + + userListManager->copyUserListDiff(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName")); + + ret->setType("OK"); +} + +void UserListRequestHandlerGroup::handleUserListDiffRenameRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { + if(!connection->isAuthenticated()) + throw(Core::Exception(Core::Exception::PERMISSION)); + + userListManager->renameUserListDiff(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName")); + + ret->setType("OK"); +} + void UserListRequestHandlerGroup::handleUserListDiffRemoveRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); @@ -108,10 +144,14 @@ UserListRequestHandlerGroup::UserListRequestHandlerGroup(Server::Application *ap : application(application0), userListManager(userListManager0) { registerHandler("ListUserLists", boost::bind(&UserListRequestHandlerGroup::handleUserListListRequest, this, _1, _2, _3)); registerHandler("DownloadUserList", boost::bind(&UserListRequestHandlerGroup::handleUserListDownloadRequest, this, _1, _2, _3)); + registerHandler("CopyUserList", boost::bind(&UserListRequestHandlerGroup::handleUserListCopyRequest, this, _1, _2, _3)); + registerHandler("RenameUserList", boost::bind(&UserListRequestHandlerGroup::handleUserListRenameRequest, this, _1, _2, _3)); registerHandler("RemoveUserList", boost::bind(&UserListRequestHandlerGroup::handleUserListRemoveRequest, this, _1, _2, _3)); registerHandler("ListUserListDiffs", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffListRequest, this, _1, _2, _3)); registerHandler("DownloadUserListDiff", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffDownloadRequest, this, _1, _2, _3)); + registerHandler("CopyUserListDiff", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffCopyRequest, this, _1, _2, _3)); + registerHandler("RenameUserListDiff", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffRenameRequest, this, _1, _2, _3)); registerHandler("RemoveUserListDiff", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffRemoveRequest, this, _1, _2, _3)); } diff --git a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h index 105621b..61f4c7d 100644 --- a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h +++ b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h @@ -44,10 +44,14 @@ class MAD_MODULE_EXPORT UserListRequestHandlerGroup : public Common::RequestHan void handleUserListListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); void handleUserListDownloadRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserListCopyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserListRenameRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); void handleUserListRemoveRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); void handleUserListDiffListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); void handleUserListDiffDownloadRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserListDiffCopyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); + void handleUserListDiffRenameRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); void handleUserListDiffRemoveRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection); public: |