diff --git a/src/dialogs.py b/src/dialogs.py
index 0671b6850..86699ec86 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -565,41 +565,67 @@ class RosterTooltip(gtk.Window):
self.hide()
self.path = None
- def populate(self, contact, img):
+ def populate(self, contacts, img):
if img:
self.image.set_from_pixbuf(img.get_pixbuf())
else:
self.image.set_from_pixbuf(None)
- info = '' + contact.jid + ''
+ #self.image = img # why this doesn't work? MYSTERY! [maybe I need to sleep]
+ if not contacts or len(contacts) == 0:
+ return
+ # default resource of the contact
+ prim_contact = None # primary contact
+ for contact in contacts:
+ if prim_contact == None or contact.priority > prim_contact.priority:
+ prim_contact = contact
+
+ info = '' + prim_contact.jid + ''
info += '\n' + _('Name: ') + '' + \
- contact.name
+ prim_contact.name
info += '\n' + _('Subscription: ') + '' + \
- contact.sub
- if contact.keyID:
+ prim_contact.sub
+
+ if prim_contact.keyID:
keyID = None
- if len(contact.keyID) == 8:
- keyID = contact.keyID
- elif len(contact.keyID) == 16:
- keyID = contact.keyID[8:]
+ if len(prim_contact.keyID) == 8:
+ keyID = prim_contact.keyID
+ elif len(prim_contact.keyID) == 16:
+ keyID = prim_contact.keyID[8:]
if keyID:
- info += '\n' + _('OpenPGP: ') + '' + \
- keyID
- if contact.resource:
- info += '\n' + _('Resource: ') + '' + \
- contact.resource + ' (' + str(contact.priority) + ')'
- #FIXME: we need the account
-# lcontact = self.plugin.roster.contacts[acct][contact.jid]
-# if len(lcontact) > 1:
-# for c in lcontact:
-# if c == contact:
-# continue
-# info += '\n' + ' ' * len(_('Resource: ')) + \
-# '' + c.resource + ' (' + str(c.priority) + ')'
- if contact.show:
- info += '\n' + _('Status: ') + '' + \
- helpers.get_uf_show(contact.show)
- if contact.status:
- info += ' - ' + contact.status
+ info += '\n' + _('OpenPGP: ') + \
+ '' + keyID
+
+ resource_str, status_str, multiple_resource, multiple_status =\
+ '', '', False, False
+ for contact in contacts:
+ if contact.resource:
+ if resource_str != '':
+ multiple_resource = True
+ resource_str += '\n\t' + contact.resource + \
+ '(' + str(contact.priority) + ')'
+ if contact.show:
+ if status_str != '':
+ multiple_status = True
+ status_str += '\n\t' + helpers.get_uf_show(contact.show)
+ if contact.status:
+ status_str += ' - ' + contact.status
+
+ if resource_str != '':
+ info += '\n' + _('Resource: ') + ''
+ if multiple_resource:
+ info += resource_str
+ else:
+ # show the status on the same line
+ info += resource_str[2:]
+
+ if status_str != '':
+ info += '\n' + _('Status: ') + ''
+ if not multiple_status:
+ # show the resource on the same line
+ info += status_str[2:]
+ else:
+ info += status_str
+
self.account.set_markup(info)
class InputDialog:
diff --git a/src/roster_window.py b/src/roster_window.py
index fb334b9c8..a88ca97dc 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -565,15 +565,11 @@ class RosterWindow:
if model.get_value(iter, 2) == 'contact':
account = model.get_value(iter, 4)
jid = model.get_value(iter, 3)
- contact = None
- for resource in self.contacts[account][jid]:
- if contact == None or resource.priority > contact.priority:
- contact = resource
img = model.get_value(iter, 0)
if self.tooltip.timeout == 0 or self.tooltip.path != props[0]:
self.tooltip.path = row
self.tooltip.timeout = gobject.timeout_add(500,
- self.show_tooltip, contact, img)
+ self.show_tooltip, self.contacts[account][jid], img)
def on_agent_logging(self, widget, jid, state, account):
'''When an agent is requested to log in or off'''