diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-29 18:12:59 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-29 18:12:59 +0200 |
commit | 1b3a914d5fdf5a578e24754845c6350c59c0b523 (patch) | |
tree | f34f2da9db375a9c135b7b338567c5390f815fec /src/Server | |
parent | 9b3152cb3645913d8f2e419575d9d8b5d0ad0d68 (diff) | |
download | mad-1b3a914d5fdf5a578e24754845c6350c59c0b523.tar mad-1b3a914d5fdf5a578e24754845c6350c59c0b523.zip |
Fixed some UserListManager-related bugs
Diffstat (limited to 'src/Server')
-rw-r--r-- | src/Server/UserListManager.cpp | 18 | ||||
-rw-r--r-- | src/Server/UserListManager.h | 21 |
2 files changed, 12 insertions, 27 deletions
diff --git a/src/Server/UserListManager.cpp b/src/Server/UserListManager.cpp index 04ba7d2..8e524a0 100644 --- a/src/Server/UserListManager.cpp +++ b/src/Server/UserListManager.cpp @@ -34,24 +34,20 @@ namespace Mad { namespace Server { UserListManager::UserListManager(Application *application0) : application(application0), requestHandlerGroup(new RequestHandlers::UserListRequestHandlerGroup(application)) { - application->getConfigManager()->registerConfigurable(this); + application->getRequestManager()->registerRequestHandlerGroup(requestHandlerGroup); + application->getRequestManager()->registerPacketType<RequestHandlers::UserListUploadRequestHandler>("UploadUserList"); + application->getRequestManager()->registerPacketType<RequestHandlers::UserListDiffUploadRequestHandler>("UploadUserListDiff"); } UserListManager::~UserListManager() { application->getRequestManager()->unregisterPacketType("UploadUserList"); application->getRequestManager()->unregisterPacketType("UploadUserListDiff"); application->getRequestManager()->unregisterRequestHandlerGroup(requestHandlerGroup); - application->getConfigManager()->unregisterConfigurable(this); } -void UserListManager::configure() { - userLists = application->getStorageManager()->list("UserList"); - userListDiffs = application->getStorageManager()->list("UserListDiff"); - - application->getRequestManager()->registerRequestHandlerGroup(requestHandlerGroup); - application->getRequestManager()->registerPacketType<RequestHandlers::UserListUploadRequestHandler>("UploadUserList"); - application->getRequestManager()->registerPacketType<RequestHandlers::UserListDiffUploadRequestHandler>("UploadUserListDiff"); +std::set<Core::String> UserListManager::getUserLists() { + return application->getStorageManager()->list("UserList"); } bool UserListManager::existsUserList(const Core::String &name) { @@ -87,6 +83,10 @@ void UserListManager::removeUserList(const Core::String &name) { } +std::set<Core::String> UserListManager::getUserListDiffs() { + return application->getStorageManager()->list("UserListDiff"); +} + bool UserListManager::existsUserListDiff(const Core::String &name) { return application->getStorageManager()->exists("UserListDiff", name); } diff --git a/src/Server/UserListManager.h b/src/Server/UserListManager.h index bb5b4e3..0c2ef69 100644 --- a/src/Server/UserListManager.h +++ b/src/Server/UserListManager.h @@ -22,7 +22,6 @@ #include "export.h" -#include <Core/Configurable.h> #include <Core/String.h> #include <boost/noncopyable.hpp> @@ -47,28 +46,17 @@ namespace RequestHandlers { class UserListRequestHandlerGroup; } -class MAD_SERVER_EXPORT UserListManager : private Core::Configurable, private boost::noncopyable { +class MAD_SERVER_EXPORT UserListManager : private boost::noncopyable { private: Application *application; boost::shared_ptr<RequestHandlers::UserListRequestHandlerGroup> requestHandlerGroup; - std::set<Core::String> userLists; - std::set<Core::String> userListDiffs; - - protected: - virtual void configure(); - public: - virtual int getPriority() const {return -1;} - UserListManager(Application *application0); virtual ~UserListManager(); - const std::set<Core::String>& getUserLists() const { - return userLists; - } - + std::set<Core::String> getUserLists(); bool existsUserList(const Core::String &name); boost::shared_ptr<Common::UserLists::UserList> loadUserList(const Core::String &name); void storeUserList(const Core::String &name, const Common::UserLists::UserList *list); @@ -76,10 +64,7 @@ class MAD_SERVER_EXPORT UserListManager : private Core::Configurable, private bo void renameUserList(const Core::String &fromName, const Core::String &toName); void removeUserList(const Core::String &name); - const std::set<Core::String>& getUserListDiffs() const { - return userListDiffs; - } - + std::set<Core::String> getUserListDiffs(); bool existsUserListDiff(const Core::String &name); boost::shared_ptr<Common::UserLists::UserListDiff> loadUserListDiff(const Core::String &name); void storeUserListDiff(const Core::String &name, const Common::UserLists::UserListDiff *list); |