summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-14 17:50:47 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-14 17:52:25 +0300
commitafa7cdd59fe9a80479812eaad73a1eeea58bd5de (patch)
tree6d3371a66ee823bf116a4780439cfb4906959115 /src
parent0381a0de69cc21c8886fb0a68cda450d3135d55a (diff)
downloadplus-afa7cdd59fe9a80479812eaad73a1eeea58bd5de.tar.gz
plus-afa7cdd59fe9a80479812eaad73a1eeea58bd5de.tar.bz2
plus-afa7cdd59fe9a80479812eaad73a1eeea58bd5de.tar.xz
plus-afa7cdd59fe9a80479812eaad73a1eeea58bd5de.zip
By requesting open #trade channel, really open trade tab.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp7
-rw-r--r--src/gui/windows/chatwindow.cpp29
-rw-r--r--src/gui/windows/chatwindow.h7
-rw-r--r--src/net/eathena/chathandler.cpp5
4 files changed, 33 insertions, 15 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 18615fa69..22db1dc1f 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -256,14 +256,9 @@ static void createGuiWindows()
debugChatTab->setAllowHighlight(false);
if (config.getBoolValue("enableTradeTab"))
- {
- tradeChatTab = new TradeTab(chatWindow);
- tradeChatTab->setAllowHighlight(false);
- }
+ chatWindow->addSpecialChannelTab(TRADE_CHANNEL, false);
else
- {
tradeChatTab = nullptr;
- }
if (config.getBoolValue("enableBattleTab"))
{
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 4799f65f4..1f3b165c5 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1194,12 +1194,35 @@ WhisperTab *ChatWindow::getWhisperTab(const std::string &nick) const
return ret;
}
-ChannelTab *ChatWindow::addChannelTab(const std::string &name,
- const bool switchTo)
+ChatTab *ChatWindow::addSpecialChannelTab(const std::string &name,
+ const bool switchTo)
+{
+ ChatTab *ret = nullptr;
+ if (name == TRADE_CHANNEL)
+ {
+ if (!tradeChatTab)
+ {
+ tradeChatTab = new TradeTab(chatWindow);
+ tradeChatTab->setAllowHighlight(false);
+ }
+ ret = tradeChatTab;
+ }
+ if (switchTo)
+ mChatTabs->setSelectedTab(ret);
+
+ return ret;
+}
+
+ChatTab *ChatWindow::addChannelTab(const std::string &name,
+ const bool switchTo)
{
std::string tempName = name;
toLower(tempName);
+ ChatTab *const tab = addSpecialChannelTab(name, switchTo);
+ if (tab)
+ return tab;
+
const ChannelMap::const_iterator i = mChannels.find(tempName);
ChannelTab *ret = nullptr;
@@ -1656,7 +1679,7 @@ void ChatWindow::channelChatLog(const std::string &channel,
std::string tempChannel = channel;
toLower(tempChannel);
- ChannelTab *tab = nullptr;
+ ChatTab *tab = nullptr;
const ChannelMap::const_iterator i = mChannels.find(tempChannel);
if (i != mChannels.end())
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index d0af5a74c..1da6c6016 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -202,8 +202,11 @@ class ChatWindow final : public Window,
WhisperTab *getWhisperTab(const std::string &nick) const A_WARN_UNUSED;
- ChannelTab *addChannelTab(const std::string &name,
- const bool switchTo = false);
+ ChatTab *addChannelTab(const std::string &name,
+ const bool switchTo = false);
+
+ ChatTab *addSpecialChannelTab(const std::string &name,
+ const bool switchTo = false);
ChatTab *addChatTab(const std::string &name,
const bool switchTo,
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 456bda0e5..3def53afd 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -194,10 +194,7 @@ void ChatHandler::privateMessage(const std::string &restrict recipient,
void ChatHandler::channelMessage(const std::string &restrict channel,
const std::string &restrict text)
{
- if (channel == TRADE_CHANNEL)
- talk("\302\202" + text, GENERAL_CHANNEL);
- else
- privateMessage(channel, text);
+ privateMessage(channel, text);
}
void ChatHandler::who() const