summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/CMakeLists.txt2
-rw-r--r--src/modules/UserListManager/CMakeLists.txt16
-rw-r--r--src/modules/UserListManager/Module.cpp39
-rw-r--r--src/modules/UserListManager/Module.h44
-rw-r--r--src/modules/UserListManager/RequestHandlers/UserListDiffUploadRequestHandler.cpp82
-rw-r--r--src/modules/UserListManager/RequestHandlers/UserListDiffUploadRequestHandler.h51
-rw-r--r--src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp161
-rw-r--r--src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h66
-rw-r--r--src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.cpp83
-rw-r--r--src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.h51
-rw-r--r--src/modules/UserListManager/UserList.h40
-rw-r--r--src/modules/UserListManager/UserListDiff.cpp46
-rw-r--r--src/modules/UserListManager/UserListDiff.h88
-rw-r--r--src/modules/UserListManager/UserListEntry.h93
-rw-r--r--src/modules/UserListManager/UserListManager.cpp153
-rw-r--r--src/modules/UserListManager/UserListManager.h95
-rw-r--r--src/modules/UserListManager/Util.cpp113
-rw-r--r--src/modules/UserListManager/Util.h55
18 files changed, 0 insertions, 1278 deletions
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
index 6681ad7..2f497de 100644
--- a/src/modules/CMakeLists.txt
+++ b/src/modules/CMakeLists.txt
@@ -53,8 +53,6 @@ if(MYSQL_FOUND)
add_subdirectory(UserDBBackendMysql)
endif(MYSQL_FOUND)
-add_subdirectory(UserListManager)
-
SET(STATIC_MODULE_LOADERS "")
SET(STATIC_MODULE_LIST "")
diff --git a/src/modules/UserListManager/CMakeLists.txt b/src/modules/UserListManager/CMakeLists.txt
deleted file mode 100644
index f8e72ce..0000000
--- a/src/modules/UserListManager/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-include_directories(${INCLUDES})
-
-mad_module(UserListManager
- RequestHandlers/UserListDiffUploadRequestHandler.cpp RequestHandlers/UserListDiffUploadRequestHandler.h
- RequestHandlers/UserListRequestHandlerGroup.cpp RequestHandlers/UserListRequestHandlerGroup.h
- RequestHandlers/UserListUploadRequestHandler.cpp RequestHandlers/UserListUploadRequestHandler.h
-
- Module.cpp Module.h
- UserList.h
- UserListDiff.cpp UserListDiff.h
- UserListEntry.h
- UserListManager.cpp UserListManager.h
- Util.cpp Util.h
-)
-
-mad_module_libraries(UserListManager)
diff --git a/src/modules/UserListManager/Module.cpp b/src/modules/UserListManager/Module.cpp
deleted file mode 100644
index 2145a32..0000000
--- a/src/modules/UserListManager/Module.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Module.cpp
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "../export.h"
-
-#include "Module.h"
-
-#include <Server/Application.h>
-
-extern "C" {
-
-MAD_MODULE_EXPORT Mad::Common::Module* UserListManager_create(Mad::Common::Application *application) {
- Mad::Server::Application *serverApp = dynamic_cast<Mad::Server::Application*>(application);
-
- if(!serverApp) {
- application->log(Mad::Core::Logger::LOG_ERROR, "UserListManager: This module can be used with mad-server only.");
- return 0;
- }
-
- return new Mad::Modules::UserListManager::Module(serverApp);
-}
-
-}
diff --git a/src/modules/UserListManager/Module.h b/src/modules/UserListManager/Module.h
deleted file mode 100644
index 035cdaa..0000000
--- a/src/modules/UserListManager/Module.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Module.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_MODULE_H_
-#define MAD_MODULES_USERLISTMANAGER_MODULE_H_
-
-#include "UserListManager.h"
-#include <Common/Module.h>
-
-#include <boost/scoped_ptr.hpp>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-class Module : public Common::Module {
- private:
- boost::scoped_ptr<UserListManager> userListManager;
-
- public:
- Module(Server::Application *application) : userListManager(new UserListManager(application)) {}
-};
-
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_MODULE_H_ */
diff --git a/src/modules/UserListManager/RequestHandlers/UserListDiffUploadRequestHandler.cpp b/src/modules/UserListManager/RequestHandlers/UserListDiffUploadRequestHandler.cpp
deleted file mode 100644
index 4660850..0000000
--- a/src/modules/UserListManager/RequestHandlers/UserListDiffUploadRequestHandler.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * UserListDiffUploadRequestHandler.cpp
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "UserListDiffUploadRequestHandler.h"
-#include "../UserListManager.h"
-#include "../Util.h"
-
-#include <boost/date_time/posix_time/posix_time.hpp>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-namespace RequestHandlers {
-
-void UserListDiffUploadRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlData> packet) {
- if(packet->getType() == "Cancel") {
- Common::XmlData ret;
- ret.setType("OK");
- sendPacket(ret);
-
- signalFinished();
- return;
- }
- else if(packet->getType() != "UploadUserListDiff") {
- getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet.");
-
- Common::XmlData ret;
- ret.setType("Error");
- ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
-
- sendPacket(ret);
-
- signalFinished();
- return;
- }
-
- if(!getConnection()->isAuthenticated())
- throw(Core::Exception(Core::Exception::PERMISSION));
-
- if(name.empty()) { // Request
- name = packet->get<const std::string&>("name");
-
- if(name.empty())
- name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time());
-
- Common::XmlData ret;
- ret.setType("Continue");
- ret.set("exists", userListManager->existsUserListDiff(name));
- sendPacket(ret);
- }
- else { // Upload
- boost::shared_ptr<UserListDiff> diff = Util::deserializeUserListDiff(packet.get());
- userListManager->storeUserListDiff(name, diff.get());
-
- Common::XmlData ret;
- ret.setType("OK");
- sendPacket(ret);
-
- signalFinished();
- }
-}
-
-}
-}
-}
-}
diff --git a/src/modules/UserListManager/RequestHandlers/UserListDiffUploadRequestHandler.h b/src/modules/UserListManager/RequestHandlers/UserListDiffUploadRequestHandler.h
deleted file mode 100644
index 205a87f..0000000
--- a/src/modules/UserListManager/RequestHandlers/UserListDiffUploadRequestHandler.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * UserListDiffUploadRequestHandler.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTDIFFUPLOADREQUESTHANDLER_H_
-#define MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTDIFFUPLOADREQUESTHANDLER_H_
-
-#include <Common/RequestHandler.h>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-class UserListManager;
-
-namespace RequestHandlers {
-
-class UserListDiffUploadRequestHandler : public Common::RequestHandler {
- private:
- std::string name;
-
- UserListManager *userListManager;
-
- protected:
- virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet);
-
- public:
- UserListDiffUploadRequestHandler(Common::Application *application, UserListManager *userListManager0) : Common::RequestHandler(application), userListManager(userListManager0) {}
-};
-
-}
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTDIFFUPLOADREQUESTHANDLER_H_ */
diff --git a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp
deleted file mode 100644
index 61bbf07..0000000
--- a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * UserListRequestHandlerGroup.cpp
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "UserListRequestHandlerGroup.h"
-#include "../UserListManager.h"
-#include "../Util.h"
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-namespace RequestHandlers {
-
-void UserListRequestHandlerGroup::handleUserListListRequest(boost::shared_ptr<const Common::XmlData> /*packet*/, Common::XmlData *ret, Common::Connection *connection) {
- if(!connection->isAuthenticated())
- throw(Core::Exception(Core::Exception::PERMISSION));
-
- const std::set<std::string> &userLists = userListManager->getUserLists();
-
- ret->setType("OK");
- Common::XmlData::List *list = ret->createList("userLists");
-
- for(std::set<std::string>::const_iterator userList = userLists.begin(); userList != userLists.end(); ++userList) {
- Common::XmlData::List::iterator entry = list->addEntry();
-
- entry->set("name", *userList);
- }
-
-}
-
-void UserListRequestHandlerGroup::handleUserListDownloadRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
- if(!connection->isAuthenticated())
- throw(Core::Exception(Core::Exception::PERMISSION));
-
- boost::shared_ptr<UserList> userList = userListManager->loadUserList(packet->get<const std::string&>("name"));
- if(!userList)
- throw(Core::Exception(Core::Exception::NOT_FOUND));
-
- ret->setType("OK");
- 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));
-
- userListManager->removeUserList(packet->get<const std::string&>("name"));
-
- ret->setType("OK");
-}
-
-
-void UserListRequestHandlerGroup::handleUserListDiffListRequest(boost::shared_ptr<const Common::XmlData> /*packet*/, Common::XmlData *ret, Common::Connection *connection) {
- if(!connection->isAuthenticated())
- throw(Core::Exception(Core::Exception::PERMISSION));
-
- const std::set<std::string> &userListDiffs = userListManager->getUserListDiffs();
-
- ret->setType("OK");
- Common::XmlData::List *list = ret->createList("userListDiffs");
-
- for(std::set<std::string>::const_iterator diff = userListDiffs.begin(); diff != userListDiffs.end(); ++diff) {
- Common::XmlData::List::iterator entry = list->addEntry();
-
- entry->set("name", *diff);
- }
-
-}
-
-void UserListRequestHandlerGroup::handleUserListDiffDownloadRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
- if(!connection->isAuthenticated())
- throw(Core::Exception(Core::Exception::PERMISSION));
-
- boost::shared_ptr<UserListDiff> diff = userListManager->loadUserListDiff(packet->get<const std::string&>("name"));
- if(!diff)
- throw(Core::Exception(Core::Exception::NOT_FOUND));
-
- ret->setType("OK");
- 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));
-
- userListManager->removeUserListDiff(packet->get<const std::string&>("name"));
-
- ret->setType("OK");
-}
-
-
-UserListRequestHandlerGroup::UserListRequestHandlerGroup(Server::Application *application0, UserListManager *userListManager0)
-: 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
deleted file mode 100644
index 61f4c7d..0000000
--- a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * UserListRequestHandlerGroup.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTREQUESTHANDLERGROUP_H_
-#define MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTREQUESTHANDLERGROUP_H_
-
-#include "../../export.h"
-
-#include <Common/RequestHandlers/SimpleRequestHandlerGroup.h>
-
-namespace Mad {
-
-namespace Server {
-class Application;
-}
-
-namespace Modules {
-namespace UserListManager {
-
-class UserListManager;
-
-namespace RequestHandlers {
-
-class MAD_MODULE_EXPORT UserListRequestHandlerGroup : public Common::RequestHandlers::SimpleRequestHandlerGroup {
- private:
- Server::Application *application;
- UserListManager *userListManager;
-
- 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:
- UserListRequestHandlerGroup(Server::Application *application0, UserListManager *userListManager0);
-};
-
-}
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTREQUESTHANDLERGROUP_H_ */
diff --git a/src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.cpp b/src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.cpp
deleted file mode 100644
index 9d01b5e..0000000
--- a/src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * UserListUploadRequestHandler.cpp
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "UserListUploadRequestHandler.h"
-#include "../UserListManager.h"
-#include "../Util.h"
-
-#include <boost/date_time/posix_time/posix_time.hpp>
-
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-namespace RequestHandlers {
-
-void UserListUploadRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlData> packet) {
- if(packet->getType() == "Cancel") {
- Common::XmlData ret;
- ret.setType("OK");
- sendPacket(ret);
-
- signalFinished();
- return;
- }
- else if(packet->getType() != "UploadUserList") {
- getApplication()->log(Core::Logger::LOG_ERROR, "Received an unexpected packet.");
-
- Common::XmlData ret;
- ret.setType("Error");
- ret.set("ErrorCode", Core::Exception::UNEXPECTED_PACKET);
-
- sendPacket(ret);
-
- signalFinished();
- return;
- }
-
- if(!getConnection()->isAuthenticated())
- throw(Core::Exception(Core::Exception::PERMISSION));
-
- if(name.empty()) { // Request
- name = packet->get<const std::string&>("name");
-
- if(name.empty())
- name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time());
-
- Common::XmlData ret;
- ret.setType("Continue");
- ret.set("exists", userListManager->existsUserList(name));
- sendPacket(ret);
- }
- else { // Upload
- boost::shared_ptr<UserList> userList = Util::deserializeUserList(packet.get());
- userListManager->storeUserList(name, userList.get());
-
- Common::XmlData ret;
- ret.setType("OK");
- sendPacket(ret);
-
- signalFinished();
- }
-}
-
-}
-}
-}
-}
diff --git a/src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.h b/src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.h
deleted file mode 100644
index 933d4a5..0000000
--- a/src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * UserListUploadRequestHandler.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTUPLOADREQUESTHANDLER_H_
-#define MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTUPLOADREQUESTHANDLER_H_
-
-#include <Common/RequestHandler.h>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-class UserListManager;
-
-namespace RequestHandlers {
-
-class UserListUploadRequestHandler : public Common::RequestHandler {
- private:
- std::string name;
-
- UserListManager *userListManager;
-
- protected:
- virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet);
-
- public:
- UserListUploadRequestHandler(Common::Application *application, UserListManager *userListManager0) : Common::RequestHandler(application), userListManager(userListManager0) {}
-};
-
-}
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_REQUESTHANDLERS_USERLISTUPLOADREQUESTHANDLER_H_ */
diff --git a/src/modules/UserListManager/UserList.h b/src/modules/UserListManager/UserList.h
deleted file mode 100644
index 6ca3de4..0000000
--- a/src/modules/UserListManager/UserList.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * UserList.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_USERLIST_H_
-#define MAD_MODULES_USERLISTMANAGER_USERLIST_H_
-
-#include "UserListEntry.h"
-
-#include <list>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-class UserList : public std::list<UserListEntry> {
- public:
- UserList() {}
-};
-
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_USERLIST_H_ */
diff --git a/src/modules/UserListManager/UserListDiff.cpp b/src/modules/UserListManager/UserListDiff.cpp
deleted file mode 100644
index a7b5f2f..0000000
--- a/src/modules/UserListManager/UserListDiff.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * UserListDiff.cpp
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "UserListDiff.h"
-#include "UserList.h"
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-UserListDiff::UserListDiff(const UserList *oldList, const UserList *newList) {
- for(UserList::const_iterator user = oldList->begin(); user != oldList->end(); ++user)
- deletedUsers.insert(*user);
-
- for(UserList::const_iterator user = newList->begin(); user != newList->end(); ++user) {
- std::set<UserListEntry>::const_iterator it = deletedUsers.find(*user);
-
- if(it != deletedUsers.end()) {
- deletedUsers.erase(it);
- unchangedUsers.insert(*user);
- }
- else {
- addedUsers.insert(*user);
- }
- }
-}
-
-}
-}
-}
diff --git a/src/modules/UserListManager/UserListDiff.h b/src/modules/UserListManager/UserListDiff.h
deleted file mode 100644
index de881bd..0000000
--- a/src/modules/UserListManager/UserListDiff.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * UserListDiff.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_USERLISTDIFF_H_
-#define MAD_MODULES_USERLISTMANAGER_USERLISTDIFF_H_
-
-#include "../export.h"
-
-#include "UserListEntry.h"
-#include <Core/Exception.h>
-
-#include <set>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-class UserList;
-
-class MAD_MODULE_EXPORT UserListDiff {
- private:
- std::set<UserListEntry> addedUsers;
- std::set<UserListEntry> deletedUsers;
- std::set<UserListEntry> unchangedUsers;
-
- public:
- UserListDiff() {}
- UserListDiff(const UserList *oldList, const UserList *newList);
-
- void invert() {
- addedUsers.swap(deletedUsers);
- }
-
- const std::set<UserListEntry>& getAddedUsers() const {
- return addedUsers;
- }
-
- const std::set<UserListEntry>& getDeletedUsers() const {
- return deletedUsers;
- }
-
- const std::set<UserListEntry>& getUnchangedUsers() const {
- return unchangedUsers;
- }
-
- bool insertAddedUser(UserListEntry user) {
- if(deletedUsers.count(user) || unchangedUsers.count(user))
- return false;
-
- return addedUsers.insert(user).second;
- }
-
- bool insertDeletedUser(UserListEntry user) {
- if(addedUsers.count(user) || unchangedUsers.count(user))
- return false;
-
- return deletedUsers.insert(user).second;
- }
-
- bool insertUnchangedUser(UserListEntry user) {
- if(addedUsers.count(user) || deletedUsers.count(user))
- return false;
-
- return unchangedUsers.insert(user).second;
- }
-};
-
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_USERLISTDIFF_H_ */
diff --git a/src/modules/UserListManager/UserListEntry.h b/src/modules/UserListManager/UserListEntry.h
deleted file mode 100644
index 59776d6..0000000
--- a/src/modules/UserListManager/UserListEntry.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * UserListEntry.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_USERLISTENTRY_H_
-#define MAD_MODULES_USERLISTMANAGER_USERLISTENTRY_H_
-
-#include <map>
-#include <set>
-#include <string>
-
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-class UserListEntry {
- private:
- std::string name;
- std::string group;
-
- std::map<std::string, std::string> details;
-
- public:
- UserListEntry(const std::string &name0 = std::string(), const std::string &group0 = std::string()) : name(name0), group(group0) {}
-
- const std::string& getName() const {
- return name;
- }
-
- void setName(const std::string &newName) {
- name = newName;
- }
-
- const std::string& getGroup() const {
- return group;
- }
-
- void setGroup(const std::string &newGroup) {
- group = newGroup;
- }
-
- std::set<std::string> getDetailList() const {
- std::set<std::string> ret;
-
- for(std::map<std::string, std::string>::const_iterator it = details.begin(); it != details.end(); ++it)
- ret.insert(it->first);
-
- return ret;
- }
-
- std::string getDetail(const std::string &name) const {
- std::map<std::string, std::string>::const_iterator it = details.find(name);
- if(it != details.end())
- return it->second;
- else
- return std::string();
- }
-
- void setDetail(const std::string &name, const std::string &value) {
- details.erase(name);
- details.insert(std::make_pair(name, value));
- }
-
- void unsetDetail(const std::string &name) {
- details.erase(name);
- }
-
- bool operator<(const UserListEntry o) const {
- return (name < o.name);
- }
-};
-
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_USERLISTENTRY_H_ */
diff --git a/src/modules/UserListManager/UserListManager.cpp b/src/modules/UserListManager/UserListManager.cpp
deleted file mode 100644
index deb6214..0000000
--- a/src/modules/UserListManager/UserListManager.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * UserListManager.cpp
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "UserListManager.h"
-#include "UserList.h"
-#include "Util.h"
-#include "RequestHandlers/UserListRequestHandlerGroup.h"
-#include "RequestHandlers/UserListUploadRequestHandler.h"
-#include "RequestHandlers/UserListDiffUploadRequestHandler.h"
-
-#include <Server/Application.h>
-#include <Common/RequestManager.h>
-#include <Common/StorageManager.h>
-#include <Common/UserManager.h>
-#include <Core/ConfigManager.h>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-UserListManager::UserListManager(Server::Application *application0) : application(application0), requestHandlerGroup(new RequestHandlers::UserListRequestHandlerGroup(application, this)) {
- application->getConfigManager()->registerConfigurable(this);
-}
-
-UserListManager::~UserListManager() {
- application->getRequestManager()->unregisterPacketType("UploadUserList");
- application->getRequestManager()->unregisterPacketType("UploadUserListDiff");
- application->getRequestManager()->unregisterRequestHandlerGroup(requestHandlerGroup);
- application->getConfigManager()->unregisterConfigurable(this);
-}
-
-
-void UserListManager::configFinished() {
- userLists = application->getStorageManager()->list("UserList");
- userListDiffs = application->getStorageManager()->list("UserListDiff");
-
- application->getRequestManager()->registerRequestHandlerGroup(requestHandlerGroup);
- application->getRequestManager()->registerPacketType<RequestHandlers::UserListUploadRequestHandler>("UploadUserList", this);
- application->getRequestManager()->registerPacketType<RequestHandlers::UserListDiffUploadRequestHandler>("UploadUserListDiff", this);
-}
-
-bool UserListManager::existsUserList(const std::string &name) {
- return application->getStorageManager()->exists("UserList", name);
-}
-
-boost::shared_ptr<UserList> UserListManager::loadUserList(const std::string &name) {
- boost::shared_ptr<Common::XmlData> data = application->getStorageManager()->load("UserList", name);
-
- if(!data)
- return boost::shared_ptr<UserList>();
-
- return Util::deserializeUserList(data.get());
-}
-
-void UserListManager::storeUserList(const std::string &name, const UserList *list) {
- Common::XmlData data;
-
- Util::serializeUserList(list, &data);
- application->getStorageManager()->store("UserList", name, &data);
-}
-
-void UserListManager::copyUserList(const std::string &fromName, const std::string &toName) {
- application->getStorageManager()->copy("UserList", fromName, toName);
-}
-
-void UserListManager::renameUserList(const std::string &fromName, const std::string &toName) {
- application->getStorageManager()->rename("UserList", fromName, toName);
-}
-
-void UserListManager::removeUserList(const std::string &name) {
- application->getStorageManager()->remove("UserList", name);
-}
-
-
-bool UserListManager::existsUserListDiff(const std::string &name) {
- return application->getStorageManager()->exists("UserListDiff", name);
-}
-
-boost::shared_ptr<UserListDiff> UserListManager::loadUserListDiff(const std::string &name) {
- boost::shared_ptr<Common::XmlData> data = application->getStorageManager()->load("UserListDiff", name);
-
- if(!data)
- return boost::shared_ptr<UserListDiff>();
-
- return Util::deserializeUserListDiff(data.get());
-}
-
-void UserListManager::storeUserListDiff(const std::string &name, const UserListDiff *list) {
- Common::XmlData data;
-
- Util::serializeUserListDiff(list, &data);
- application->getStorageManager()->store("UserListDiff", name, &data);
-}
-
-void UserListManager::copyUserListDiff(const std::string &fromName, const std::string &toName) {
- application->getStorageManager()->copy("UserListDiff", fromName, toName);
-}
-
-void UserListManager::renameUserListDiff(const std::string &fromName, const std::string &toName) {
- application->getStorageManager()->rename("UserListDiff", fromName, toName);
-}
-
-void UserListManager::removeUserListDiff(const std::string &name) {
- application->getStorageManager()->remove("UserListDiff", name);
-}
-
-boost::shared_ptr<UserList> UserListManager::getCurrentUserList() {
- boost::shared_ptr<UserList> list(new UserList);
-
- boost::shared_ptr<const std::map<unsigned long, Common::UserInfo> > userList = application->getUserManager()->getUserList();
- boost::shared_ptr<const std::map<unsigned long, Common::GroupInfo> > groupList = application->getUserManager()->getGroupList();
-
- for(std::map<unsigned long, Common::UserInfo>::const_iterator user = userList->begin(); user != userList->end(); ++user) {
- std::map<unsigned long, Common::GroupInfo>::const_iterator group = groupList->find(user->second.getGid());
- std::string groupname;
-
- if(group != groupList->end()) {
- groupname = group->second.getName();
- }
- else {
- std::ostringstream stream;
- stream << user->second.getGid();
- groupname = stream.str();
- }
-
- UserListEntry entry(user->second.getUsername(), groupname);
- entry.setDetail("Full name", user->second.getFullName());
-
- list->push_back(entry);
- }
-
- return list;
-}
-
-}
-}
-}
diff --git a/src/modules/UserListManager/UserListManager.h b/src/modules/UserListManager/UserListManager.h
deleted file mode 100644
index 6763dae..0000000
--- a/src/modules/UserListManager/UserListManager.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * UserListManager.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_USERLISTMANAGER_H_
-#define MAD_MODULES_USERLISTMANAGER_USERLISTMANAGER_H_
-
-#include "../export.h"
-
-#include <Core/Configurable.h>
-
-#include <boost/noncopyable.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <set>
-
-namespace Mad {
-
-namespace Server {
-class Application;
-}
-
-namespace Modules {
-namespace UserListManager {
-
-namespace RequestHandlers {
-class UserListRequestHandlerGroup;
-}
-
-class UserList;
-class UserListDiff;
-
-class MAD_MODULE_EXPORT UserListManager : private Core::Configurable, private boost::noncopyable {
- private:
- Server::Application *application;
-
- boost::shared_ptr<RequestHandlers::UserListRequestHandlerGroup> requestHandlerGroup;
-
- std::set<std::string> userLists;
- std::set<std::string> userListDiffs;
-
- protected:
- virtual void configFinished();
-
- public:
- virtual int getPriority() const {return -1;}
-
- UserListManager(Server::Application *application0);
- virtual ~UserListManager();
-
- const std::set<std::string>& getUserLists() const {
- return userLists;
- }
-
- bool existsUserList(const std::string &name);
- boost::shared_ptr<UserList> loadUserList(const std::string &name);
- void storeUserList(const std::string &name, const UserList *list);
- void copyUserList(const std::string &fromName, const std::string &toName);
- void renameUserList(const std::string &fromName, const std::string &toName);
- void removeUserList(const std::string &name);
-
- const std::set<std::string>& getUserListDiffs() const {
- return userListDiffs;
- }
-
- bool existsUserListDiff(const std::string &name);
- boost::shared_ptr<UserListDiff> loadUserListDiff(const std::string &name);
- void storeUserListDiff(const std::string &name, const UserListDiff *list);
- void copyUserListDiff(const std::string &fromName, const std::string &toName);
- void renameUserListDiff(const std::string &fromName, const std::string &toName);
- void removeUserListDiff(const std::string &name);
-
- boost::shared_ptr<UserList> getCurrentUserList();
-};
-
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_USERLISTMANAGER_H_ */
diff --git a/src/modules/UserListManager/Util.cpp b/src/modules/UserListManager/Util.cpp
deleted file mode 100644
index 9b986d8..0000000
--- a/src/modules/UserListManager/Util.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Util.cpp
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Util.h"
-#include "UserList.h"
-#include "UserListDiff.h"
-
-#include <Common/XmlData.h>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-void Util::serializeUserListEntry(const UserListEntry *user, Common::XmlData::List::iterator entry) {
- std::set<std::string> details = user->getDetailList();
- for(std::set<std::string>::iterator detail = details.begin(); detail != details.end(); ++detail)
- entry->set(*detail, user->getDetail(*detail));
-
- entry->set("name", user->getName());
- entry->set("group", user->getGroup());
-}
-
-UserListEntry Util::deserializeUserListEntry(Common::XmlData::List::const_iterator entry) {
- UserListEntry user(entry->get<const std::string&>("name"), entry->get<const std::string&>("group"));
-
- std::set<std::string> details = entry->getChildren();
- for(std::set<std::string>::iterator detail = details.begin(); detail != details.end(); ++detail) {
- if(*detail == "user" || *detail == "group")
- continue;
-
- user.setDetail(*detail, entry->get<const std::string&>(*detail));
- }
-
- return user;
-}
-
-void Util::serializeUserList(const UserList *list, Common::XmlData *data) {
- Common::XmlData::List *userList = data->createList("users");
-
- for(UserList::const_iterator user = list->begin(); user != list->end(); ++user)
- serializeUserListEntry(&*user, userList->addEntry());
-}
-
-boost::shared_ptr<UserList> Util::deserializeUserList(const Common::XmlData *data) {
- boost::shared_ptr<UserList> users(new UserList);
-
- const Common::XmlData::List *userList = data->getList("users");
-
- if(userList) {
- for(Common::XmlData::List::const_iterator user = userList->begin(); user != userList->end(); ++user)
- users->push_back(deserializeUserListEntry(user));
- }
-
- return users;
-}
-
-void Util::serializeUserListDiff(const UserListDiff *diff, Common::XmlData *data) {
- Common::XmlData::List *userList = data->createList("addedUsers");
- for(std::set<UserListEntry>::const_iterator user = diff->getAddedUsers().begin(); user != diff->getAddedUsers().end(); ++user)
- serializeUserListEntry(&*user, userList->addEntry());
-
- userList = data->createList("deletedUsers");
- for(std::set<UserListEntry>::const_iterator user = diff->getDeletedUsers().begin(); user != diff->getDeletedUsers().end(); ++user)
- serializeUserListEntry(&*user, userList->addEntry());
-
- userList = data->createList("unchangedUsers");
- for(std::set<UserListEntry>::const_iterator user = diff->getUnchangedUsers().begin(); user != diff->getUnchangedUsers().end(); ++user)
- serializeUserListEntry(&*user, userList->addEntry());
-}
-
-boost::shared_ptr<UserListDiff> Util::deserializeUserListDiff(const Common::XmlData *data) {
- boost::shared_ptr<UserListDiff> diff(new UserListDiff);
-
- const Common::XmlData::List *userList = data->getList("addedUsers");
- if(userList) {
- for(Common::XmlData::List::const_iterator user = userList->begin(); user != userList->end(); ++user)
- diff->insertAddedUser(deserializeUserListEntry(user));
- }
-
- userList = data->getList("deletedUsers");
- if(userList) {
- for(Common::XmlData::List::const_iterator user = userList->begin(); user != userList->end(); ++user)
- diff->insertDeletedUser(deserializeUserListEntry(user));
- }
-
- userList = data->getList("unchangedUsers");
- if(userList) {
- for(Common::XmlData::List::const_iterator user = userList->begin(); user != userList->end(); ++user)
- diff->insertUnchangedUser(deserializeUserListEntry(user));
- }
-
- return diff;
-}
-
-}
-}
-}
diff --git a/src/modules/UserListManager/Util.h b/src/modules/UserListManager/Util.h
deleted file mode 100644
index c9b9a2c..0000000
--- a/src/modules/UserListManager/Util.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Util.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_MODULES_USERLISTMANAGER_UTIL_H_
-#define MAD_MODULES_USERLISTMANAGER_UTIL_H_
-
-#include "../export.h"
-
-#include <Common/XmlData.h>
-#include <boost/shared_ptr.hpp>
-
-namespace Mad {
-namespace Modules {
-namespace UserListManager {
-
-class UserList;
-class UserListDiff;
-class UserListEntry;
-
-class MAD_MODULE_EXPORT Util {
- private:
- static void serializeUserListEntry(const UserListEntry *user, Common::XmlData::List::iterator entry);
- static UserListEntry deserializeUserListEntry(Common::XmlData::List::const_iterator entry);
-
- Util();
-
- public:
- static void serializeUserList(const UserList *list, Common::XmlData *data);
- static boost::shared_ptr<UserList> deserializeUserList(const Common::XmlData *data);
-
- static void serializeUserListDiff(const UserListDiff *diff, Common::XmlData *data);
- static boost::shared_ptr<UserListDiff> deserializeUserListDiff(const Common::XmlData *data);
-};
-
-}
-}
-}
-
-#endif /* MAD_MODULES_USERLISTMANAGER_UTIL_H_ */