If a contact is in 'Not in Roster' group in the roster, see him in systray->chat_with->'Not in Roster'

This commit is contained in:
Jean-Marie Traissard 2006-04-09 14:08:46 +00:00
parent b9c96a195d
commit ba2f6221fb
1 changed files with 11 additions and 7 deletions

View File

@ -271,11 +271,15 @@ class Systray:
# if we sort_by_show : contacts_table = [group, status, name] # if we sort_by_show : contacts_table = [group, status, name]
# else : contacts_table = [group, name, status] # else : contacts_table = [group, name, status]
contacts_table = [] contacts_table = []
show_list = gajim.SHOW_LIST
show_list.append('not in roster') # not in roster is not in this list but we need it
for jid in gajim.contacts.get_jid_list(account): for jid in gajim.contacts.get_jid_list(account):
contact = gajim.contacts.get_contact_with_highest_priority(account, contact = gajim.contacts.get_contact_with_highest_priority(account,
jid) jid)
if contact.show not in ('offline', 'error', 'not in roster'): if contact.show not in ('offline', 'error'):
if contact.groups == []: #user has no group, print him in General if contact.show == 'not in roster': # print user in not in roster group
contact_groups = [_('Not in Roster')]
elif contact.groups == []: # user has no group, print him in General
contact_groups = [_('General')] contact_groups = [_('General')]
else: else:
contact_groups = contact.groups contact_groups = contact.groups
@ -283,11 +287,11 @@ class Systray:
if group == _('Transports'): if group == _('Transports'):
continue continue
if sort_by_show: # see comment about contacts_table above if sort_by_show: # see comment about contacts_table above
contacts_table.append ([group, gajim.SHOW_LIST.index(contact.show), contacts_table.append ([group, show_list.index(contact.show),
contact.get_shown_name()]) contact.get_shown_name()])
else: else:
contacts_table.append ([group, contact.get_shown_name(), contacts_table.appenwd ([group, contact.get_shown_name(),
gajim.SHOW_LIST.index(contact.show)]) show_list.index(contact.show)])
contacts_table.sort() # Sort : first column before, last column in the end contacts_table.sort() # Sort : first column before, last column in the end
@ -295,10 +299,10 @@ class Systray:
for contact_item in contacts_table: for contact_item in contacts_table:
if sort_by_show: # see comment about contacts_table above if sort_by_show: # see comment about contacts_table above
contact_name = contact_item[2] contact_name = contact_item[2]
contact_show = gajim.SHOW_LIST[contact_item[1]] contact_show = show_list[contact_item[1]]
else: else:
contact_name = contact_item[1] contact_name = contact_item[1]
contact_show = gajim.SHOW_LIST[contact_item[2]] contact_show = show_list[contact_item[2]]
if contact_item[0] != previous_group: #It's a new group, add the submenu if contact_item[0] != previous_group: #It's a new group, add the submenu
item = gtk.MenuItem(contact_item[0]) item = gtk.MenuItem(contact_item[0])
contacts_menu = gtk.Menu() contacts_menu = gtk.Menu()