From 07e35b82c6d9ba075d42f8b0401d0616fbfc929c Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 23 Jan 2014 02:10:53 +0100 Subject: force user to leave channels when disconnected from server --- core.h | 2 ++ ircserver.cpp | 3 +++ window.cpp | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/core.h b/core.h index 7ccc4ee..2696032 100644 --- a/core.h +++ b/core.h @@ -98,6 +98,8 @@ public: void handlePrivmsg(const UserRef &user, const char *str); char getEffectivePrefixChar(const char *nick) const; + + void disconnected(); }; diff --git a/ircserver.cpp b/ircserver.cpp index 7e20310..31cbd6d 100644 --- a/ircserver.cpp +++ b/ircserver.cpp @@ -73,6 +73,9 @@ void IRCServer::connectedEvent() { void IRCServer::disconnectedEvent() { printf("[IRCServer:%p] disconnectedEvent\n", this); status.pushMessage("Disconnected."); + + for (auto &i : channels) + i.second->disconnected(); } void IRCServer::lineReceivedEvent(char *line, int size) { printf("[%d] { %s }\n", size, line); diff --git a/window.cpp b/window.cpp index f48164c..00e3e22 100644 --- a/window.cpp +++ b/window.cpp @@ -356,3 +356,11 @@ char Channel::getEffectivePrefixChar(const char *nick) const { return 0; } + + +void Channel::disconnected() { + if (inChannel) { + inChannel = false; + pushMessage("You have been disconnected."); + } +} -- cgit v1.2.3