From 2bb2c452c651f8b3126a0baa5fb2b654e240fc44 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Sat, 26 Jul 2008 18:44:47 +0000 Subject: [PATCH] update resource-specific chat controls when that resource comes back online --- src/roster_window.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/roster_window.py b/src/roster_window.py index a696b312b..d2fd5d10a 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1978,20 +1978,21 @@ class RosterWindow: # Remove resource when going offline if show in ('offline', 'error') and \ len(gajim.events.get_events(account, contact.get_full_jid())) == 0: - jid_with_resource = contact.jid + '/' + contact.resource - if gajim.interface.msg_win_mgr.has_window(jid_with_resource, - account): - win = gajim.interface.msg_win_mgr.get_window(jid_with_resource, - account) - ctrl = win.get_control(jid_with_resource, account) - if ctrl: - ctrl.update_ui() - win.redraw_tab(ctrl) - gajim.contacts.remove_contact(account, contact) + fjid = contact.jid + '/' + contact.resource + ctrl = gajim.interface.msg_win_mgr.get_control( + fjid, account) + if ctrl: + ctrl.update_ui() + ctrl.parent_win.redraw_tab(ctrl) + # keep the contact around, since it's + # already attached to the control + else: + gajim.contacts.remove_contact(account, contact) elif contact.jid == gajim.get_jid_from_account(account) and \ show in ('offline', 'error'): - # SelfContact went offline. Remove him when last pending message was read + # SelfContact went offline. Remove him when last pending + # message was read self.remove_contact(contact.jid, account, backend=True) uf_show = helpers.get_uf_show(show)