Follow nick change in private message. fixes #3455
This commit is contained in:
parent
314d3e8a81
commit
0869ce362c
3 changed files with 50 additions and 13 deletions
14
src/gajim.py
14
src/gajim.py
|
@ -1128,6 +1128,20 @@ class Interface:
|
|||
|
||||
# print status in chat window and update status/GPG image
|
||||
if ctrl:
|
||||
statusCode = array[9]
|
||||
if '303' in statusCode:
|
||||
new_nick = array[10]
|
||||
ctrl.print_conversation(_('%s is now known as %s') % (nick,
|
||||
new_nick), 'status')
|
||||
gc_c = gajim.contacts.get_gc_contact(account, room_jid, new_nick)
|
||||
c = gajim.contacts.contact_from_gc_contact(gc_c)
|
||||
ctrl.gc_contact = gc_c
|
||||
ctrl.contact = c
|
||||
ctrl.draw_banner()
|
||||
old_jid = room_jid + '/' + nick
|
||||
new_jid = room_jid + '/' + new_nick
|
||||
self.msg_win_mgr.change_key(old_jid, new_jid, account)
|
||||
else:
|
||||
contact = ctrl.contact
|
||||
contact.show = show
|
||||
contact.status = status
|
||||
|
|
|
@ -251,7 +251,8 @@ class GroupchatControl(ChatControlBase):
|
|||
self.handlers[id] = self.change_subject_menuitem
|
||||
|
||||
self.history_menuitem = xm.get_widget('history_menuitem')
|
||||
id = self.history_menuitem.connect('activate', self._on_history_menuitem_activate)
|
||||
id = self.history_menuitem.connect('activate',
|
||||
self._on_history_menuitem_activate)
|
||||
self.handlers[id] = self.history_menuitem
|
||||
|
||||
self.minimize_menuitem = xm.get_widget('minimize_menuitem')
|
||||
|
@ -986,7 +987,8 @@ class GroupchatControl(ChatControlBase):
|
|||
self.attention_list.remove(nick)
|
||||
# keep nickname color
|
||||
if nick in self.gc_custom_colors:
|
||||
self.gc_custom_colors[new_nick] = self.gc_custom_colors[nick]
|
||||
self.gc_custom_colors[new_nick] = \
|
||||
self.gc_custom_colors[nick]
|
||||
# rename vcard / avatar
|
||||
puny_jid = helpers.sanitize_filename(self.room_jid)
|
||||
puny_nick = helpers.sanitize_filename(nick)
|
||||
|
|
|
@ -511,6 +511,16 @@ class MessageWindow:
|
|||
nth_child = notebook.get_nth_page(page_num)
|
||||
return self._widget_to_control(nth_child)
|
||||
|
||||
def change_key(self, old_jid, new_jid, acct):
|
||||
'''Change the key of a control'''
|
||||
try:
|
||||
# Check if control exists
|
||||
ctrl = self._controls[acct][old_jid]
|
||||
except:
|
||||
return
|
||||
self._controls[acct][new_jid] = self._controls[acct][old_jid]
|
||||
del self._controls[acct][old_jid]
|
||||
|
||||
def controls(self):
|
||||
for ctrl_dict in self._controls.values():
|
||||
for ctrl in ctrl_dict.values():
|
||||
|
@ -801,6 +811,17 @@ class MessageWindowMgr:
|
|||
self._windows[key] = win
|
||||
return win
|
||||
|
||||
def change_key(self, old_jid, new_jid, acct):
|
||||
win = self.get_window(old_jid, acct)
|
||||
if self.mode == self.ONE_MSG_WINDOW_NEVER:
|
||||
old_key = acct + old_jid
|
||||
if old_jid not in self._windows:
|
||||
return
|
||||
new_key = acct + new_jid
|
||||
self._windows[new_key] = self._windows[old_key]
|
||||
del self._windows[old_key]
|
||||
win.change_key(old_jid, new_jid, acct)
|
||||
|
||||
def _on_window_delete(self, win, event):
|
||||
self.save_state(self._gtk_win_to_msg_win(win))
|
||||
gajim.interface.save_config()
|
||||
|
|
Loading…
Add table
Reference in a new issue