summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/chatwindow.cpp29
-rw-r--r--src/gui/windows/chatwindow.h7
2 files changed, 31 insertions, 5 deletions
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,