comparison 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
comparison
equal deleted inserted replaced
212:a05e16f4a343 213:8bbac49765d6
658 self.printInfo("<= %s has left the room" % nick) 658 self.printInfo("<= %s has left the room" % nick)
659 659
660 def historyPrint(self, size=20): 660 def historyPrint(self, size=20):
661 """Print the initial history""" 661 """Print the initial history"""
662 def getHistoryCB(history): 662 def getHistoryCB(history):
663 # display day change
664 day_format = "%A, %d %b %Y"
665 previous_day = datetime.now().strftime(day_format)
663 for line in history: 666 for line in history:
664 timestamp, from_jid, to_jid, message, mess_type = line 667 timestamp, from_jid, to_jid, message, mess_type = line
668 message_day = datetime.fromtimestamp(float(timestamp or time())).strftime(day_format)
669 if previous_day != message_day:
670 self.printInfo("* " + message_day)
671 previous_day = message_day
665 self.printMessage(from_jid, message, timestamp) 672 self.printMessage(from_jid, message, timestamp)
666 self.host.bridge.call('getHistory', getHistoryCB, self.host.whoami.bare, self.target.bare, size, True) 673 self.host.bridge.call('getHistory', getHistoryCB, self.host.whoami.bare, self.target.bare, size, True)
667 674
668 def printInfo(self, msg, type='normal'): 675 def printInfo(self, msg, type='normal'):
669 """Print general info 676 """Print general info