aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/TicketHandler.cpp
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2012-10-17 00:53:55 +0200
committerkaelima <kaelima@live.se>2012-10-17 00:53:55 +0200
commit98588aa19202c2d259fba0717f9c4a4feac32a0a (patch)
tree5021bf58cb6a602445c5a2cf4252ae8f2599ab13 /src/server/game/Handlers/TicketHandler.cpp
parent4ec23cdba5681808a3bc456b997a860d76b1ab16 (diff)
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
Diffstat (limited to 'src/server/game/Handlers/TicketHandler.cpp')
-rwxr-xr-xsrc/server/game/Handlers/TicketHandler.cpp44
1 files changed, 42 insertions, 2 deletions
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 <http://www.gnu.org/licenses/>.
*/
+#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<uint32> 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<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(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();