From 98588aa19202c2d259fba0717f9c4a4feac32a0a Mon Sep 17 00:00:00 2001 From: kaelima Date: Wed, 17 Oct 2012 00:53:55 +0200 Subject: Core/Ticket: - Fully parse CMSG_GMTICKET_CREATE, use GmTicket::GetChatLog() to access the reporters chat log from this session (unused atm, possible useful to detect chat harassment) - Simplify SMSG_GMTICKET_GETTICKET and fix "category" field (renamed it same as in blizz LUA files) - Store response in DB --- src/server/game/Handlers/TicketHandler.cpp | 44 ++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'src/server/game/Handlers/TicketHandler.cpp') diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index d6675188f6e..7fcfbbbc23e 100755 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -16,6 +16,7 @@ * with this program. If not, see . */ +#include "zlib.h" #include "Language.h" #include "WorldPacket.h" #include "Common.h" @@ -26,7 +27,7 @@ #include "WorldSession.h" #include "Util.h" -void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data) +void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) { // Don't accept tickets if the ticket queue is disabled. (Ticket UI is greyed out but not fully dependable) if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED) @@ -42,7 +43,46 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data) // Player must not have ticket if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID())) { - GmTicket* ticket = new GmTicket(GetPlayer(), recv_data); + GmTicket* ticket = new GmTicket(GetPlayer(), recvData); + + uint32 count; + std::list times; + uint32 decompressedSize; + std::string chatLog; + + recvData >> count; + + for (uint32 i = 0; i < count; i++) + { + uint32 time; + recvData >> time; + times.push_back(time); + } + + recvData >> decompressedSize; + + if (count && decompressedSize && decompressedSize < 0xFFFF) + { + uint32 pos = recvData.rpos(); + ByteBuffer dest; + dest.resize(decompressedSize); + + uLongf realSize = decompressedSize; + if (uncompress(const_cast(dest.contents()), &realSize, const_cast(recvData.contents() + pos), recvData.size() - pos) == Z_OK) + { + dest >> chatLog; + ticket->SetChatLog(times, chatLog); + } + else + { + sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_GMTICKET_CREATE possibly corrupt. Uncompression failed."); + recvData.rfinish(); + return; + } + + recvData.rfinish(); // Will still have compressed data in buffer. + } + sTicketMgr->AddTicket(ticket); sTicketMgr->UpdateLastChange(); -- cgit v1.2.3