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 | |
parent | 9b3152cb3645913d8f2e419575d9d8b5d0ad0d68 (diff) | |
download | mad-1b3a914d5fdf5a578e24754845c6350c59c0b523.tar mad-1b3a914d5fdf5a578e24754845c6350c59c0b523.zip |
Fixed some UserListManager-related bugs
Diffstat (limited to 'src')
-rw-r--r-- | src/Client/Requests/UserLists/UserListUploadRequest.cpp | 5 | ||||
-rw-r--r-- | src/Common/ClientConnection.cpp | 1 | ||||
-rw-r--r-- | src/Server/UserListManager.cpp | 18 | ||||
-rw-r--r-- | src/Server/UserListManager.h | 21 |
4 files changed, 17 insertions, 28 deletions
diff --git a/src/Client/Requests/UserLists/UserListUploadRequest.cpp b/src/Client/Requests/UserLists/UserListUploadRequest.cpp index 28251d8..8ac9ab6 100644 --- a/src/Client/Requests/UserLists/UserListUploadRequest.cpp +++ b/src/Client/Requests/UserLists/UserListUploadRequest.cpp @@ -46,6 +46,8 @@ void UserListUploadRequest::handlePacket(boost::shared_ptr<const Common::XmlData else { signalFinished(packet); } + + return; } else if(packet->getType() != "Continue") { signalFinished(Core::Exception(Core::Exception::UNEXPECTED_PACKET)); @@ -53,10 +55,11 @@ void UserListUploadRequest::handlePacket(boost::shared_ptr<const Common::XmlData } if(!overwrite && packet->get<bool>("exists")) { + canceled = true; + Common::XmlData ret; ret.setType("Cancel"); sendPacket(ret); - canceled = true; return; } diff --git a/src/Common/ClientConnection.cpp b/src/Common/ClientConnection.cpp index db6efb2..91327e2 100644 --- a/src/Common/ClientConnection.cpp +++ b/src/Common/ClientConnection.cpp @@ -26,6 +26,7 @@ namespace Common { ClientConnection::ClientConnection(Core::Application *application) : Connection(application), connection(Net::ClientConnection::create(application)) { connection->connectSignalReceive(boost::bind(&ClientConnection::receive, this, _1)); + connection->setReceiveLimit(0xFFFFFFFF); // TODO Authentication? } ClientConnection::~ClientConnection() { 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); |