fix behaviour when we remove a contact for which we have a chat tab opened (re-add it to not in roster group). Fixes #7078
This commit is contained in:
parent
ba61066c2f
commit
72bca44272
2 changed files with 31 additions and 28 deletions
|
@ -865,7 +865,7 @@ class ConnectionHandlersBase:
|
||||||
elif obj.contact.show in statuss:
|
elif obj.contact.show in statuss:
|
||||||
obj.old_show = statuss.index(obj.contact.show)
|
obj.old_show = statuss.index(obj.contact.show)
|
||||||
if (resources != [''] and (len(obj.contact_list) != 1 or \
|
if (resources != [''] and (len(obj.contact_list) != 1 or \
|
||||||
obj.contact_list[0].show != 'offline')) and \
|
obj.contact_list[0].show not in ('not in roster', 'offline'))) and \
|
||||||
not gajim.jid_is_transport(jid):
|
not gajim.jid_is_transport(jid):
|
||||||
# Another resource of an existing contact connected
|
# Another resource of an existing contact connected
|
||||||
obj.old_show = 0
|
obj.old_show = 0
|
||||||
|
|
|
@ -726,17 +726,9 @@ class RosterWindow:
|
||||||
if not contact:
|
if not contact:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not force and (self.contact_has_pending_roster_events(contact,
|
if not force and self.contact_has_pending_roster_events(contact,
|
||||||
account) or gajim.interface.msg_win_mgr.get_control(jid, account)):
|
account):
|
||||||
# Contact has pending events or window
|
return False
|
||||||
#TODO: or single message windows? Bur they are not listed for the
|
|
||||||
# moment
|
|
||||||
key = (jid, account)
|
|
||||||
if not key in self.contacts_to_be_removed:
|
|
||||||
self.contacts_to_be_removed[key] = {'backend': backend}
|
|
||||||
# if more pending event, don't remove from roster
|
|
||||||
if self.contact_has_pending_roster_events(contact, account):
|
|
||||||
return False
|
|
||||||
|
|
||||||
iters = self._get_contact_iter(jid, account, contact, self.model)
|
iters = self._get_contact_iter(jid, account, contact, self.model)
|
||||||
if iters:
|
if iters:
|
||||||
|
@ -749,25 +741,36 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
self._remove_entity(contact, account)
|
self._remove_entity(contact, account)
|
||||||
|
|
||||||
if backend and (not gajim.interface.msg_win_mgr.get_control(jid,
|
old_grps = []
|
||||||
account) or force):
|
if backend:
|
||||||
# If a window is still opened: don't remove contact instance
|
if not gajim.interface.msg_win_mgr.get_control(jid, account) or \
|
||||||
# Remove contact before redrawing, otherwise the old
|
force:
|
||||||
# numbers will still be show
|
# If a window is still opened: don't remove contact instance
|
||||||
gajim.contacts.remove_jid(account, jid, remove_meta=True)
|
# Remove contact before redrawing, otherwise the old
|
||||||
if iters:
|
# numbers will still be show
|
||||||
rest_of_family = [data for data in family
|
gajim.contacts.remove_jid(account, jid, remove_meta=True)
|
||||||
if account != data['account'] or jid != data['jid']]
|
if iters:
|
||||||
if rest_of_family:
|
rest_of_family = [data for data in family
|
||||||
# reshow the rest of the family
|
if account != data['account'] or jid != data['jid']]
|
||||||
brothers = self._add_metacontact_family(rest_of_family,
|
if rest_of_family:
|
||||||
account)
|
# reshow the rest of the family
|
||||||
for c, acc in brothers:
|
brothers = self._add_metacontact_family(rest_of_family,
|
||||||
self.draw_completely(c.jid, acc)
|
account)
|
||||||
|
for c, acc in brothers:
|
||||||
|
self.draw_completely(c.jid, acc)
|
||||||
|
else:
|
||||||
|
for c in gajim.contacts.get_contacts(account, jid):
|
||||||
|
c.sub = 'none'
|
||||||
|
c.show = 'not in roster'
|
||||||
|
c.status = ''
|
||||||
|
old_grps = c.get_shown_groups()
|
||||||
|
c.groups = [_('Not in Roster')]
|
||||||
|
self._add_entity(c, account)
|
||||||
|
self.draw_contact(jid, account)
|
||||||
|
|
||||||
if iters:
|
if iters:
|
||||||
# Draw all groups of the contact
|
# Draw all groups of the contact
|
||||||
for group in contact.get_shown_groups():
|
for group in contact.get_shown_groups() + old_grps:
|
||||||
self.draw_group(group, account)
|
self.draw_group(group, account)
|
||||||
self.draw_account(account)
|
self.draw_account(account)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue