diff frontends/src/quick_frontend/quick_chat.py @ 2057:a52a6ed7d48f

quick frontend (chat): added helping properties avatar and contact_list
author Goffi <goffi@goffi.org>
date Mon, 29 Aug 2016 01:21:47 +0200
parents ed33cd382bf9
children 8fa0d95c2142
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py	Mon Aug 29 01:21:45 2016 +0200
+++ b/frontends/src/quick_frontend/quick_chat.py	Mon Aug 29 01:21:47 2016 +0200
@@ -115,6 +115,11 @@
         time_format = u"%c" if timestamp < self.parent.day_change else u"%H:%M"
         return time.strftime(time_format, timestamp).decode(getlocale()[1])
 
+    @property
+    def avatar(self):
+        contact_list = self.host.contact_lists[self.profile]
+        return contact_list.getCache(self.from_jid, "avatar") or self.host.getDefaultAvatar(self.from_jid)
+
     def getNick(self, entity):
         """Return nick of an entity when possible"""
         contact_list = self.host.contact_lists[self.profile]
@@ -241,6 +246,10 @@
         if self.subject is not None:
             self.setSubject(self.subject)
 
+    @property
+    def contact_list(self):
+        return self.host.contact_lists[self.profile]
+
     ## Widget management ##
 
     def __str__(self):