summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-13 01:48:00 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-13 14:43:43 +0300
commit00345798a405d4e28f489d01a2dea6afb01a6c18 (patch)
tree812a27fa935e41602b4bbbea059b762e77e7388b /src/gui/windows/chatwindow.cpp
parent9ee88d0b1068599f60710a13551257f044722a9d (diff)
downloadmv-00345798a405d4e28f489d01a2dea6afb01a6c18.tar.gz
mv-00345798a405d4e28f489d01a2dea6afb01a6c18.tar.bz2
mv-00345798a405d4e28f489d01a2dea6afb01a6c18.tar.xz
mv-00345798a405d4e28f489d01a2dea6afb01a6c18.zip
Autojoin channels on open channel tab.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 357c76911..4abc70561 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1203,12 +1203,16 @@ ChannelTab *ChatWindow::addChannelTab(const std::string &name,
}
ChatTab *ChatWindow::addChatTab(const std::string &name,
- const bool switchTo)
+ const bool switchTo,
+ const bool join)
{
if (serverFeatures->haveChatChannels() && name.size() > 1
&& name[0] == '#')
{
- return addChannelTab(name, switchTo);
+ ChatTab *const tab = addChannelTab(name, switchTo);
+ if (tab && join)
+ chatHandler->joinChannel(name);
+ return tab;
}
else
{
@@ -1216,6 +1220,17 @@ ChatTab *ChatWindow::addChatTab(const std::string &name,
}
}
+void ChatWindow::postConnection()
+{
+ FOR_EACH (ChannelMap::const_iterator, iter, mChannels)
+ {
+ ChatTab *const tab = iter->second;
+ if (!tab)
+ return;
+ chatHandler->joinChannel(tab->getChannelName());
+ }
+}
+
#define changeColor(fun) \
{ \
msg = removeColors(msg); \
@@ -1699,10 +1714,11 @@ void ChatWindow::loadState()
if (nick.empty())
break;
+
const int flags = serverConfig.getValue(
"chatWhisperFlags" + toString(num), 1);
- ChatTab *const tab = addChatTab(nick, false);
+ ChatTab *const tab = addChatTab(nick, false, false);
if (tab)
{
tab->setAllowHighlight(flags & 1);