From e63b10c3a63d93b9a6dfa144624fea8610d7768c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 19 Feb 2013 00:30:24 +0300 Subject: Add support for GM tab. This tab visible all messages from @wgm chat command and local messages in this tab. --- src/net/ea/chathandler.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/net/ea/chathandler.cpp') diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index d133178b3..61ae2eee7 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -32,6 +32,7 @@ #include "gui/shopwindow.h" #include "gui/widgets/chattab.h" +#include "gui/widgets/gmtab.h" #include "utils/gettext.h" @@ -246,7 +247,24 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) } else if (localChatTab) { - localChatTab->chatLog(chatMsg, BY_SERVER); + if (gmChatTab && strStartWith(chatMsg, "[GM] ")) + { + chatMsg = chatMsg.substr(5); + const size_t pos = chatMsg.find(": ", 0); + if (pos == std::string::npos) + { + gmChatTab->chatLog(chatMsg); + } + else + { + gmChatTab->chatLog(chatMsg.substr(0, pos), + chatMsg.substr(pos + 2)); + } + } + else + { + localChatTab->chatLog(chatMsg, BY_SERVER); + } } } -- cgit v1.2.3-70-g09d2