show our server in roster when we get a message from it, and hide it if show_transports_group is False. Fixes #2568

This commit is contained in:
Yann Leboulanger 2006-10-17 12:31:16 +00:00
parent 4500643eaf
commit fafa2d0c0a
3 changed files with 12 additions and 8 deletions

View File

@ -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':

View File

@ -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)

View File

@ -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)