quick_frontend (chat): scroll down after having printed the history

This commit is contained in:
souliane 2015-12-22 11:43:02 +01:00
commit 87bd260149

View file

@ -194,6 +194,10 @@ class QuickChat(quick_widgets.QuickWidget):
chat_widget = self.getOrCreatePrivateWidget(target)
chat_widget.newMessage(from_jid, target, msg, type_, extra, profile)
return
try:
timestamp = float(extra['timestamp'])
except KeyError:
timestamp = None
if type_ == C.MESS_TYPE_INFO:
self.printInfo(msg, extra=extra)
else:
@ -203,11 +207,9 @@ class QuickChat(quick_widgets.QuickWidget):
else:
# my_message is True if message comes from local user
my_message = (from_jid.resource == self.nick) if self.type == C.CHAT_GROUP else (from_jid.bare == self.host.profiles[profile].whoami.bare)
try:
timestamp = float(extra['timestamp'])
except KeyError:
timestamp = None
self.printMessage(nick, my_message, msg, timestamp, extra, profile)
if timestamp:
self.afterHistoryPrint()
def printMessage(self, nick, my_message, message, timestamp, extra=None, profile=C.PROF_KEY_NONE):
"""Print message in chat window.