From df3e1a392488c626245209816a0405c39d8396d5 Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Wed, 19 Apr 2017 17:14:58 +0100 Subject: Handle quit messages --- IrcHandler.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'IrcHandler.py') diff --git a/IrcHandler.py b/IrcHandler.py index 52c9b1c..4fb494d 100644 --- a/IrcHandler.py +++ b/IrcHandler.py @@ -113,7 +113,6 @@ class IrcHandler(QObject): def handle_part(self, channelStr, user): if (channelStr in self.channels): channel = self.channels.get(channelStr) - print(channel.get_users()) user_list = channel.get_view().findChild(QQuickItem, "nick_list") chat_area = channel.get_view().findChild(QQuickItem, "chat_area") if (user != self.get_nick()): @@ -121,6 +120,15 @@ class IrcHandler(QObject): channel.remove_user(user) chat_area.append(user + " left " + channelStr) + def handle_quit(self, nickStr, quit_msg): + for channel_name, channel in self.channels.items(): + if (nickStr in channel.get_users()): + channel.remove_user(nickStr) + user_list = channel.get_view().findChild(QQuickItem, "nick_list") + chat_area = channel.get_view().findChild(QQuickItem, "chat_area") + user_list.remove_nick(nickStr) + chat_area.append(nickStr + " quit (" + quit_msg + ")") + def handle_topic(self, channelStr, topic): if (channelStr in self.channels): channel = self.channels.get(channelStr) @@ -133,6 +141,7 @@ class IrcHandler(QObject): self.irc.namreply_sig.connect(self.handle_nicks) self.irc.nick_sig.connect(self.handle_join) self.irc.part_sig.connect(self.handle_part) + self.irc.quit_sig.connect(self.handle_quit) self.irc.topic_sig.connect(self.handle_topic) # self.irc.join_sig.connect(self.join_channel) self.irc.start() -- cgit v1.2.3