summaryrefslogtreecommitdiff
path: root/src/net/ea/chathandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-19 00:30:24 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-19 00:30:24 +0300
commite63b10c3a63d93b9a6dfa144624fea8610d7768c (patch)
tree2c537174bb2134ea7b58cbaa6f648c2acd7a8006 /src/net/ea/chathandler.cpp
parente73c5ecc896c14fa43b19e42e5b24c79766cdb44 (diff)
downloadplus-e63b10c3a63d93b9a6dfa144624fea8610d7768c.tar.gz
plus-e63b10c3a63d93b9a6dfa144624fea8610d7768c.tar.bz2
plus-e63b10c3a63d93b9a6dfa144624fea8610d7768c.tar.xz
plus-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.cpp20
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);
+ }
}
}