summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs/chat/channeltab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/tabs/chat/channeltab.cpp')
-rw-r--r--src/gui/widgets/tabs/chat/channeltab.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/widgets/tabs/chat/channeltab.cpp b/src/gui/widgets/tabs/chat/channeltab.cpp
index f4b26f4bc..43ba86acf 100644
--- a/src/gui/widgets/tabs/chat/channeltab.cpp
+++ b/src/gui/widgets/tabs/chat/channeltab.cpp
@@ -25,6 +25,8 @@
#include "chatlogger.h"
#include "configuration.h"
+#include "gui/widgets/windowcontainer.h"
+
#include "gui/windows/chatwindow.h"
#include "net/chathandler.h"
@@ -40,6 +42,8 @@ ChannelTab::ChannelTab(const Widget2 *const widget,
ChannelTab::~ChannelTab()
{
+ if (chatWindow)
+ chatWindow->removeChannel(mChannelName);
}
void ChannelTab::handleInput(const std::string &msg)
@@ -48,3 +52,23 @@ void ChannelTab::handleInput(const std::string &msg)
newMsg = ChatWindow::doReplace(msg);
chatHandler->privateMessage(mChannelName, newMsg);
}
+
+bool ChannelTab::handleCommand(const std::string &restrict type,
+ const std::string &restrict args A_UNUSED)
+{
+ if (type == "close")
+ {
+ if (windowContainer)
+ windowContainer->scheduleDelete(this);
+ else
+ delete this;
+ if (chatWindow)
+ chatWindow->defaultTab();
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}