summaryrefslogtreecommitdiffstats
path: root/src/Server/RequestHandlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/RequestHandlers')
-rw-r--r--src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp32
-rw-r--r--src/Server/RequestHandlers/DaemonCommandRequestHandler.h8
-rw-r--r--src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp30
-rw-r--r--src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h8
-rw-r--r--src/Server/RequestHandlers/DaemonListRequestHandler.cpp4
-rw-r--r--src/Server/RequestHandlers/DaemonListRequestHandler.h6
-rw-r--r--src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp32
-rw-r--r--src/Server/RequestHandlers/DaemonStatusRequestHandler.h8
-rw-r--r--src/Server/RequestHandlers/GroupListRequestHandler.cpp4
-rw-r--r--src/Server/RequestHandlers/GroupListRequestHandler.h6
-rw-r--r--src/Server/RequestHandlers/GroupUserListRequestHandler.cpp6
-rw-r--r--src/Server/RequestHandlers/GroupUserListRequestHandler.h6
-rw-r--r--src/Server/RequestHandlers/IdentifyRequestHandler.cpp8
-rw-r--r--src/Server/RequestHandlers/IdentifyRequestHandler.h6
-rw-r--r--src/Server/RequestHandlers/LogRequestHandler.cpp6
-rw-r--r--src/Server/RequestHandlers/LogRequestHandler.h6
-rw-r--r--src/Server/RequestHandlers/UserGroupListRequestHandler.cpp6
-rw-r--r--src/Server/RequestHandlers/UserGroupListRequestHandler.h6
-rw-r--r--src/Server/RequestHandlers/UserInfoRequestHandler.cpp6
-rw-r--r--src/Server/RequestHandlers/UserInfoRequestHandler.h6
-rw-r--r--src/Server/RequestHandlers/UserListRequestHandler.cpp4
-rw-r--r--src/Server/RequestHandlers/UserListRequestHandler.h6
22 files changed, 85 insertions, 125 deletions
diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp
index 0a7bd39..65592a1 100644
--- a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp
+++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp
@@ -27,8 +27,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "DaemonCommand") {
+void DaemonCommandRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "DaemonCommand") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -43,12 +43,14 @@ void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet)
// TODO Require authentication
- std::string command = packet["command"];
+ std::string command = (*packet)["command"];
try {
- boost::shared_ptr<Common::Connection> daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]);
- Common::RequestManager::get()->sendRequest1<Requests::CommandRequest>(daemonCon.get(),
- command == "reboot", boost::bind(&DaemonCommandRequestHandler::requestFinished, this, _1));
+ boost::shared_ptr<Common::Connection> daemonCon = ConnectionManager::get()->getDaemonConnection((*packet)["daemon"]);
+
+ boost::shared_ptr<Requests::CommandRequest> request(new Requests::CommandRequest(command == "reboot"));
+ request->connectSignalFinished(boost::bind(&DaemonCommandRequestHandler::requestFinished, this, _1, _2));
+ Common::RequestManager::get()->sendRequest(daemonCon.get(), request);
}
catch(Net::Exception &e) {
Common::XmlPacket ret;
@@ -62,20 +64,20 @@ void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet)
}
}
-void DaemonCommandRequestHandler::requestFinished(Common::Request &request) {
- try {
- sendPacket(request.getResult());
- }
- catch(Net::Exception &e) {
+void DaemonCommandRequestHandler::requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Net::Exception error) {
+ if(error) {
Common::XmlPacket ret;
ret.setType("Error");
- ret.add("ErrorCode", e.getErrorCode());
- ret.add("SubCode", e.getSubCode());
- ret.add("SubSubCode", e.getSubSubCode());
- ret.add("Where", e.getWhere());
+ ret.add("ErrorCode", error.getErrorCode());
+ ret.add("SubCode", error.getSubCode());
+ ret.add("SubSubCode", error.getSubSubCode());
+ ret.add("Where", error.getWhere());
sendPacket(ret);
}
+ else {
+ sendPacket(*packet);
+ }
signalFinished();
}
diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.h b/src/Server/RequestHandlers/DaemonCommandRequestHandler.h
index b0b49df..4595372 100644
--- a/src/Server/RequestHandlers/DaemonCommandRequestHandler.h
+++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.h
@@ -30,14 +30,10 @@ namespace RequestHandlers {
class DaemonCommandRequestHandler : public Common::RequestHandler {
private:
- void requestFinished(Common::Request &request);
+ void requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Net::Exception error);
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- DaemonCommandRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp
index a9791b5..c66e3d3 100644
--- a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp
+++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp
@@ -27,8 +27,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "DaemonFSInfo") {
+void DaemonFSInfoRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "DaemonFSInfo") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -44,9 +44,11 @@ void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
// TODO Require authentication
try {
- boost::shared_ptr<Common::Connection> daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]);
- Common::RequestManager::get()->sendRequest0<Common::Requests::FSInfoRequest>(daemonCon.get(),
- boost::bind(&DaemonFSInfoRequestHandler::requestFinished, this, _1));
+ boost::shared_ptr<Common::Connection> daemonCon = ConnectionManager::get()->getDaemonConnection((*packet)["daemon"]);
+
+ boost::shared_ptr<Common::Requests::FSInfoRequest> request(new Common::Requests::FSInfoRequest);
+ request->connectSignalFinished(boost::bind(&DaemonFSInfoRequestHandler::requestFinished, this, _1, _2));
+ Common::RequestManager::get()->sendRequest(daemonCon.get(), request);
}
catch(Net::Exception &e) {
Common::XmlPacket ret;
@@ -60,20 +62,20 @@ void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
}
}
-void DaemonFSInfoRequestHandler::requestFinished(Common::Request &request) {
- try {
- sendPacket(request.getResult());
- }
- catch(Net::Exception &e) {
+void DaemonFSInfoRequestHandler::requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Net::Exception error) {
+ if(error) {
Common::XmlPacket ret;
ret.setType("Error");
- ret.add("ErrorCode", e.getErrorCode());
- ret.add("SubCode", e.getSubCode());
- ret.add("SubSubCode", e.getSubSubCode());
- ret.add("Where", e.getWhere());
+ ret.add("ErrorCode", error.getErrorCode());
+ ret.add("SubCode", error.getSubCode());
+ ret.add("SubSubCode", error.getSubSubCode());
+ ret.add("Where", error.getWhere());
sendPacket(ret);
}
+ else {
+ sendPacket(*packet);
+ }
signalFinished();
}
diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h
index 5d2ae1c..baf60f7 100644
--- a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h
+++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h
@@ -30,14 +30,10 @@ namespace RequestHandlers {
class DaemonFSInfoRequestHandler : public Common::RequestHandler {
private:
- void requestFinished(Common::Request &request);
+ void requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Net::Exception error);
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- DaemonFSInfoRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp
index f960eaa..63d6bb3 100644
--- a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp
+++ b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp
@@ -25,8 +25,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void DaemonListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "ListHosts") {
+void DaemonListRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "ListHosts") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.h b/src/Server/RequestHandlers/DaemonListRequestHandler.h
index 8726962..adbdabb 100644
--- a/src/Server/RequestHandlers/DaemonListRequestHandler.h
+++ b/src/Server/RequestHandlers/DaemonListRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class DaemonListRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- DaemonListRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp
index 94df846..114260d 100644
--- a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp
+++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp
@@ -27,8 +27,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "GetDaemonStatus") {
+void DaemonStatusRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "GetDaemonStatus") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -43,12 +43,12 @@ void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) {
// TODO Require authentication
- std::string daemonName = packet["daemonName"];
-
try {
- boost::shared_ptr<Common::Connection> daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName);
- Common::RequestManager::get()->sendRequest0<Common::Requests::StatusRequest>(daemonCon.get(),
- boost::bind(&DaemonStatusRequestHandler::requestFinished, this, _1));
+ boost::shared_ptr<Common::Connection> daemonCon = ConnectionManager::get()->getDaemonConnection((*packet)["daemonName"]);
+
+ boost::shared_ptr<Common::Requests::StatusRequest> request(new Common::Requests::StatusRequest);
+ request->connectSignalFinished(boost::bind(&DaemonStatusRequestHandler::requestFinished, this, _1, _2));
+ Common::RequestManager::get()->sendRequest(daemonCon.get(), request);
}
catch(Net::Exception &e) {
Common::XmlPacket ret;
@@ -62,20 +62,20 @@ void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) {
}
}
-void DaemonStatusRequestHandler::requestFinished(Common::Request &request) {
- try {
- sendPacket(request.getResult());
- }
- catch(Net::Exception &e) {
+void DaemonStatusRequestHandler::requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Net::Exception error) {
+ if(error) {
Common::XmlPacket ret;
ret.setType("Error");
- ret.add("ErrorCode", e.getErrorCode());
- ret.add("SubCode", e.getSubCode());
- ret.add("SubSubCode", e.getSubSubCode());
- ret.add("Where", e.getWhere());
+ ret.add("ErrorCode", error.getErrorCode());
+ ret.add("SubCode", error.getSubCode());
+ ret.add("SubSubCode", error.getSubSubCode());
+ ret.add("Where", error.getWhere());
sendPacket(ret);
}
+ else {
+ sendPacket(*packet);
+ }
signalFinished();
}
diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.h b/src/Server/RequestHandlers/DaemonStatusRequestHandler.h
index de7f83d..728be4a 100644
--- a/src/Server/RequestHandlers/DaemonStatusRequestHandler.h
+++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.h
@@ -30,14 +30,10 @@ namespace RequestHandlers {
class DaemonStatusRequestHandler : public Common::RequestHandler {
private:
- void requestFinished(Common::Request &request);
+ void requestFinished(boost::shared_ptr<const Common::XmlPacket> packet, Net::Exception error);
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- DaemonStatusRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/GroupListRequestHandler.cpp b/src/Server/RequestHandlers/GroupListRequestHandler.cpp
index 5d8c9be..453f4c2 100644
--- a/src/Server/RequestHandlers/GroupListRequestHandler.cpp
+++ b/src/Server/RequestHandlers/GroupListRequestHandler.cpp
@@ -26,8 +26,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void GroupListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "ListGroups") {
+void GroupListRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "ListGroups") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
diff --git a/src/Server/RequestHandlers/GroupListRequestHandler.h b/src/Server/RequestHandlers/GroupListRequestHandler.h
index d7d6a9c..8654708 100644
--- a/src/Server/RequestHandlers/GroupListRequestHandler.h
+++ b/src/Server/RequestHandlers/GroupListRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class GroupListRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- GroupListRequestHandler(Common::Connection *connection, boost::uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/GroupUserListRequestHandler.cpp b/src/Server/RequestHandlers/GroupUserListRequestHandler.cpp
index 07ed446..f862e8b 100644
--- a/src/Server/RequestHandlers/GroupUserListRequestHandler.cpp
+++ b/src/Server/RequestHandlers/GroupUserListRequestHandler.cpp
@@ -26,8 +26,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void GroupUserListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "ListGroupUsers") {
+void GroupUserListRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "ListGroupUsers") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -45,7 +45,7 @@ void GroupUserListRequestHandler::handlePacket(const Common::XmlPacket &packet)
Common::XmlPacket ret;
try {
- boost::shared_ptr<std::set<unsigned long> > users = UserManager::get()->getGroupUserList((unsigned long)packet["gid"]);
+ boost::shared_ptr<std::set<unsigned long> > users = UserManager::get()->getGroupUserList((unsigned long)(*packet)["gid"]);
ret.setType("OK");
ret.addList("users");
diff --git a/src/Server/RequestHandlers/GroupUserListRequestHandler.h b/src/Server/RequestHandlers/GroupUserListRequestHandler.h
index 5e50961..2220565 100644
--- a/src/Server/RequestHandlers/GroupUserListRequestHandler.h
+++ b/src/Server/RequestHandlers/GroupUserListRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class GroupUserListRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- GroupUserListRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp
index 5300c19..1b94a52 100644
--- a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp
+++ b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp
@@ -26,8 +26,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "Identify") {
+void IdentifyRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "Identify") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -42,10 +42,10 @@ void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) {
// TODO Require authentication
try {
- if(packet["hostname"].isEmpty())
+ if((*packet)["hostname"].isEmpty())
ConnectionManager::get()->identifyClientConnection(getConnection());
else
- ConnectionManager::get()->identifyDaemonConnection(getConnection(), packet["hostname"]);
+ ConnectionManager::get()->identifyDaemonConnection(getConnection(), (*packet)["hostname"]);
Common::XmlPacket ret;
ret.setType("OK");
diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.h b/src/Server/RequestHandlers/IdentifyRequestHandler.h
index 322bbab..9b2e6a9 100644
--- a/src/Server/RequestHandlers/IdentifyRequestHandler.h
+++ b/src/Server/RequestHandlers/IdentifyRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class IdentifyRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- IdentifyRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/LogRequestHandler.cpp b/src/Server/RequestHandlers/LogRequestHandler.cpp
index 019a7f2..0a615c5 100644
--- a/src/Server/RequestHandlers/LogRequestHandler.cpp
+++ b/src/Server/RequestHandlers/LogRequestHandler.cpp
@@ -26,8 +26,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "Log") {
+void LogRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "Log") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -43,7 +43,7 @@ void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) {
// TODO Require authentication
try {
- Common::LogManager::get()->log(packet["category"], packet["level"], packet["timestamp"], packet["message"],
+ Common::LogManager::get()->log((*packet)["category"], (*packet)["level"], (*packet)["timestamp"], (*packet)["message"],
ConnectionManager::get()->getDaemonName(getConnection()));
}
catch(Net::Exception &e) {
diff --git a/src/Server/RequestHandlers/LogRequestHandler.h b/src/Server/RequestHandlers/LogRequestHandler.h
index d18a6d3..211b976 100644
--- a/src/Server/RequestHandlers/LogRequestHandler.h
+++ b/src/Server/RequestHandlers/LogRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class LogRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- LogRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/UserGroupListRequestHandler.cpp b/src/Server/RequestHandlers/UserGroupListRequestHandler.cpp
index 435a507..f5a3f7e 100644
--- a/src/Server/RequestHandlers/UserGroupListRequestHandler.cpp
+++ b/src/Server/RequestHandlers/UserGroupListRequestHandler.cpp
@@ -26,8 +26,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void UserGroupListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "ListUserGroups") {
+void UserGroupListRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "ListUserGroups") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -45,7 +45,7 @@ void UserGroupListRequestHandler::handlePacket(const Common::XmlPacket &packet)
Common::XmlPacket ret;
try {
- boost::shared_ptr<std::set<unsigned long> > groups = UserManager::get()->getUserGroupList((unsigned long)packet["uid"]);
+ boost::shared_ptr<std::set<unsigned long> > groups = UserManager::get()->getUserGroupList((unsigned long)(*packet)["uid"]);
ret.setType("OK");
ret.addList("groups");
diff --git a/src/Server/RequestHandlers/UserGroupListRequestHandler.h b/src/Server/RequestHandlers/UserGroupListRequestHandler.h
index 8e2add0..35ff2eb 100644
--- a/src/Server/RequestHandlers/UserGroupListRequestHandler.h
+++ b/src/Server/RequestHandlers/UserGroupListRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class UserGroupListRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- UserGroupListRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp
index 1773658..e9e0716 100644
--- a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp
+++ b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp
@@ -26,8 +26,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "GetUserInfo") {
+void UserInfoRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "GetUserInfo") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
@@ -45,7 +45,7 @@ void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
Common::XmlPacket ret;
try {
- boost::shared_ptr<Common::UserInfo> info = UserManager::get()->getUserInfo(packet["uid"]);
+ boost::shared_ptr<Common::UserInfo> info = UserManager::get()->getUserInfo((*packet)["uid"]);
ret.setType("OK");
diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.h b/src/Server/RequestHandlers/UserInfoRequestHandler.h
index 90032f0..af11678 100644
--- a/src/Server/RequestHandlers/UserInfoRequestHandler.h
+++ b/src/Server/RequestHandlers/UserInfoRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class UserInfoRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- UserInfoRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}
diff --git a/src/Server/RequestHandlers/UserListRequestHandler.cpp b/src/Server/RequestHandlers/UserListRequestHandler.cpp
index 519ba6f..4164f22 100644
--- a/src/Server/RequestHandlers/UserListRequestHandler.cpp
+++ b/src/Server/RequestHandlers/UserListRequestHandler.cpp
@@ -26,8 +26,8 @@ namespace Mad {
namespace Server {
namespace RequestHandlers {
-void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
- if(packet.getType() != "ListUsers") {
+void UserListRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) {
+ if(packet->getType() != "ListUsers") {
Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
Common::XmlPacket ret;
diff --git a/src/Server/RequestHandlers/UserListRequestHandler.h b/src/Server/RequestHandlers/UserListRequestHandler.h
index 4b1a385..36cef00 100644
--- a/src/Server/RequestHandlers/UserListRequestHandler.h
+++ b/src/Server/RequestHandlers/UserListRequestHandler.h
@@ -28,11 +28,7 @@ namespace RequestHandlers {
class UserListRequestHandler : public Common::RequestHandler {
protected:
- virtual void handlePacket(const Common::XmlPacket &packet);
-
- public:
- UserListRequestHandler(Common::Connection *connection, uint16_t requestId)
- : RequestHandler(connection, requestId) {}
+ virtual void handlePacket(boost::shared_ptr<const Common::XmlPacket> packet);
};
}