From 63907817cb057f497f03a28016d408885cbe41ea Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 1 Mar 2009 00:51:00 +0100 Subject: Alle uebrigen Requests ausser GSSAPIAuthRequest in XmlRequests umgewandelt --- src/Common/Requests/DisconnectRequest.cpp | 11 +++++++---- src/Common/Requests/DisconnectRequest.h | 8 ++++---- src/Common/Requests/FSInfoRequest.cpp | 11 +++++++---- src/Common/Requests/FSInfoRequest.h | 9 ++++----- 4 files changed, 22 insertions(+), 17 deletions(-) (limited to 'src/Common/Requests') diff --git a/src/Common/Requests/DisconnectRequest.cpp b/src/Common/Requests/DisconnectRequest.cpp index d8e7ee9..afab8ed 100644 --- a/src/Common/Requests/DisconnectRequest.cpp +++ b/src/Common/Requests/DisconnectRequest.cpp @@ -25,18 +25,21 @@ namespace Common { namespace Requests { void DisconnectRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { - connection->send(Net::Packet(Net::Packet::DISCONNECT, requestId)); + XmlPacket packet; + packet.setType("Disconnect"); + + connection->send(packet.encode(requestId)); } -void DisconnectRequest::handlePacket(Net::Connection *connection, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::OK) { +void DisconnectRequest::handlePacket(Net::Connection *connection, uint16_t, const XmlPacket &packet) { + if(packet.getType() != "OK") { finishWithError(Exception(Exception::UNEXPECTED_PACKET)); return; // TODO Logging } connection->disconnect(); - finish(); + finish(packet); } } diff --git a/src/Common/Requests/DisconnectRequest.h b/src/Common/Requests/DisconnectRequest.h index 602505a..4f2cdf5 100644 --- a/src/Common/Requests/DisconnectRequest.h +++ b/src/Common/Requests/DisconnectRequest.h @@ -20,19 +20,19 @@ #ifndef MAD_COMMON_REQUESTS_DISCONNECTREQUEST_H_ #define MAD_COMMON_REQUESTS_DISCONNECTREQUEST_H_ -#include "../Request.h" +#include "../XmlRequest.h" namespace Mad { namespace Common { namespace Requests { -class DisconnectRequest : public Request<> { +class DisconnectRequest : public XmlRequest { protected: virtual void sendRequest(Net::Connection *connection, uint16_t requestId); - virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet); + virtual void handlePacket(Net::Connection *connection, uint16_t, const XmlPacket &packet); public: - DisconnectRequest(slot_type slot) : Request<>(slot) {} + DisconnectRequest(slot_type slot) : XmlRequest(slot) {} }; } diff --git a/src/Common/Requests/FSInfoRequest.cpp b/src/Common/Requests/FSInfoRequest.cpp index c8492ff..7b5574d 100644 --- a/src/Common/Requests/FSInfoRequest.cpp +++ b/src/Common/Requests/FSInfoRequest.cpp @@ -27,16 +27,19 @@ namespace Common { namespace Requests { void FSInfoRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { - connection->send(Net::Packet(Net::Packet::FS_INFO, requestId)); + XmlPacket packet; + packet.setType("FSInfo"); + + connection->send(packet.encode(requestId)); } -void FSInfoRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::OK) { +void FSInfoRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) { + if(packet.getType() != "OK") { finishWithError(Exception(Exception::UNEXPECTED_PACKET)); return; // TODO Logging } - finish(Net::Packets::FSInfoPacket(packet)); + finish(packet); } } diff --git a/src/Common/Requests/FSInfoRequest.h b/src/Common/Requests/FSInfoRequest.h index 9ae7673..9a6ba14 100644 --- a/src/Common/Requests/FSInfoRequest.h +++ b/src/Common/Requests/FSInfoRequest.h @@ -20,20 +20,19 @@ #ifndef MAD_COMMON_REQUESTS_FSINFOREQUEST_H_ #define MAD_COMMON_REQUESTS_FSINFOREQUEST_H_ -#include "../Request.h" -#include +#include "../XmlRequest.h" namespace Mad { namespace Common { namespace Requests { -class FSInfoRequest : public Request { +class FSInfoRequest : public XmlRequest { protected: virtual void sendRequest(Net::Connection *connection, uint16_t requestId); - virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet); + virtual void handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet); public: - FSInfoRequest(slot_type slot) : Request(slot) {} + FSInfoRequest(slot_type slot) : XmlRequest(slot) {} }; } -- cgit v1.2.3