diff options
Diffstat (limited to 'src/Client/Requests/DaemonFSInfoRequest.cpp')
-rw-r--r-- | src/Client/Requests/DaemonFSInfoRequest.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Client/Requests/DaemonFSInfoRequest.cpp b/src/Client/Requests/DaemonFSInfoRequest.cpp index eb26cf4..e179f46 100644 --- a/src/Client/Requests/DaemonFSInfoRequest.cpp +++ b/src/Client/Requests/DaemonFSInfoRequest.cpp @@ -26,20 +26,24 @@ namespace Client { namespace Requests { void DaemonFSInfoRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { - connection->send(Net::Packet(Net::Packet::DAEMON_FS_INFO, requestId, daemon.c_str(), daemon.length())); + Common::XmlPacket packet; + packet.setType("DaemonFSInfo"); + packet.add("daemon", daemon); + + connection->send(packet.encode(requestId)); } -void DaemonFSInfoRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { - if(packet.getType() == Net::Packet::ERROR) { - finishWithError(Net::Packets::ErrorPacket(packet).getException()); +void DaemonFSInfoRequest::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(Net::Packets::FSInfoPacket(packet)); + finish(packet); } } |