Mercurial > libervia-web
diff browser_side/panels.py @ 213:8bbac49765d6
browser side: display the day change in chat window
fix bug 36
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 06 Sep 2013 16:07:35 +0200 |
parents | 3092f6b1710c |
children | 7b26be266ab1 |
line wrap: on
line diff
--- a/browser_side/panels.py Fri Sep 06 15:55:45 2013 +0200 +++ b/browser_side/panels.py Fri Sep 06 16:07:35 2013 +0200 @@ -660,8 +660,15 @@ def historyPrint(self, size=20): """Print the initial history""" def getHistoryCB(history): + # display day change + 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 = 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, timestamp) self.host.bridge.call('getHistory', getHistoryCB, self.host.whoami.bare, self.target.bare, size, True)