Do not always force backend removal when performing a delayed remove operation. Some coding standards.
This commit is contained in:
parent
96a826ed7e
commit
2a1d6edd68
2 changed files with 11 additions and 8 deletions
|
@ -961,7 +961,8 @@ class Interface:
|
||||||
if jid in gajim.contacts.get_jid_list(account):
|
if jid in gajim.contacts.get_jid_list(account):
|
||||||
c = gajim.contacts.get_first_contact_from_jid(account, jid)
|
c = gajim.contacts.get_first_contact_from_jid(account, jid)
|
||||||
c.resource = array[1]
|
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:
|
else:
|
||||||
keyID = ''
|
keyID = ''
|
||||||
attached_keys = gajim.config.get_per('accounts', account,
|
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
|
# according to xep 0162, contact is not an observer anymore when
|
||||||
# we asked him is auth, so also remove him if ask changed
|
# we asked him is auth, so also remove him if ask changed
|
||||||
old_groups = contacts[0].get_shown_groups()
|
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)
|
self.roster.remove_contact(jid, account)
|
||||||
re_add = True
|
re_add = True
|
||||||
for contact in contacts:
|
for contact in contacts:
|
||||||
|
|
|
@ -851,7 +851,7 @@ class RosterWindow:
|
||||||
update -- update contact on the server
|
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 contact in gajim.contacts.get_contacts(account, jid):
|
||||||
for group in groups:
|
for group in groups:
|
||||||
if group not in contact.groups:
|
if group not in contact.groups:
|
||||||
|
@ -866,7 +866,7 @@ class RosterWindow:
|
||||||
for group in groups:
|
for group in groups:
|
||||||
self._adjust_group_expand_collapse_state(group, account)
|
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.
|
'''Remove contact from given groups and redraw them.
|
||||||
|
|
||||||
Contact on server is updated too. When the contact has a family,
|
Contact on server is updated too. When the contact has a family,
|
||||||
|
@ -879,7 +879,7 @@ class RosterWindow:
|
||||||
update -- update contact on the server
|
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 contact in gajim.contacts.get_contacts(account, jid):
|
||||||
for group in groups:
|
for group in groups:
|
||||||
if group in contact.groups:
|
if group in contact.groups:
|
||||||
|
@ -1643,7 +1643,7 @@ class RosterWindow:
|
||||||
# .keys() is needed
|
# .keys() is needed
|
||||||
for jid in array.keys():
|
for jid in array.keys():
|
||||||
# Remove the contact in roster. It might has changed
|
# 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
|
# Remove old Contact instances
|
||||||
gajim.contacts.remove_jid(account, jid, remove_meta=False)
|
gajim.contacts.remove_jid(account, jid, remove_meta=False)
|
||||||
jids = jid.split('/')
|
jids = jid.split('/')
|
||||||
|
@ -1775,9 +1775,10 @@ class RosterWindow:
|
||||||
# Remove contacts in roster if removal was requested
|
# Remove contacts in roster if removal was requested
|
||||||
key = (jid, account)
|
key = (jid, account)
|
||||||
if key in self.contacts_to_be_removed.keys():
|
if key in self.contacts_to_be_removed.keys():
|
||||||
|
backend = self.contacts_to_be_removed[key]['backend']
|
||||||
del self.contacts_to_be_removed[key]
|
del self.contacts_to_be_removed[key]
|
||||||
# Remove contact will delay removal if there are more events pending
|
# 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()
|
self.show_title()
|
||||||
|
|
||||||
def open_event(self, account, jid, event):
|
def open_event(self, account, jid, event):
|
||||||
|
@ -2787,7 +2788,7 @@ class RosterWindow:
|
||||||
def on_clear(widget):
|
def on_clear(widget):
|
||||||
dlg.destroy()
|
dlg.destroy()
|
||||||
# Delete file:
|
# 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)
|
self.update_avatar_in_gui(contact.jid, account)
|
||||||
|
|
||||||
dlg = dialogs.AvatarChooserDialog(on_response_ok = on_ok,
|
dlg = dialogs.AvatarChooserDialog(on_response_ok = on_ok,
|
||||||
|
|
Loading…
Add table
Reference in a new issue