diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-02-19 00:30:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-02-19 00:30:24 +0300 |
commit | e63b10c3a63d93b9a6dfa144624fea8610d7768c (patch) | |
tree | 2c537174bb2134ea7b58cbaa6f648c2acd7a8006 /src/net/ea/chathandler.cpp | |
parent | e73c5ecc896c14fa43b19e42e5b24c79766cdb44 (diff) | |
download | mv-e63b10c3a63d93b9a6dfa144624fea8610d7768c.tar.gz mv-e63b10c3a63d93b9a6dfa144624fea8610d7768c.tar.bz2 mv-e63b10c3a63d93b9a6dfa144624fea8610d7768c.tar.xz mv-e63b10c3a63d93b9a6dfa144624fea8610d7768c.zip |
Add support for GM tab.
This tab visible all messages from @wgm chat command and
local messages in this tab.
Diffstat (limited to 'src/net/ea/chathandler.cpp')
-rw-r--r-- | src/net/ea/chathandler.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
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); + } } } |