do not take into account offline resources in vcard / roster and tooltips. They may stay here if they are awaiting events.

This commit is contained in:
Yann Leboulanger 2006-10-15 21:47:35 +00:00
parent 5b600300fd
commit fe5407907a
2 changed files with 23 additions and 5 deletions

View File

@ -471,8 +471,12 @@ class RosterWindow:
return return
name = gtkgui_helpers.escape_for_pango_markup(contact.get_shown_name()) name = gtkgui_helpers.escape_for_pango_markup(contact.get_shown_name())
if len(contact_instances) > 1: nb_connected_contact = 0
name += ' (' + unicode(len(contact_instances)) + ')' for c in contact_instances:
if c.show not in ('error', 'offline'):
nb_connected_contact += 1
if nb_connected_contact > 1:
name += ' (' + unicode(nb_connected_contact) + ')'
# show (account_name) if there are 2 contact with same jid in merged mode # show (account_name) if there are 2 contact with same jid in merged mode
if self.regroup: if self.regroup:
@ -1175,8 +1179,15 @@ class RosterWindow:
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]: if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
self.tooltip.id = row self.tooltip.id = row
contacts = gajim.contacts.get_contact(account, jid) contacts = gajim.contacts.get_contact(account, jid)
connected_contacts = []
for c in contacts:
if c.show not in ('offline', 'error'):
connected_contacts.append(c)
if not connected_contacts:
# no connected contacts, show the ofline one
connected_contacts = contacts
self.tooltip.timeout = gobject.timeout_add(500, self.tooltip.timeout = gobject.timeout_add(500,
self.show_tooltip, contacts) self.show_tooltip, connected_contacts)
elif model[iter][C_TYPE] == 'account': elif model[iter][C_TYPE] == 'account':
# we're on an account entry in the roster # we're on an account entry in the roster
account = model[iter][C_ACCOUNT].decode('utf-8') account = model[iter][C_ACCOUNT].decode('utf-8')

View File

@ -213,11 +213,18 @@ class VcardWindow:
if self.xml.get_widget('information_notebook').get_n_pages() < 4: if self.xml.get_widget('information_notebook').get_n_pages() < 4:
return return
contact_list = gajim.contacts.get_contact(self.account, self.contact.jid) contact_list = gajim.contacts.get_contact(self.account, self.contact.jid)
connected_contact_list = []
for c in contact_list:
if c.show not in ('offline', 'error'):
connected_contact_list.append(c)
if not connected_contact_list:
# no connected contact, get the offline one
connected_contact_list = contact_list
# stats holds show and status message # stats holds show and status message
stats = '' stats = ''
one = True # Are we adding the first line ? one = True # Are we adding the first line ?
if contact_list: if connected_contact_list:
for c in contact_list: for c in connected_contact_list:
if not one: if not one:
stats += '\n' stats += '\n'
stats += helpers.get_uf_show(c.show) stats += helpers.get_uf_show(c.show)