From d0649b8f81cc7a92011d1178edbab3f7b5852fb6 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 13 Oct 2007 17:47:13 +0000 Subject: [PATCH] [misc] fix change nick behaviour. fixes #3495 --- src/groupchat_control.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/groupchat_control.py b/src/groupchat_control.py index ab002d705..7895df047 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -195,6 +195,7 @@ class GroupchatControl(ChatControlBase): self.room_jid = self.contact.jid self.nick = contact.name + self.new_nick = '' self.name = self.room_jid.split('@')[0] compact_view = gajim.config.get('compact_view') @@ -973,7 +974,9 @@ class GroupchatControl(ChatControlBase): 'reason': reason } self.print_conversation(s, 'info', tim = tim) elif '303' in statusCode: # Someone changed his or her nick - if new_nick == self.nick: # We changed our nick + if new_nick == self.new_nick: # We changed our nick + self.nick = self.new_nick + self.new_nick = '' s = _('You are now known as %s') % new_nick else: s = _('%s is now known as %s') % (nick, new_nick) @@ -1242,7 +1245,7 @@ class GroupchatControl(ChatControlBase): _('The nickname has not allowed characters.')) return True gajim.connections[self.account].join_gc(nick, self.room_jid, None) - self.nick = nick + self.new_nick = nick self.clear(self.msg_textview) else: self.get_command_help(command) @@ -1521,9 +1524,11 @@ class GroupchatControl(ChatControlBase): _('The nickname has not allowed characters.')) return gajim.connections[self.account].join_gc(nick, self.room_jid, None) - self.nick = nick + self.new_nick = nick + def on_cancel(): + self.new_nick = '' instance = dialogs.InputDialog(title, prompt, proposed_nick, - is_modal = False, ok_handler = on_ok) + is_modal = False, ok_handler = on_ok, cancel_handler = on_cancel) def minimize(self, status='offline'): # Minimize it