changeset 47f4f35af77c in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=47f4f35af77c
description: 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
diffstat:
src/common/connection_handlers.py | 2 +-
src/roster_window.py | 57 ++++++++++++++++++++------------------
2 files changed, 31 insertions(+), 28 deletions(-)
diffs (89 lines):
diff -r 79296520f295 -r 47f4f35af77c src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Sat Jan 21 09:17:09 2012 +0100
+++ b/src/common/connection_handlers.py Sat Jan 21 16:32:52 2012 +0100
@@ -865,7 +865,7 @@
elif obj.contact.show in statuss:
obj.old_show = statuss.index(obj.contact.show)
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):
# Another resource of an existing contact connected
obj.old_show = 0
diff -r 79296520f295 -r 47f4f35af77c src/roster_window.py
--- a/src/roster_window.py Sat Jan 21 09:17:09 2012 +0100
+++ b/src/roster_window.py Sat Jan 21 16:32:52 2012 +0100
@@ -726,17 +726,9 @@
if not contact:
return
- if not force and (self.contact_has_pending_roster_events(contact,
- account) or gajim.interface.msg_win_mgr.get_control(jid, account)):
- # Contact has pending events or window
- #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
+ if not force and self.contact_has_pending_roster_events(contact,
+ account):
+ return False
iters = self._get_contact_iter(jid, account, contact, self.model)
if iters:
@@ -749,25 +741,36 @@
else:
self._remove_entity(contact, account)
- if backend and (not gajim.interface.msg_win_mgr.get_control(jid,
- account) or force):
- # If a window is still opened: don't remove contact instance
- # Remove contact before redrawing, otherwise the old
- # numbers will still be show
- gajim.contacts.remove_jid(account, jid, remove_meta=True)
- if iters:
- rest_of_family = [data for data in family
- if account != data['account'] or jid != data['jid']]
- if rest_of_family:
- # reshow the rest of the family
- brothers = self._add_metacontact_family(rest_of_family,
- account)
- for c, acc in brothers:
- self.draw_completely(c.jid, acc)
+ old_grps = []
+ if backend:
+ if not gajim.interface.msg_win_mgr.get_control(jid, account) or \
+ force:
+ # If a window is still opened: don't remove contact instance
+ # Remove contact before redrawing, otherwise the old
+ # numbers will still be show
+ gajim.contacts.remove_jid(account, jid, remove_meta=True)
+ if iters:
+ rest_of_family = [data for data in family
+ if account != data['account'] or jid != data['jid']]
+ if rest_of_family:
+ # reshow the rest of the family
+ brothers = self._add_metacontact_family(rest_of_family,
+ 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:
# 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_account(account)
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits