changeset 1763:9b557e76a5a8

quick_frontend (chat): scroll down after having printed the history
author souliane <souliane@mailoo.org>
date Tue, 22 Dec 2015 11:43:02 +0100
parents 2e2fb462729a
children 33c815c17fe6
files frontends/src/quick_frontend/quick_chat.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py	Tue Dec 22 11:39:45 2015 +0100
+++ b/frontends/src/quick_frontend/quick_chat.py	Tue Dec 22 11:43:02 2015 +0100
@@ -194,6 +194,10 @@
             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 @@
             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.