implement observer group of JEP 0162. fixes #1328

This commit is contained in:
Yann Leboulanger 2006-01-10 18:34:23 +00:00
parent d2ab3031f1
commit 83e7c0daa9

View file

@ -157,6 +157,7 @@ class RosterWindow:
# if not '@' or '@' starts the jid ==> agent # if not '@' or '@' starts the jid ==> agent
contact.groups = [_('Transports')] contact.groups = [_('Transports')]
# JEP-0162
hide = True hide = True
if contact.sub in ('both', 'to'): if contact.sub in ('both', 'to'):
hide = False hide = False
@ -165,10 +166,11 @@ class RosterWindow:
elif contact.name or len(contact.groups): elif contact.name or len(contact.groups):
hide = False hide = False
# JEP-0162 observer = False
if hide: if hide and contact.sub == 'from':
return observer = True
if contact.show in ('offline', 'error') and \
if (contact.show in ('offline', 'error') or hide) and \
not showOffline and (not _('Transports') in contact.groups or \ not showOffline and (not _('Transports') in contact.groups or \
gajim.connections[account].connected < 2) and \ gajim.connections[account].connected < 2) and \
not gajim.awaiting_events[account].has_key(jid): not gajim.awaiting_events[account].has_key(jid):
@ -176,6 +178,8 @@ class RosterWindow:
model = self.tree.get_model() model = self.tree.get_model()
groups = contact.groups groups = contact.groups
if observer:
groups = [_('Observer')]
if not groups: if not groups:
groups = [_('General')] groups = [_('General')]
for g in groups: for g in groups: