summaryrefslogtreecommitdiffstats
path: root/src/Client/Requests
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-02-24 22:03:34 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-02-24 22:03:34 +0100
commitf85b6d5ab264910f272e69ce5997cebec54886ce (patch)
tree06b801d5b11c2d8a2dfae16b698ebaf0b74f429b /src/Client/Requests
parent8d629ca48e9b5530416127e2e52c945fe1f9ee52 (diff)
downloadmad-f85b6d5ab264910f272e69ce5997cebec54886ce.tar
mad-f85b6d5ab264910f272e69ce5997cebec54886ce.zip
Requests Status, DaemonStatus und UserList in XmlRequests umgewandelt
Diffstat (limited to 'src/Client/Requests')
-rw-r--r--src/Client/Requests/DaemonStatusRequest.cpp16
-rw-r--r--src/Client/Requests/DaemonStatusRequest.h9
2 files changed, 12 insertions, 13 deletions
diff --git a/src/Client/Requests/DaemonStatusRequest.cpp b/src/Client/Requests/DaemonStatusRequest.cpp
index 94407b4..2d83b8b 100644
--- a/src/Client/Requests/DaemonStatusRequest.cpp
+++ b/src/Client/Requests/DaemonStatusRequest.cpp
@@ -26,20 +26,20 @@ namespace Client {
namespace Requests {
void DaemonStatusRequest::sendRequest(Net::Connection *connection, uint16_t requestId) {
- connection->send(Net::Packet(Net::Packet::DAEMON_STATUS, requestId, daemon.c_str(), daemon.length()));
+ Common::XmlPacket packet;
+ packet.setType("GetDaemonStatus");
+ packet.add("daemonName", daemon);
+
+ connection->send(packet.encode(requestId));
}
-void DaemonStatusRequest::handlePacket(Net::Connection*, const Net::Packet &packet) {
- if(packet.getType() == Net::Packet::ERROR) {
- finishWithError(Net::Packets::ErrorPacket(packet).getException());
- return;
- }
- else if(packet.getType() != Net::Packet::OK) {
+void DaemonStatusRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) {
+ if(packet.getType() != "OK") {
finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET));
return; // TODO Logging
}
- finish(Net::Packets::HostStatusPacket(packet));
+ finish(packet);
}
}
diff --git a/src/Client/Requests/DaemonStatusRequest.h b/src/Client/Requests/DaemonStatusRequest.h
index 3190ca1..b0982e6 100644
--- a/src/Client/Requests/DaemonStatusRequest.h
+++ b/src/Client/Requests/DaemonStatusRequest.h
@@ -20,8 +20,7 @@
#ifndef MAD_CLIENT_REQUESTS_DAEMONSTATUSREQUEST_H_
#define MAD_CLIENT_REQUESTS_DAEMONSTATUSREQUEST_H_
-#include <Common/Request.h>
-#include <Net/Packets/HostStatusPacket.h>
+#include <Common/XmlRequest.h>
#include <string>
@@ -29,16 +28,16 @@ namespace Mad {
namespace Client {
namespace Requests {
-class DaemonStatusRequest : public Common::Request<Net::Packets::HostStatusPacket> {
+class DaemonStatusRequest : public Common::XmlRequest {
private:
std::string daemon;
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:
- DaemonStatusRequest(const std::string &daemon0, slot_type slot) : Common::Request<Net::Packets::HostStatusPacket>(slot), daemon(daemon0) {}
+ DaemonStatusRequest(const std::string &daemon0, slot_type slot) : Common::XmlRequest(slot), daemon(daemon0) {}
};
}