summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-13 19:02:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-13 19:02:27 +0300
commit62c8531e9f937cdb8caa086b9cd893564dbc6e79 (patch)
treeac90a790767bf5565ccf08a4fc18ac483d37d26b
parentcb953c324d886f480dacb41f632e4dc977945021 (diff)
downloadmv-62c8531e9f937cdb8caa086b9cd893564dbc6e79.tar.gz
mv-62c8531e9f937cdb8caa086b9cd893564dbc6e79.tar.bz2
mv-62c8531e9f937cdb8caa086b9cd893564dbc6e79.tar.xz
mv-62c8531e9f937cdb8caa086b9cd893564dbc6e79.zip
Create channel if get message about already joined.
-rw-r--r--src/net/eathena/chathandler.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 4e2c9969c..8e7417427 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -378,8 +378,19 @@ void ChatHandler::processColorChat(Net::MessageIn &msg)
return;
}
- processChatContinue(msg.readRawString(chatMsgLength, "message"),
- ChatMsgType::BY_UNKNOWN);
+ std::string message = msg.readRawString(chatMsgLength, "message");
+ std::string msg2 = message;
+ if (findCutFirst(msg2, "You're now in the '#") && findCutLast(msg2, "'"))
+ {
+ const size_t idx = msg2.find("' channel for '");
+ if (idx != std::string::npos && chatWindow)
+ {
+ chatWindow->addChannelTab(std::string("#").append(
+ msg2.substr(0, idx)), false);
+ return;
+ }
+ }
+ processChatContinue(message, ChatMsgType::BY_UNKNOWN);
}
std::string ChatHandler::extractChannelFromMessage(std::string &chatMsg,