quick frontend (chat): added helping properties avatar and contact_list
This commit is contained in:
parent
948c569dfe
commit
619f892de0
1 changed files with 9 additions and 0 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue