diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-13 18:00:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-13 18:00:24 +0300 |
commit | 2df278161c10f5261c3075592afd4245a71be89e (patch) | |
tree | 12864a7985080b7ef6a96818a895134c552de73d /src | |
parent | 84e2c79004f42656660a32f4b54277954f7ec631 (diff) | |
download | manaplus-2df278161c10f5261c3075592afd4245a71be89e.tar.gz manaplus-2df278161c10f5261c3075592afd4245a71be89e.tar.bz2 manaplus-2df278161c10f5261c3075592afd4245a71be89e.tar.xz manaplus-2df278161c10f5261c3075592afd4245a71be89e.zip |
eathena: fix chat message owner type.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/eathena/chathandler.cpp | 22 | ||||
-rw-r--r-- | src/net/eathena/chathandler.h | 7 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index b3f81e20a..79571f012 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -330,7 +330,8 @@ void ChatHandler::processChat(Net::MessageIn &msg) return; } - processChatContinue(msg.readRawString(chatMsgLength, "message")); + processChatContinue(msg.readRawString(chatMsgLength, "message"), + ChatMsgType::BY_PLAYER); } void ChatHandler::processFormatMessage(Net::MessageIn &msg) @@ -341,7 +342,7 @@ void ChatHandler::processFormatMessage(Net::MessageIn &msg) if (msgId >= 1266 && msgId <= 1269) mercenaryHandler->handleMercenaryMessage(msgId - 1266); else - processChatContinue(chatMsg); + processChatContinue(chatMsg, ChatMsgType::BY_SERVER); } void ChatHandler::processFormatMessageNumber(Net::MessageIn &msg) @@ -351,7 +352,7 @@ void ChatHandler::processFormatMessageNumber(Net::MessageIn &msg) // +++ here need load message from configuration file const std::string chatMsg = strprintf( "Message #%d, value: %d", msgId, value); - processChatContinue(chatMsg); + processChatContinue(chatMsg, ChatMsgType::BY_SERVER); } void ChatHandler::processFormatMessageSkill(Net::MessageIn &msg) @@ -361,7 +362,7 @@ void ChatHandler::processFormatMessageSkill(Net::MessageIn &msg) // +++ here need load message from configuration file const std::string chatMsg = strprintf( "Message #%d, skill: %d", msgId, skillId); - processChatContinue(chatMsg); + processChatContinue(chatMsg, ChatMsgType::BY_SERVER); } void ChatHandler::processColorChat(Net::MessageIn &msg) @@ -377,10 +378,12 @@ void ChatHandler::processColorChat(Net::MessageIn &msg) return; } - processChatContinue(msg.readRawString(chatMsgLength, "message")); + processChatContinue(msg.readRawString(chatMsgLength, "message"), + ChatMsgType::BY_SERVER); } -std::string ChatHandler::extractChannelFromMessage(std::string &chatMsg) +std::string ChatHandler::extractChannelFromMessage(std::string &chatMsg, + ChatMsgType::Type &own) { std::string msg = chatMsg; std::string channel(GENERAL_CHANNEL); @@ -391,19 +394,20 @@ std::string ChatHandler::extractChannelFromMessage(std::string &chatMsg) { channel = std::string("#").append(msg.substr(0, idx)); chatMsg = msg.substr(idx + 3); + own = ChatMsgType::BY_OTHER; } } return channel; } -void ChatHandler::processChatContinue(std::string chatMsg) +void ChatHandler::processChatContinue(std::string chatMsg, ChatMsgType::Type own) { - const std::string channel = extractChannelFromMessage(chatMsg); + const std::string channel = extractChannelFromMessage(chatMsg, own); bool allow(true); if (chatWindow) { allow = chatWindow->resortChatLog(chatMsg, - ChatMsgType::BY_PLAYER, + own, channel, false, true); } diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index 86eeb1386..93cb77935 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -25,6 +25,8 @@ #include "net/ea/chathandler.h" +#include "gui/chatmsgtype.h" + #include "net/eathena/messagehandler.h" namespace EAthena @@ -81,13 +83,14 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler const std::string &password) const override final; protected: - static std::string extractChannelFromMessage(std::string &chatMsg); + static std::string extractChannelFromMessage(std::string &chatMsg, + ChatMsgType::Type &own); void processChat(Net::MessageIn &msg); void processColorChat(Net::MessageIn &msg); - void processChatContinue(std::string chatMsg); + void processChatContinue(std::string chatMsg, ChatMsgType::Type own); void processWhisper(Net::MessageIn &msg) const; |