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/Core/Requests/CommandRequest.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/Core/Requests/CommandRequest.cpp') diff --git a/src/Core/Requests/CommandRequest.cpp b/src/Core/Requests/CommandRequest.cpp index 35d4dd2..a34a551 100644 --- a/src/Core/Requests/CommandRequest.cpp +++ b/src/Core/Requests/CommandRequest.cpp @@ -26,20 +26,24 @@ namespace Core { namespace Requests { void CommandRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { - connection->send(Net::Packet(reboot ? Net::Packet::COMMAND_REBOOT : Net::Packet::COMMAND_SHUTDOWN, requestId)); + Common::XmlPacket packet; + packet.setType("Command"); + packet.add("command", reboot ? "reboot" : "shutdown"); + + connection->send(packet.encode(requestId)); } -void CommandRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { - if(packet.getType() == Net::Packet::ERROR) { - finishWithError(Net::Packets::ErrorPacket(packet).getException()); +void CommandRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) { + if(packet.getType() == "Error") { + finishWithError(Common::Exception(packet["Where"], packet["ErrorCode"], packet["SubCode"], packet["SubSubCode"])); return; } - else if(packet.getType() != Net::Packet::OK) { + else if(packet.getType() != "OK") { finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET)); return; // TODO Logging } - finish(); + finish(packet); } } -- cgit v1.2.3