Mercurial > libervia-web
diff src/browser/sat_browser/panels.py @ 518:3d8e8f693576
browser_side: avoid some confusions between jid object 1. as an instance of JID or 2. as a str
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 02 Sep 2014 21:13:59 +0200 |
parents | db3436c85fb1 |
children | d2bf317b2d28 |
line wrap: on
line diff
--- a/src/browser/sat_browser/panels.py Tue Sep 02 21:08:59 2014 +0200 +++ b/src/browser/sat_browser/panels.py Tue Sep 02 21:13:59 2014 +0200 @@ -1253,12 +1253,12 @@ day_format = "%A, %d %b %Y" previous_day = datetime.now().strftime(day_format) for line in history: - timestamp, from_jid, to_jid, message, mess_type, extra = line + timestamp, from_jid_s, to_jid_s, message, mess_type, extra = line message_day = datetime.fromtimestamp(float(timestamp or time())).strftime(day_format) if previous_day != message_day: self.printInfo("* " + message_day) previous_day = message_day - self.printMessage(from_jid, message, extra, timestamp) + self.printMessage(jid.JID(from_jid_s), message, extra, timestamp) self.host.bridge.call('getHistory', getHistoryCB, self.host.whoami.bare, self.target.bare, size, True) def printInfo(self, msg, type_='normal', link_cb=None): @@ -1285,9 +1285,8 @@ def printMessage(self, from_jid, msg, extra, timestamp=None): """Print message in chat window. Must be implemented by child class""" - _jid = jid.JID(from_jid) - nick = _jid.node if self.type == 'one2one' else _jid.resource - mymess = _jid.resource == self.nick if self.type == "group" else _jid.bare == self.host.whoami.bare # mymess = True if message comes from local user + nick = from_jid.node if self.type == 'one2one' else from_jid.resource + mymess = from_jid.resource == self.nick if self.type == "group" else from_jid.bare == self.host.whoami.bare # mymess = True if message comes from local user if msg.startswith('/me '): self.printInfo('* %s %s' % (nick, msg[4:]), type_='me') return