From 62c8531e9f937cdb8caa086b9cd893564dbc6e79 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 13 Oct 2014 19:02:27 +0300 Subject: Create channel if get message about already joined. --- src/net/eathena/chathandler.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/net/eathena/chathandler.cpp') 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, -- cgit v1.2.3-60-g2f50