# HG changeset patch # User Goffi # Date 1306423068 -7200 # Node ID 7cabe3c1a5f2116181cd66d6944108c65ac334dc # Parent c3ee630914baffdfcdfee0b233b796e82a557a7e browser side: connected contacts now appear differently diff -r c3ee630914ba -r 7cabe3c1a5f2 browser_side/contact.py --- a/browser_side/contact.py Thu May 26 16:43:30 2011 +0200 +++ b/browser_side/contact.py Thu May 26 17:17:48 2011 +0200 @@ -106,6 +106,21 @@ VerticalPanel.add(self, _item) self.contacts.append(_item) + def setState(self, jid, state): + """Change the appearance of the contact, according to the state + @param jid: jid which need to change state + @param state: 'unavailable' if not connected, else presence like RFC6121 #4.7.2.1""" + _item = None + for contact in self.contacts: + if contact.jid == jid: + _item = contact + break + if _item: + if state == 'unavailable': + _item.removeStyleName('contactConnected') + else: + _item.addStyleName('contactConnected') + class ContactTitleLabel(DragLabel, Label): def __init__(self, text): Label.__init__(self, text) #, Element=DOM.createElement('div') @@ -161,6 +176,7 @@ if not self.connected.has_key(jid): self.connected[jid] = {} self.connected[jid][resource] = (availability, priority, statuses) + self._contactList.setState(jid, availability) def getConnected(self): """return a list of all jid (bare jid) connected""" diff -r c3ee630914ba -r 7cabe3c1a5f2 public/libervia.css --- a/public/libervia.css Thu May 26 16:43:30 2011 +0200 +++ b/public/libervia.css Thu May 26 17:17:48 2011 +0200 @@ -170,6 +170,10 @@ font-size: small; } +.contactConnected { + color: blue; +} + .selected { background-color: yellow; }