Changeset 8903

Show
Ignore:
Timestamp:
10/13/07 16:37:22 (14 months ago)
Author:
asterix
Message:

Follow nick change in private message. fixes #3455

Location:
trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gajim.py

    r8873 r8903  
    11291129                # print status in chat window and update status/GPG image 
    11301130                if ctrl: 
    1131                         contact = ctrl.contact 
    1132                         contact.show = show 
    1133                         contact.status = status 
    1134                         uf_show = helpers.get_uf_show(show) 
    1135                         if status: 
    1136                                 ctrl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show, 
    1137                                         status), 'status') 
     1131                        statusCode = array[9] 
     1132                        if '303' in statusCode: 
     1133                                new_nick = array[10] 
     1134                                ctrl.print_conversation(_('%s is now known as %s') % (nick, 
     1135                                        new_nick), 'status') 
     1136                                gc_c = gajim.contacts.get_gc_contact(account, room_jid, new_nick) 
     1137                                c = gajim.contacts.contact_from_gc_contact(gc_c) 
     1138                                ctrl.gc_contact = gc_c 
     1139                                ctrl.contact = c 
     1140                                ctrl.draw_banner() 
     1141                                old_jid = room_jid + '/' + nick 
     1142                                new_jid = room_jid + '/' + new_nick 
     1143                                self.msg_win_mgr.change_key(old_jid, new_jid, account) 
    11381144                        else: 
    1139                                 ctrl.print_conversation(_('%s is now %s') % (nick, uf_show), 
    1140                                         'status') 
    1141                         ctrl.parent_win.redraw_tab(ctrl) 
    1142                         ctrl.update_ui() 
     1145                                contact = ctrl.contact 
     1146                                contact.show = show 
     1147                                contact.status = status 
     1148                                uf_show = helpers.get_uf_show(show) 
     1149                                if status: 
     1150                                        ctrl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show, 
     1151                                                status), 'status') 
     1152                                else: 
     1153                                        ctrl.print_conversation(_('%s is now %s') % (nick, uf_show), 
     1154                                                'status') 
     1155                                ctrl.parent_win.redraw_tab(ctrl) 
     1156                                ctrl.update_ui() 
    11431157                        if self.remote_ctrl: 
    11441158                                self.remote_ctrl.raise_signal('GCPresence', (account, array)) 
  • trunk/src/groupchat_control.py

    r8897 r8903  
    252252 
    253253                self.history_menuitem = xm.get_widget('history_menuitem') 
    254                 id = self.history_menuitem.connect('activate', self._on_history_menuitem_activate) 
     254                id = self.history_menuitem.connect('activate', 
     255                        self._on_history_menuitem_activate) 
    255256                self.handlers[id] = self.history_menuitem 
    256257 
     
    987988                                                # keep nickname color 
    988989                                                if nick in self.gc_custom_colors: 
    989                                                         self.gc_custom_colors[new_nick] = self.gc_custom_colors[nick] 
     990                                                        self.gc_custom_colors[new_nick] = \ 
     991                                                                self.gc_custom_colors[nick] 
    990992                                        # rename vcard / avatar 
    991993                                        puny_jid = helpers.sanitize_filename(self.room_jid) 
  • trunk/src/message_window.py

    r8900 r8903  
    511511                        nth_child = notebook.get_nth_page(page_num) 
    512512                        return self._widget_to_control(nth_child) 
     513 
     514        def change_key(self, old_jid, new_jid, acct): 
     515                '''Change the key of a control''' 
     516                try: 
     517                        # Check if control exists 
     518                        ctrl = self._controls[acct][old_jid] 
     519                except: 
     520                        return 
     521                self._controls[acct][new_jid] = self._controls[acct][old_jid] 
     522                del self._controls[acct][old_jid] 
    513523 
    514524        def controls(self): 
     
    802812                return win 
    803813 
     814        def change_key(self, old_jid, new_jid, acct): 
     815                win = self.get_window(old_jid, acct) 
     816                if self.mode == self.ONE_MSG_WINDOW_NEVER: 
     817                        old_key = acct + old_jid 
     818                        if old_jid not in self._windows: 
     819                                return 
     820                        new_key = acct + new_jid 
     821                        self._windows[new_key] = self._windows[old_key] 
     822                        del self._windows[old_key] 
     823                win.change_key(old_jid, new_jid, acct) 
     824 
    804825        def _on_window_delete(self, win, event): 
    805826                self.save_state(self._gtk_win_to_msg_win(win))