comparison sat_frontends/quick_frontend/quick_chat.py @ 2580:5e54afd17321

quick frontend (chat): added a property to Message which is True when message comes from history
author Goffi <goffi@goffi.org>
date Thu, 10 May 2018 08:34:44 +0200
parents 26edcf3a30eb
children 56f94936df1e
comparison
equal deleted inserted replaced
2579:787b15d16347 2580:5e54afd17321
88 return self._mention 88 return self._mention
89 except AttributeError: 89 except AttributeError:
90 return False 90 return False
91 91
92 @property 92 @property
93 def history(self):
94 """True if message come from history"""
95 return self.extra.get('history', False)
96
97 @property
93 def main_message(self): 98 def main_message(self):
94 """currently displayed message""" 99 """currently displayed message"""
95 if self.parent.lang in self.message: 100 if self.parent.lang in self.message:
96 self.selected_lang = self.parent.lang 101 self.selected_lang = self.parent.lang
97 return self.message[self.parent.lang] 102 return self.message[self.parent.lang]
469 from_jid = jid.JID(from_jid) 474 from_jid = jid.JID(from_jid)
470 to_jid = jid.JID(to_jid) 475 to_jid = jid.JID(to_jid)
471 # if ((self.type == C.CHAT_GROUP and type_ != C.MESS_TYPE_GROUPCHAT) or 476 # if ((self.type == C.CHAT_GROUP and type_ != C.MESS_TYPE_GROUPCHAT) or
472 # (self.type == C.CHAT_ONE2ONE and type_ == C.MESS_TYPE_GROUPCHAT)): 477 # (self.type == C.CHAT_ONE2ONE and type_ == C.MESS_TYPE_GROUPCHAT)):
473 # continue 478 # continue
479 extra['history'] = True
474 self.messages[uid] = Message(self, uid, timestamp, from_jid, to_jid, message, subject, type_, extra, profile) 480 self.messages[uid] = Message(self, uid, timestamp, from_jid, to_jid, message, subject, type_, extra, profile)
475 self._onHistoryPrinted() 481 self._onHistoryPrinted()
476 482
477 def _historyGetEb(err): 483 def _historyGetEb(err):
478 log.error(_(u"Can't get history: {}").format(err)) 484 log.error(_(u"Can't get history: {}").format(err))