summaryrefslogtreecommitdiff
path: root/src/net/eathena/chathandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-13 16:50:23 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-13 16:50:23 +0300
commit84e2c79004f42656660a32f4b54277954f7ec631 (patch)
treef83d6d2d22bd38145cac2a1023000db7d3c2e74a /src/net/eathena/chathandler.cpp
parent00345798a405d4e28f489d01a2dea6afb01a6c18 (diff)
downloadplus-84e2c79004f42656660a32f4b54277954f7ec631.tar.gz
plus-84e2c79004f42656660a32f4b54277954f7ec631.tar.bz2
plus-84e2c79004f42656660a32f4b54277954f7ec631.tar.xz
plus-84e2c79004f42656660a32f4b54277954f7ec631.zip
eathena: show channel messages in channel tab.
Diffstat (limited to 'src/net/eathena/chathandler.cpp')
-rw-r--r--src/net/eathena/chathandler.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index ac626fd71..b3f81e20a 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -380,19 +380,35 @@ void ChatHandler::processColorChat(Net::MessageIn &msg)
processChatContinue(msg.readRawString(chatMsgLength, "message"));
}
+std::string ChatHandler::extractChannelFromMessage(std::string &chatMsg)
+{
+ std::string msg = chatMsg;
+ std::string channel(GENERAL_CHANNEL);
+ if (findCutFirst(msg, "[ #"))
+ { // found channel message
+ const size_t idx = msg.find(" ] ");
+ if (idx != std::string::npos)
+ {
+ channel = std::string("#").append(msg.substr(0, idx));
+ chatMsg = msg.substr(idx + 3);
+ }
+ }
+ return channel;
+}
+
void ChatHandler::processChatContinue(std::string chatMsg)
{
- const size_t pos = chatMsg.find(" : ", 0);
-
+ const std::string channel = extractChannelFromMessage(chatMsg);
bool allow(true);
if (chatWindow)
{
allow = chatWindow->resortChatLog(chatMsg,
ChatMsgType::BY_PLAYER,
- GENERAL_CHANNEL,
+ channel,
false, true);
}
+ const size_t pos = chatMsg.find(" : ", 0);
if (pos != std::string::npos)
chatMsg.erase(0, pos + 3);
@@ -521,7 +537,7 @@ void ChatHandler::joinChannel(const std::string &channel)
{
// to join channel need use gm commands or send something.
// here we sending invisible message.
- channelMessage(channel, "\302\202G");
+ channelMessage(channel, "\302\202\302");
}
} // namespace EAthena