summaryrefslogtreecommitdiffstats
path: root/src/Common/Requests/DisconnectRequest.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-03-16 19:13:42 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-03-16 19:13:42 +0100
commit8f098fc3070f791302ec1f497588fab6ed409980 (patch)
tree6cff9f7bb973342344a22636a5d9ef26c7a0d940 /src/Common/Requests/DisconnectRequest.cpp
parentaef0f2e7a5085b8da3aa2e97565215d182d3dd2d (diff)
downloadmad-8f098fc3070f791302ec1f497588fab6ed409980.tar
mad-8f098fc3070f791302ec1f497588fab6ed409980.zip
Request- und RequestHandler-Interfaces vereinfacht
Diffstat (limited to 'src/Common/Requests/DisconnectRequest.cpp')
-rw-r--r--src/Common/Requests/DisconnectRequest.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Common/Requests/DisconnectRequest.cpp b/src/Common/Requests/DisconnectRequest.cpp
index afab8ed..ec8719d 100644
--- a/src/Common/Requests/DisconnectRequest.cpp
+++ b/src/Common/Requests/DisconnectRequest.cpp
@@ -24,20 +24,24 @@ namespace Mad {
namespace Common {
namespace Requests {
-void DisconnectRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
+void DisconnectRequest::sendRequest() {
XmlPacket packet;
packet.setType("Disconnect");
- connection->send(packet.encode(requestId));
+ sendPacket(packet);
}
-void DisconnectRequest::handlePacket(Net::Connection *connection, uint16_t, const XmlPacket &packet) {
- if(packet.getType() != "OK") {
+void DisconnectRequest::handlePacket(const XmlPacket &packet) {
+ if(packet.getType() == "Error") {
+ finishWithError(Common::Exception(packet["Where"], packet["ErrorCode"], packet["SubCode"], packet["SubSubCode"]));
+ return;
+ }
+ else if(packet.getType() != "OK") {
finishWithError(Exception(Exception::UNEXPECTED_PACKET));
return; // TODO Logging
}
- connection->disconnect();
+ getConnection()->disconnect();
finish(packet);
}