From fafa2d0c0a46bae139186cccdb22c25282214292 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 17 Oct 2006 12:31:16 +0000 Subject: [PATCH] show our server in roster when we get a message from it, and hide it if show_transports_group is False. Fixes #2568 --- src/common/contacts.py | 2 ++ src/gajim.py | 12 +++++++----- src/roster_window.py | 6 +++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/common/contacts.py b/src/common/contacts.py index 20ab66f25..7010ed222 100644 --- a/src/common/contacts.py +++ b/src/common/contacts.py @@ -62,6 +62,8 @@ class Contact: def is_hidden_from_roster(self): '''if contact should not be visible in roster''' # XEP-0162: http://www.xmpp.org/extensions/xep-0162.html + if self.is_transport(): + return False if self.sub in ('both', 'to'): return False if self.sub in ('none', 'from') and self.ask == 'subscribe': diff --git a/src/gajim.py b/src/gajim.py index 677a70c8f..25ebf59bc 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1170,11 +1170,13 @@ class Interface: return # no other event? if not len(gajim.events.get_events(account, jid)): - if not gajim.config.get('showoffline'): - contact = gajim.contacts.get_contact_with_highest_priority(account, - jid) - if contact and contact.show in ('error', 'offline'): - self.roster.really_remove_contact(contact, account) + contact = gajim.contacts.get_contact_with_highest_priority(account, + jid) + show_transport = gajim.config.get('show_transports_group') + if contact and (contact.show in ('error', 'offline') and \ + not gajim.config.get('showoffline') or ( + gajim.jid_is_transport(jid) and not show_transport)): + self.roster.really_remove_contact(contact, account) self.roster.show_title() self.roster.draw_contact(jid, account) diff --git a/src/roster_window.py b/src/roster_window.py index 652ec61d2..6e5b75c23 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -394,9 +394,9 @@ class RosterWindow: show_offline = gajim.config.get('showoffline') show_transports = gajim.config.get('show_transports_group') - if (contact.show in ('offline', 'error') or hide) and \ - (_('Transports') in contact.groups and not show_transports) or \ - (not show_offline and (not _('Transports') in contact.groups or \ + if (_('Transports') in contact.groups and not show_transports) or \ + (contact.show in ('offline', 'error') or hide and not show_offline and \ + (not _('Transports') in contact.groups or \ gajim.account_is_disconnected(account))) and \ len(gajim.events.get_events(account, contact.jid, ['chat'])) == 0: self.remove_contact(contact, account)