From 619f892de0c961f438b4bc810f60c23fe927ccb2 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 29 Aug 2016 01:21:47 +0200 Subject: [PATCH] quick frontend (chat): added helping properties avatar and contact_list --- frontends/src/quick_frontend/quick_chat.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontends/src/quick_frontend/quick_chat.py b/frontends/src/quick_frontend/quick_chat.py index 0f41dc4f..08558dc8 100644 --- a/frontends/src/quick_frontend/quick_chat.py +++ b/frontends/src/quick_frontend/quick_chat.py @@ -115,6 +115,11 @@ class Message(object): 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 @@ class QuickChat(quick_widgets.QuickWidget): 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):