diff options
Diffstat (limited to 'src/Daemon/Requests/LogRequest.cpp')
-rw-r--r-- | src/Daemon/Requests/LogRequest.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Daemon/Requests/LogRequest.cpp b/src/Daemon/Requests/LogRequest.cpp index 3a04284..f7a498d 100644 --- a/src/Daemon/Requests/LogRequest.cpp +++ b/src/Daemon/Requests/LogRequest.cpp @@ -19,23 +19,31 @@ #include "LogRequest.h" #include <Net/Connection.h> -#include <Net/Packets/LogPacket.h> namespace Mad { namespace Daemon { namespace Requests { void LogRequest::sendRequest(Net::Connection *connection, uint16_t requestId) { - connection->send(Net::Packets::LogPacket(Net::Packet::LOG, requestId, category, level, messageTimestamp, message)); + Common::XmlPacket packet; + + packet.setType("Log"); + + packet.add("category", category); + packet.add("level", level); + packet.add("timestamp", messageTimestamp); + packet.add("message", message); + + connection->send(packet.encode(requestId)); } -void LogRequest::handlePacket(Net::Connection*, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::OK) { +void LogRequest::handlePacket(Net::Connection*, uint16_t, const Common::XmlPacket &packet) { + if(packet.getType() != "OK") { finishWithError(Common::Exception(Common::Exception::UNEXPECTED_PACKET)); return; // TODO Logging } - finish(); + finish(packet); } } |