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
|
# Remove contact instance if contact has been removed
|
||||||
key = (self.contact.jid, self.account)
|
key = (self.contact.jid, self.account)
|
||||||
roster = gajim.interface.roster
|
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']
|
backend = roster.contacts_to_be_removed[key]['backend']
|
||||||
del roster.contacts_to_be_removed[key]
|
del roster.contacts_to_be_removed[key]
|
||||||
roster.remove_contact(self.contact.jid, self.account, force=True,
|
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:
|
not name and not groups:
|
||||||
# contact removes us.
|
# contact removes us.
|
||||||
if contacts:
|
if contacts:
|
||||||
self.roster.remove_contact(jid, account, force=True, backend=True)
|
self.roster.remove_contact(jid, account, backend=True)
|
||||||
return
|
return
|
||||||
elif not contacts:
|
elif not contacts:
|
||||||
if sub == 'remove':
|
if sub == 'remove':
|
||||||
|
@ -1488,7 +1488,7 @@ class Interface:
|
||||||
self.roster.add_contact(jid, account)
|
self.roster.add_contact(jid, account)
|
||||||
else:
|
else:
|
||||||
# it is an existing contact that might has changed
|
# it is an existing contact that might has changed
|
||||||
re_add = False
|
re_draw = False
|
||||||
# if sub or groups changed: remove and re-add
|
# if sub or groups changed: remove and re-add
|
||||||
# Maybe observer status changed:
|
# Maybe observer status changed:
|
||||||
# according to xep 0162, contact is not an observer anymore when
|
# according to xep 0162, contact is not an observer anymore when
|
||||||
|
@ -1496,8 +1496,7 @@ class Interface:
|
||||||
old_groups = contacts[0].get_shown_groups()
|
old_groups = contacts[0].get_shown_groups()
|
||||||
if contacts[0].sub != sub or contacts[0].ask != ask\
|
if contacts[0].sub != sub or contacts[0].ask != ask\
|
||||||
or old_groups != groups:
|
or old_groups != groups:
|
||||||
self.roster.remove_contact(jid, account, force=True)
|
re_draw = True
|
||||||
re_add = True
|
|
||||||
for contact in contacts:
|
for contact in contacts:
|
||||||
if not name:
|
if not name:
|
||||||
name = ''
|
name = ''
|
||||||
|
@ -1505,8 +1504,7 @@ class Interface:
|
||||||
contact.sub = sub
|
contact.sub = sub
|
||||||
contact.ask = ask
|
contact.ask = ask
|
||||||
contact.groups = groups or []
|
contact.groups = groups or []
|
||||||
if re_add:
|
if re_draw:
|
||||||
self.roster.add_contact(jid, account)
|
|
||||||
# Refilter and update old groups
|
# Refilter and update old groups
|
||||||
for group in old_groups:
|
for group in old_groups:
|
||||||
self.roster.draw_group(group, account)
|
self.roster.draw_group(group, account)
|
||||||
|
|
|
@ -2003,7 +2003,7 @@ 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, fjid)) == 0:
|
not self.contact_has_pending_roster_events(contact, account):
|
||||||
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()
|
||||||
|
|
Loading…
Add table
Reference in a new issue