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
36
src/gajim.py
36
src/gajim.py
|
@ -1128,18 +1128,32 @@ class Interface:
|
||||||
|
|
||||||
# print status in chat window and update status/GPG image
|
# print status in chat window and update status/GPG image
|
||||||
if ctrl:
|
if ctrl:
|
||||||
contact = ctrl.contact
|
statusCode = array[9]
|
||||||
contact.show = show
|
if '303' in statusCode:
|
||||||
contact.status = status
|
new_nick = array[10]
|
||||||
uf_show = helpers.get_uf_show(show)
|
ctrl.print_conversation(_('%s is now known as %s') % (nick,
|
||||||
if status:
|
new_nick), 'status')
|
||||||
ctrl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show,
|
gc_c = gajim.contacts.get_gc_contact(account, room_jid, new_nick)
|
||||||
status), 'status')
|
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:
|
else:
|
||||||
ctrl.print_conversation(_('%s is now %s') % (nick, uf_show),
|
contact = ctrl.contact
|
||||||
'status')
|
contact.show = show
|
||||||
ctrl.parent_win.redraw_tab(ctrl)
|
contact.status = status
|
||||||
ctrl.update_ui()
|
uf_show = helpers.get_uf_show(show)
|
||||||
|
if status:
|
||||||
|
ctrl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show,
|
||||||
|
status), 'status')
|
||||||
|
else:
|
||||||
|
ctrl.print_conversation(_('%s is now %s') % (nick, uf_show),
|
||||||
|
'status')
|
||||||
|
ctrl.parent_win.redraw_tab(ctrl)
|
||||||
|
ctrl.update_ui()
|
||||||
if self.remote_ctrl:
|
if self.remote_ctrl:
|
||||||
self.remote_ctrl.raise_signal('GCPresence', (account, array))
|
self.remote_ctrl.raise_signal('GCPresence', (account, array))
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.handlers[id] = self.change_subject_menuitem
|
self.handlers[id] = self.change_subject_menuitem
|
||||||
|
|
||||||
self.history_menuitem = xm.get_widget('history_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.handlers[id] = self.history_menuitem
|
||||||
|
|
||||||
self.minimize_menuitem = xm.get_widget('minimize_menuitem')
|
self.minimize_menuitem = xm.get_widget('minimize_menuitem')
|
||||||
|
@ -986,7 +987,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.attention_list.remove(nick)
|
self.attention_list.remove(nick)
|
||||||
# keep nickname color
|
# keep nickname color
|
||||||
if nick in self.gc_custom_colors:
|
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
|
# rename vcard / avatar
|
||||||
puny_jid = helpers.sanitize_filename(self.room_jid)
|
puny_jid = helpers.sanitize_filename(self.room_jid)
|
||||||
puny_nick = helpers.sanitize_filename(nick)
|
puny_nick = helpers.sanitize_filename(nick)
|
||||||
|
|
|
@ -511,6 +511,16 @@ class MessageWindow:
|
||||||
nth_child = notebook.get_nth_page(page_num)
|
nth_child = notebook.get_nth_page(page_num)
|
||||||
return self._widget_to_control(nth_child)
|
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):
|
def controls(self):
|
||||||
for ctrl_dict in self._controls.values():
|
for ctrl_dict in self._controls.values():
|
||||||
for ctrl in ctrl_dict.values():
|
for ctrl in ctrl_dict.values():
|
||||||
|
@ -801,6 +811,17 @@ class MessageWindowMgr:
|
||||||
self._windows[key] = win
|
self._windows[key] = win
|
||||||
return 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):
|
def _on_window_delete(self, win, event):
|
||||||
self.save_state(self._gtk_win_to_msg_win(win))
|
self.save_state(self._gtk_win_to_msg_win(win))
|
||||||
gajim.interface.save_config()
|
gajim.interface.save_config()
|
||||||
|
|
Loading…
Add table
Reference in a new issue