diff options
Diffstat (limited to 'src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.cpp')
-rw-r--r-- | src/modules/UserListManager/RequestHandlers/UserListUploadRequestHandler.cpp | 83 |
1 files changed, 0 insertions, 83 deletions
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(); - } -} - -} -} -} -} |