From 3f61182c7a079218dd91f8702579e6b18fc77139 Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Sun, 31 Aug 2008 12:36:40 +0000 Subject: [PATCH] Only remove pep when a contact really signs out. --- src/roster_window.py | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/roster_window.py b/src/roster_window.py index 3d2330c2a..68b8dea15 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -976,10 +976,9 @@ class RosterWindow: and 'mood' in gajim.connections[account].mood \ and gajim.connections[account].mood['mood'].strip() in MOODS: - self.model[child_iter][C_MOOD_PIXBUF] = \ - gtkgui_helpers.load_mood_icon( - gajim.connections[account].mood['mood']. \ - strip()).get_pixbuf() + self.model[child_iter][C_MOOD_PIXBUF] = gtkgui_helpers.load_mood_icon( + gajim.connections[account].mood['mood'].strip()).get_pixbuf() + elif gajim.config.get('show_mood_in_roster') \ and gajim.connections[account].mood.has_key('mood'): self.model[child_iter][C_MOOD_PIXBUF] = \ @@ -1089,12 +1088,6 @@ class RosterWindow: if strike: name = '%s' % name - # Delete pep if needed - keep_pep = any(c.show not in ('error', 'offline') for c in - contact_instances) - if not keep_pep and not contact.is_groupchat(): - pep.delete_pep(jid, account) - # Show resource counter nb_connected_contact = 0 for c in contact_instances: @@ -1994,6 +1987,7 @@ class RosterWindow: contact.status = status # name is to show in conversation window name = contact.get_shown_name() + fjid = contact.get_full_jid() # The contact has several resources if len(contact_instances) > 1: @@ -2002,10 +1996,8 @@ class RosterWindow: # Remove resource when going offline if show in ('offline', 'error') and \ - len(gajim.events.get_events(account, contact.get_full_jid())) == 0: - fjid = contact.jid + '/' + contact.resource - ctrl = gajim.interface.msg_win_mgr.get_control( - fjid, account) + len(gajim.events.get_events(account, fjid)) == 0: + ctrl = gajim.interface.msg_win_mgr.get_control(fjid, account) if ctrl: ctrl.update_ui() ctrl.parent_win.redraw_tab(ctrl) @@ -2029,9 +2021,7 @@ class RosterWindow: account, contact.jid) ctrl.update_status_display(name, uf_show, status) - if contact.resource != '': - fjid = contact.jid + '/' + contact.resource - + if contact.resource: ctrl = gajim.interface.msg_win_mgr.get_control(fjid, account) if ctrl: ctrl.update_status_display(name, uf_show, status) @@ -2041,6 +2031,12 @@ class RosterWindow: contact.jid in gajim.interface.status_sent_to_users[account]: del gajim.interface.status_sent_to_users[account][contact.jid] + # Delete pep if needed + keep_pep = any(c.show not in ('error', 'offline') for c in + contact_instances) + if not keep_pep and not contact.is_groupchat(): + pep.delete_pep(contact.jid, account) + # Redraw everything and select the sender self.draw_completely_and_show_if_needed(contact.jid, account) @@ -2062,11 +2058,11 @@ class RosterWindow: # No need to redraw contacts if we're quitting if child_iterA: self.model[child_iterA][C_AVATAR_PIXBUF] = None - if gajim.con_types.has_key(account): + if account in gajim.con_types: gajim.con_types[account] = None for jid in gajim.contacts.get_jid_list(account): lcontact = gajim.contacts.get_contacts(account, jid) - for contact in [c for c in lcontact if (c.show != 'offline' or \ + for contact in [c for c in lcontact if (c.show != 'offline' or c.is_transport())]: self.chg_contact_status(contact, 'offline', '', account) self.actions_menu_needs_rebuild = True