diff options
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/chathandler.cpp | 24 | ||||
-rw-r--r-- | src/net/eathena/chathandler.h | 2 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 31a585cf9..6e2ab0fb3 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -85,10 +85,13 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_PLAYER_CHAT: - case SMSG_COLOR_MESSAGE: processChat(msg); break; + case SMSG_COLOR_MESSAGE: + processColorChat(msg); + break; + case SMSG_GM_CHAT: processGmChat(msg); break; @@ -266,14 +269,23 @@ void ChatHandler::createChatRoom(const std::string &title, void ChatHandler::processChat(Net::MessageIn &msg) { BLOCK_START("ChatHandler::processChat") - const bool coloredChat = msg.getId() == SMSG_COLOR_MESSAGE; int chatMsgLength = msg.readInt16("len") - 4; - if (coloredChat) + if (chatMsgLength <= 0) { - msg.readInt32("unused"); - msg.readInt32("chat color"); - chatMsgLength -= 8; + BLOCK_END("ChatHandler::processChat") + return; } + + processChatContinue(msg.readRawString(chatMsgLength, "message")); +} + +void ChatHandler::processColorChat(Net::MessageIn &msg) +{ + BLOCK_START("ChatHandler::processChat") + int chatMsgLength = msg.readInt16("len") - 4; + msg.readInt32("unused"); + msg.readInt32("chat color"); + chatMsgLength -= 8; if (chatMsgLength <= 0) { BLOCK_END("ChatHandler::processChat") diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index 0b70f6d1f..08103bc86 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -73,6 +73,8 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler protected: void processChat(Net::MessageIn &msg); + void processColorChat(Net::MessageIn &msg); + void processChatContinue(std::string chatMsg); void processWhisper(Net::MessageIn &msg) const; |