Do not always force backend removal when performing a delayed remove operation. Some coding standards.

This commit is contained in:
Stephan Erb 2008-09-01 20:25:50 +00:00
parent 96a826ed7e
commit 2a1d6edd68
2 changed files with 11 additions and 8 deletions

View File

@ -961,7 +961,8 @@ class Interface:
if jid in gajim.contacts.get_jid_list(account):
c = gajim.contacts.get_first_contact_from_jid(account, jid)
c.resource = array[1]
self.roster.remove_contact_from_groups(c.jid, account, [('Not in Roster'),])
self.roster.remove_contact_from_groups(c.jid, account,
[('Not in Roster'),])
else:
keyID = ''
attached_keys = gajim.config.get_per('accounts', account,
@ -1493,7 +1494,8 @@ class Interface:
# according to xep 0162, contact is not an observer anymore when
# we asked him is auth, so also remove him if ask changed
old_groups = contacts[0].get_shown_groups()
if contacts[0].sub != sub or contacts[0].ask != ask or old_groups != groups:
if contacts[0].sub != sub or contacts[0].ask != ask\
or old_groups != groups:
self.roster.remove_contact(jid, account)
re_add = True
for contact in contacts:

View File

@ -851,7 +851,7 @@ class RosterWindow:
update -- update contact on the server
'''
self.remove_contact(jid, account, force = True)
self.remove_contact(jid, account, force=True)
for contact in gajim.contacts.get_contacts(account, jid):
for group in groups:
if group not in contact.groups:
@ -866,7 +866,7 @@ class RosterWindow:
for group in groups:
self._adjust_group_expand_collapse_state(group, account)
def remove_contact_from_groups(self, jid, account, groups, update = True):
def remove_contact_from_groups(self, jid, account, groups, update=True):
'''Remove contact from given groups and redraw them.
Contact on server is updated too. When the contact has a family,
@ -879,7 +879,7 @@ class RosterWindow:
update -- update contact on the server
'''
self.remove_contact(jid, account, force = True)
self.remove_contact(jid, account, force=True)
for contact in gajim.contacts.get_contacts(account, jid):
for group in groups:
if group in contact.groups:
@ -1643,7 +1643,7 @@ class RosterWindow:
# .keys() is needed
for jid in array.keys():
# Remove the contact in roster. It might has changed
self.remove_contact(jid, account, force = True)
self.remove_contact(jid, account, force=True)
# Remove old Contact instances
gajim.contacts.remove_jid(account, jid, remove_meta=False)
jids = jid.split('/')
@ -1775,9 +1775,10 @@ class RosterWindow:
# Remove contacts in roster if removal was requested
key = (jid, account)
if key in self.contacts_to_be_removed.keys():
backend = self.contacts_to_be_removed[key]['backend']
del self.contacts_to_be_removed[key]
# Remove contact will delay removal if there are more events pending
self.remove_contact(jid, account, backend=True)
self.remove_contact(jid, account, backend=backend)
self.show_title()
def open_event(self, account, jid, event):
@ -2787,7 +2788,7 @@ class RosterWindow:
def on_clear(widget):
dlg.destroy()
# Delete file:
gajim.interface.remove_avatar_files(contact.jid, local = True)
gajim.interface.remove_avatar_files(contact.jid, local=True)
self.update_avatar_in_gui(contact.jid, account)
dlg = dialogs.AvatarChooserDialog(on_response_ok = on_ok,