diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-06-04 22:23:07 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-06-04 22:23:07 +0200 |
commit | 0b27c37fe95c6aced613d51a3624f8930a96ad3f (patch) | |
tree | 5cb92568f70fe9789e99633ec71048389efb7fa4 /src/Common/Requests | |
parent | 50d92f64547c5c06851976ceab5ed631ec93f647 (diff) | |
download | mad-0b27c37fe95c6aced613d51a3624f8930a96ad3f.tar mad-0b27c37fe95c6aced613d51a3624f8930a96ad3f.zip |
RequestHandler-Interface ?berarbeitet
Diffstat (limited to 'src/Common/Requests')
-rw-r--r-- | src/Common/Requests/DisconnectRequest.cpp | 12 | ||||
-rw-r--r-- | src/Common/Requests/DisconnectRequest.h | 6 | ||||
-rw-r--r-- | src/Common/Requests/FSInfoRequest.h | 3 | ||||
-rw-r--r-- | src/Common/Requests/GroupListRequest.h | 3 | ||||
-rw-r--r-- | src/Common/Requests/GroupUserListRequest.h | 3 | ||||
-rw-r--r-- | src/Common/Requests/IdentifyRequest.h | 3 | ||||
-rw-r--r-- | src/Common/Requests/SimpleRequest.h | 3 | ||||
-rw-r--r-- | src/Common/Requests/StatusRequest.h | 3 | ||||
-rw-r--r-- | src/Common/Requests/UserGroupListRequest.h | 3 | ||||
-rw-r--r-- | src/Common/Requests/UserInfoRequest.h | 4 | ||||
-rw-r--r-- | src/Common/Requests/UserListRequest.h | 3 |
11 files changed, 17 insertions, 29 deletions
diff --git a/src/Common/Requests/DisconnectRequest.cpp b/src/Common/Requests/DisconnectRequest.cpp index 3fac25b..249bbc1 100644 --- a/src/Common/Requests/DisconnectRequest.cpp +++ b/src/Common/Requests/DisconnectRequest.cpp @@ -30,19 +30,19 @@ void DisconnectRequest::sendRequest() { sendPacket(packet); } -void DisconnectRequest::handlePacket(const XmlPacket &packet) { - if(packet.getType() == "Error") { - finishWithError(Net::Exception(packet["Where"], packet["ErrorCode"], packet["SubCode"], packet["SubSubCode"])); +void DisconnectRequest::handlePacket(boost::shared_ptr<const XmlPacket> packet) { + if(packet->getType() == "Error") { + signalFinished(Net::Exception((*packet)["Where"], (*packet)["ErrorCode"], (*packet)["SubCode"], (*packet)["SubSubCode"])); return; } - else if(packet.getType() != "OK") { - finishWithError(Net::Exception(Net::Exception::UNEXPECTED_PACKET)); + else if(packet->getType() != "OK") { + signalFinished(Net::Exception(Net::Exception::UNEXPECTED_PACKET)); return; // TODO Logging } getConnection()->disconnect(); - finish(packet); + signalFinished(packet); } } diff --git a/src/Common/Requests/DisconnectRequest.h b/src/Common/Requests/DisconnectRequest.h index b4fd4db..6da0ac9 100644 --- a/src/Common/Requests/DisconnectRequest.h +++ b/src/Common/Requests/DisconnectRequest.h @@ -29,11 +29,7 @@ namespace Requests { class DisconnectRequest : public Request { protected: virtual void sendRequest(); - virtual void handlePacket(const XmlPacket &packet); - - public: - DisconnectRequest(Connection *connection, uint16_t requestId, slot_type slot) - : Request(connection, requestId, slot) {} + virtual void handlePacket(boost::shared_ptr<const XmlPacket> packet); }; } diff --git a/src/Common/Requests/FSInfoRequest.h b/src/Common/Requests/FSInfoRequest.h index 1db7753..250889a 100644 --- a/src/Common/Requests/FSInfoRequest.h +++ b/src/Common/Requests/FSInfoRequest.h @@ -28,8 +28,7 @@ namespace Requests { class FSInfoRequest : public SimpleRequest { public: - FSInfoRequest(Connection *connection, uint16_t requestId, slot_type slot) - : SimpleRequest(connection, requestId, slot, "FSInfo") {} + FSInfoRequest() : SimpleRequest("FSInfo") {} }; } diff --git a/src/Common/Requests/GroupListRequest.h b/src/Common/Requests/GroupListRequest.h index 5aad003..b1e4115 100644 --- a/src/Common/Requests/GroupListRequest.h +++ b/src/Common/Requests/GroupListRequest.h @@ -28,8 +28,7 @@ namespace Requests { class GroupListRequest : public SimpleRequest { public: - GroupListRequest(Connection *connection, uint16_t requestId, slot_type slot) - : SimpleRequest(connection, requestId, slot, "ListGroups") {} + GroupListRequest() : SimpleRequest("ListGroups") {} }; } diff --git a/src/Common/Requests/GroupUserListRequest.h b/src/Common/Requests/GroupUserListRequest.h index fd56a2f..bb735f1 100644 --- a/src/Common/Requests/GroupUserListRequest.h +++ b/src/Common/Requests/GroupUserListRequest.h @@ -34,8 +34,7 @@ class GroupUserListRequest : public Request { virtual void sendRequest(); public: - GroupUserListRequest(Connection *connection, uint16_t requestId, slot_type slot, unsigned long gid0) - : Request(connection, requestId, slot), gid(gid0) {} + GroupUserListRequest(unsigned long gid0) : gid(gid0) {} }; } diff --git a/src/Common/Requests/IdentifyRequest.h b/src/Common/Requests/IdentifyRequest.h index 3798909..3084ce6 100644 --- a/src/Common/Requests/IdentifyRequest.h +++ b/src/Common/Requests/IdentifyRequest.h @@ -36,8 +36,7 @@ class IdentifyRequest : public Common::Request { virtual void sendRequest(); public: - IdentifyRequest(Common::Connection *connection, uint16_t requestId, slot_type slot, const std::string &hostname0 = std::string()) - : Common::Request(connection, requestId, slot), hostname(hostname0) {} + IdentifyRequest(const std::string &hostname0 = std::string()) : hostname(hostname0) {} }; } diff --git a/src/Common/Requests/SimpleRequest.h b/src/Common/Requests/SimpleRequest.h index 2c3070a..d381ecf 100644 --- a/src/Common/Requests/SimpleRequest.h +++ b/src/Common/Requests/SimpleRequest.h @@ -34,8 +34,7 @@ class SimpleRequest : public Request { virtual void sendRequest(); - SimpleRequest(Connection *connection, uint16_t requestId, slot_type slot, const std::string &type0) - : Request(connection, requestId, slot), type(type0) {} + SimpleRequest(const std::string &type0) : type(type0) {} }; } diff --git a/src/Common/Requests/StatusRequest.h b/src/Common/Requests/StatusRequest.h index 0663fc4..b9b9f02 100644 --- a/src/Common/Requests/StatusRequest.h +++ b/src/Common/Requests/StatusRequest.h @@ -28,8 +28,7 @@ namespace Requests { class StatusRequest : public SimpleRequest { public: - StatusRequest(Connection *connection, uint16_t requestId, slot_type slot) - : SimpleRequest(connection, requestId, slot, "GetStatus") {} + StatusRequest() : SimpleRequest("GetStatus") {} }; } diff --git a/src/Common/Requests/UserGroupListRequest.h b/src/Common/Requests/UserGroupListRequest.h index 2ee33d9..82db411 100644 --- a/src/Common/Requests/UserGroupListRequest.h +++ b/src/Common/Requests/UserGroupListRequest.h @@ -34,8 +34,7 @@ class UserGroupListRequest : public Request { virtual void sendRequest(); public: - UserGroupListRequest(Connection *connection, uint16_t requestId, slot_type slot, unsigned long uid0) - : Request(connection, requestId, slot), uid(uid0) {} + UserGroupListRequest(unsigned long uid0) : uid(uid0) {} }; } diff --git a/src/Common/Requests/UserInfoRequest.h b/src/Common/Requests/UserInfoRequest.h index 27cf1af..c9ac89b 100644 --- a/src/Common/Requests/UserInfoRequest.h +++ b/src/Common/Requests/UserInfoRequest.h @@ -34,8 +34,8 @@ class UserInfoRequest : public Request { virtual void sendRequest(); public: - UserInfoRequest(Connection *connection, uint16_t requestId, slot_type slot, unsigned long uid0) - : Request(connection, requestId, slot), uid(uid0) {} + UserInfoRequest(unsigned long uid0) + : uid(uid0) {} }; } diff --git a/src/Common/Requests/UserListRequest.h b/src/Common/Requests/UserListRequest.h index 7ab3ec7..9b69564 100644 --- a/src/Common/Requests/UserListRequest.h +++ b/src/Common/Requests/UserListRequest.h @@ -28,8 +28,7 @@ namespace Requests { class UserListRequest : public SimpleRequest { public: - UserListRequest(Connection *connection, uint16_t requestId, slot_type slot) - : SimpleRequest(connection, requestId, slot, "ListUsers") {} + UserListRequest() : SimpleRequest("ListUsers") {} }; } |