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/net/eathena/chathandler.cpp | |
parent | 84e2c79004f42656660a32f4b54277954f7ec631 (diff) | |
download | plus-2df278161c10f5261c3075592afd4245a71be89e.tar.gz plus-2df278161c10f5261c3075592afd4245a71be89e.tar.bz2 plus-2df278161c10f5261c3075592afd4245a71be89e.tar.xz plus-2df278161c10f5261c3075592afd4245a71be89e.zip |
eathena: fix chat message owner type.
Diffstat (limited to 'src/net/eathena/chathandler.cpp')
-rw-r--r-- | src/net/eathena/chathandler.cpp | 22 |
1 files changed, 13 insertions, 9 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); } |