don't remove contact when there is pending events on another resource. Fixes #4350
This commit is contained in:
parent
82c8516c0b
commit
87edbb8dd8
3 changed files with 7 additions and 8 deletions
|
@ -2188,7 +2188,8 @@ class ChatControl(ChatControlBase):
|
|||
# Remove contact instance if contact has been removed
|
||||
key = (self.contact.jid, self.account)
|
||||
roster = gajim.interface.roster
|
||||
if key in roster.contacts_to_be_removed.keys():
|
||||
if key in roster.contacts_to_be_removed.keys() and \
|
||||
not roster.contact_has_pending_roster_events(self.contact, self.account):
|
||||
backend = roster.contacts_to_be_removed[key]['backend']
|
||||
del roster.contacts_to_be_removed[key]
|
||||
roster.remove_contact(self.contact.jid, self.account, force=True,
|
||||
|
|
10
src/gajim.py
10
src/gajim.py
|
@ -1476,7 +1476,7 @@ class Interface:
|
|||
not name and not groups:
|
||||
# contact removes us.
|
||||
if contacts:
|
||||
self.roster.remove_contact(jid, account, force=True, backend=True)
|
||||
self.roster.remove_contact(jid, account, backend=True)
|
||||
return
|
||||
elif not contacts:
|
||||
if sub == 'remove':
|
||||
|
@ -1488,7 +1488,7 @@ class Interface:
|
|||
self.roster.add_contact(jid, account)
|
||||
else:
|
||||
# it is an existing contact that might has changed
|
||||
re_add = False
|
||||
re_draw = False
|
||||
# if sub or groups changed: remove and re-add
|
||||
# Maybe observer status changed:
|
||||
# according to xep 0162, contact is not an observer anymore when
|
||||
|
@ -1496,8 +1496,7 @@ class Interface:
|
|||
old_groups = contacts[0].get_shown_groups()
|
||||
if contacts[0].sub != sub or contacts[0].ask != ask\
|
||||
or old_groups != groups:
|
||||
self.roster.remove_contact(jid, account, force=True)
|
||||
re_add = True
|
||||
re_draw = True
|
||||
for contact in contacts:
|
||||
if not name:
|
||||
name = ''
|
||||
|
@ -1505,8 +1504,7 @@ class Interface:
|
|||
contact.sub = sub
|
||||
contact.ask = ask
|
||||
contact.groups = groups or []
|
||||
if re_add:
|
||||
self.roster.add_contact(jid, account)
|
||||
if re_draw:
|
||||
# Refilter and update old groups
|
||||
for group in old_groups:
|
||||
self.roster.draw_group(group, account)
|
||||
|
|
|
@ -2003,7 +2003,7 @@ class RosterWindow:
|
|||
|
||||
# Remove resource when going offline
|
||||
if show in ('offline', 'error') and \
|
||||
len(gajim.events.get_events(account, fjid)) == 0:
|
||||
not self.contact_has_pending_roster_events(contact, account):
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(fjid, account)
|
||||
if ctrl:
|
||||
ctrl.update_ui()
|
||||
|
|
Loading…
Add table
Reference in a new issue