diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-14 18:33:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-14 18:33:59 +0300 |
commit | 0b861120e4496f64c8014c7f7b3d0a8938cc7d51 (patch) | |
tree | 095bc7b9b9d50fc56b1fd3b2b19696d17780578e /src | |
parent | f86221f5fe1bc54b3e643169d510b01f991e5f04 (diff) | |
download | manaplus-0b861120e4496f64c8014c7f7b3d0a8938cc7d51.tar.gz manaplus-0b861120e4496f64c8014c7f7b3d0a8938cc7d51.tar.bz2 manaplus-0b861120e4496f64c8014c7f7b3d0a8938cc7d51.tar.xz manaplus-0b861120e4496f64c8014c7f7b3d0a8938cc7d51.zip |
Add support for #gm channel for gm tab.
In legacy servers it will use @wgm as before.
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/gui/chatconsts.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/gmtab.cpp | 8 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 7 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 2 |
5 files changed, 17 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp index 22db1dc1f..128497609 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -273,7 +273,7 @@ static void createGuiWindows() if (localPlayer && !gmChatTab && config.getBoolValue("enableGmTab") && localPlayer->getGMLevel() > 0) { - gmChatTab = new GmTab(chatWindow); + chatWindow->addSpecialChannelTab(GM_CHANNEL, false); } if (!isSafeMode && chatWindow) diff --git a/src/gui/chatconsts.h b/src/gui/chatconsts.h index daa7a3be8..8028962c6 100644 --- a/src/gui/chatconsts.h +++ b/src/gui/chatconsts.h @@ -26,6 +26,7 @@ #include <string> const std::string GENERAL_CHANNEL = ""; +const std::string GM_CHANNEL = "#gm"; const std::string TRADE_CHANNEL = "#trade"; #endif // GUI_CHATCONSTS_H diff --git a/src/gui/widgets/tabs/chat/gmtab.cpp b/src/gui/widgets/tabs/chat/gmtab.cpp index f54e941e4..a6bca72ed 100644 --- a/src/gui/widgets/tabs/chat/gmtab.cpp +++ b/src/gui/widgets/tabs/chat/gmtab.cpp @@ -20,6 +20,10 @@ #include "gui/widgets/tabs/chat/gmtab.h" +#include "gui/windows/chatwindow.h" + +#include "net/chathandler.h" + #include "utils/gettext.h" #include "debug.h" @@ -28,7 +32,7 @@ GmTab *gmChatTab = nullptr; GmTab::GmTab(const Widget2 *const widget) : // TRANSLATORS: gb tab name - ChatTab(widget, _("GM"), "", "#GM", ChatTabType::GM) + ChatTab(widget, _("GM"), "", "#gm", ChatTabType::GM) { setTabColors(Theme::GM_CHAT_TAB); } @@ -39,7 +43,7 @@ GmTab::~GmTab() void GmTab::handleInput(const std::string &msg) { - ChatTab::handleInput("@wgm " + msg); + chatHandler->channelMessage(mChannelName, ChatWindow::doReplace(msg)); } void GmTab::handleCommand(const std::string &msg A_UNUSED) diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 1f3b165c5..7c32a6298 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -61,6 +61,7 @@ #include "gui/widgets/tabs/chat/battletab.h" #include "gui/widgets/tabs/chat/channeltab.h" +#include "gui/widgets/tabs/chat/gmtab.h" #include "gui/widgets/tabs/chat/langtab.h" #include "gui/widgets/tabs/chat/tradetab.h" #include "gui/widgets/tabs/chat/whispertab.h" @@ -1207,6 +1208,12 @@ ChatTab *ChatWindow::addSpecialChannelTab(const std::string &name, } ret = tradeChatTab; } + else if (name == GM_CHANNEL) + { + if (!gmChatTab) + gmChatTab = new GmTab(chatWindow); + ret = gmChatTab; + } if (switchTo) mChatTabs->setSelectedTab(ret); diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index a48aa5426..866a0be63 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -170,6 +170,8 @@ void ChatHandler::channelMessage(const std::string &restrict channel, { if (channel == TRADE_CHANNEL) talk("\302\202" + text, GENERAL_CHANNEL); + else if (channel == GM_CHANNEL) + talk("@wgm " + text, GENERAL_CHANNEL); } void ChatHandler::who() const |