Only remove pep when a contact really signs out.

This commit is contained in:
Stephan Erb 2008-08-31 12:36:40 +00:00
parent ab694e09ee
commit 3f61182c7a
1 changed files with 15 additions and 19 deletions

View File

@ -976,10 +976,9 @@ class RosterWindow:
and 'mood' in gajim.connections[account].mood \ and 'mood' in gajim.connections[account].mood \
and gajim.connections[account].mood['mood'].strip() in MOODS: and gajim.connections[account].mood['mood'].strip() in MOODS:
self.model[child_iter][C_MOOD_PIXBUF] = \ self.model[child_iter][C_MOOD_PIXBUF] = gtkgui_helpers.load_mood_icon(
gtkgui_helpers.load_mood_icon( gajim.connections[account].mood['mood'].strip()).get_pixbuf()
gajim.connections[account].mood['mood']. \
strip()).get_pixbuf()
elif gajim.config.get('show_mood_in_roster') \ elif gajim.config.get('show_mood_in_roster') \
and gajim.connections[account].mood.has_key('mood'): and gajim.connections[account].mood.has_key('mood'):
self.model[child_iter][C_MOOD_PIXBUF] = \ self.model[child_iter][C_MOOD_PIXBUF] = \
@ -1089,12 +1088,6 @@ class RosterWindow:
if strike: if strike:
name = '<span strikethrough="true">%s</span>' % name name = '<span strikethrough="true">%s</span>' % 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 # Show resource counter
nb_connected_contact = 0 nb_connected_contact = 0
for c in contact_instances: for c in contact_instances:
@ -1994,6 +1987,7 @@ class RosterWindow:
contact.status = status contact.status = status
# name is to show in conversation window # name is to show in conversation window
name = contact.get_shown_name() name = contact.get_shown_name()
fjid = contact.get_full_jid()
# The contact has several resources # The contact has several resources
if len(contact_instances) > 1: if len(contact_instances) > 1:
@ -2002,10 +1996,8 @@ class RosterWindow:
# Remove resource when going offline # Remove resource when going offline
if show in ('offline', 'error') and \ if show in ('offline', 'error') and \
len(gajim.events.get_events(account, contact.get_full_jid())) == 0: len(gajim.events.get_events(account, fjid)) == 0:
fjid = contact.jid + '/' + contact.resource ctrl = gajim.interface.msg_win_mgr.get_control(fjid, account)
ctrl = gajim.interface.msg_win_mgr.get_control(
fjid, account)
if ctrl: if ctrl:
ctrl.update_ui() ctrl.update_ui()
ctrl.parent_win.redraw_tab(ctrl) ctrl.parent_win.redraw_tab(ctrl)
@ -2029,9 +2021,7 @@ class RosterWindow:
account, contact.jid) account, contact.jid)
ctrl.update_status_display(name, uf_show, status) ctrl.update_status_display(name, uf_show, status)
if contact.resource != '': if contact.resource:
fjid = contact.jid + '/' + contact.resource
ctrl = gajim.interface.msg_win_mgr.get_control(fjid, account) ctrl = gajim.interface.msg_win_mgr.get_control(fjid, account)
if ctrl: if ctrl:
ctrl.update_status_display(name, uf_show, status) ctrl.update_status_display(name, uf_show, status)
@ -2041,6 +2031,12 @@ class RosterWindow:
contact.jid in gajim.interface.status_sent_to_users[account]: contact.jid in gajim.interface.status_sent_to_users[account]:
del gajim.interface.status_sent_to_users[account][contact.jid] 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 # Redraw everything and select the sender
self.draw_completely_and_show_if_needed(contact.jid, account) 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 # No need to redraw contacts if we're quitting
if child_iterA: if child_iterA:
self.model[child_iterA][C_AVATAR_PIXBUF] = None 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 gajim.con_types[account] = None
for jid in gajim.contacts.get_jid_list(account): for jid in gajim.contacts.get_jid_list(account):
lcontact = gajim.contacts.get_contacts(account, jid) 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())]: c.is_transport())]:
self.chg_contact_status(contact, 'offline', '', account) self.chg_contact_status(contact, 'offline', '', account)
self.actions_menu_needs_rebuild = True self.actions_menu_needs_rebuild = True