diff options
Diffstat (limited to 'IrcHandler.py')
-rw-r--r-- | IrcHandler.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/IrcHandler.py b/IrcHandler.py index 7d87ac5..589087f 100644 --- a/IrcHandler.py +++ b/IrcHandler.py @@ -145,6 +145,18 @@ class IrcHandler(QObject): channel.set_topic(topic) self.window.update_topic(channel, topic) + def handle_nick(self, previous_nick, new_nick): + for channel_name, channel in self.channels.items(): + if (previous_nick in channel.get_users()): + channel = self.channels.get(channel_name) + user_list = channel.get_view().findChild(QQuickItem, "nick_list") + chat_area = channel.get_view().findChild(QQuickItem, "chat_area") + user_list.update_nick(previous_nick, new_nick) + new_user = User.User(new_nick, channel.get_users()[previous_nick].get_mode()) + channel.remove_user(previous_nick) + channel.add_user(new_user) + chat_area.append(previous_nick + " is now known as " + new_nick) + def handle_user_mode(self, channelStr, target_user, mode, source_user): if (channelStr in self.channels): channel = self.channels.get(channelStr) @@ -181,9 +193,9 @@ class IrcHandler(QObject): def connect_to_irc(self, view): self.irc.sig.connect(self.handle_msg) - self.irc.join_sig.connect(self.join_channel) self.irc.namreply_sig.connect(self.handle_nicks) - self.irc.nick_sig.connect(self.handle_join) + self.irc.join_sig.connect(self.handle_join) + self.irc.nick_sig.connect(self.handle_nick) self.irc.part_sig.connect(self.handle_part) self.irc.quit_sig.connect(self.handle_quit) self.irc.kick_sig.connect(self.handle_kick) |