[sgala] nicer code. No need to change contact's status to offline when we go offline if contact is already offline. see #3718

This commit is contained in:
Yann Leboulanger 2008-02-03 19:31:01 +00:00
parent 7448dab437
commit dc12930253
1 changed files with 8 additions and 13 deletions

View File

@ -1358,22 +1358,20 @@ class RosterWindow:
# name is to show in conversation window # name is to show in conversation window
name = contact.get_shown_name() name = contact.get_shown_name()
if show in ('offline', 'error') and \ if len(contact_instances) > 1:
len(gajim.events.get_events(account, contact.get_full_jid())) == 0: if contact.resource != '':
if len(contact_instances) > 1: name += '/' + contact.resource
# if multiple resources if show in ('offline', 'error') and \
if contact.resource != '': len(gajim.events.get_events(account, contact.get_full_jid())) == 0:
name += '/' + contact.resource
jid_with_resource = contact.jid + '/' + contact.resource jid_with_resource = contact.jid + '/' + contact.resource
if gajim.interface.msg_win_mgr.has_window(jid_with_resource, account): if gajim.interface.msg_win_mgr.has_window(jid_with_resource,
account):
win = gajim.interface.msg_win_mgr.get_window(jid_with_resource, win = gajim.interface.msg_win_mgr.get_window(jid_with_resource,
account) account)
ctrl = win.get_control(jid_with_resource, account) ctrl = win.get_control(jid_with_resource, account)
ctrl.update_ui() ctrl.update_ui()
win.redraw_tab(ctrl) win.redraw_tab(ctrl)
gajim.contacts.remove_contact(account, contact) gajim.contacts.remove_contact(account, contact)
elif len(contact_instances) > 1 and contact.resource != '':
name += '/' + contact.resource
self.remove_contact(contact, account) self.remove_contact(contact, account)
self.add_contact_to_roster(contact.jid, account) self.add_contact_to_roster(contact.jid, account)
# print status in chat window and update status/GPG image # print status in chat window and update status/GPG image
@ -3890,10 +3888,7 @@ class RosterWindow:
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)
lcontact_copy = [] for contact in [c for c in lcontact if c.show != 'offline']:
for contact in lcontact:
lcontact_copy.append(contact)
for contact in lcontact_copy:
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
self.update_status_combobox() self.update_status_combobox()