changeset 807:0576fec37be0

browser_side (chat): adapt printMessage to recent modifications done in quick_chat
author souliane <souliane@mailoo.org>
date Tue, 15 Dec 2015 19:35:00 +0100
parents cab7bf950fa0
children 9e1e6d5241f9
files src/browser/sat_browser/chat.py
diffstat 1 files changed, 3 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/chat.py	Tue Dec 15 18:33:10 2015 +0100
+++ b/src/browser/sat_browser/chat.py	Tue Dec 15 19:35:00 2015 +0100
@@ -56,11 +56,7 @@
 
 class ChatText(HTMLPanel):
 
-    def __init__(self, nick, mymess, msg, extra):
-        try:
-            timestamp = float(extra['timestamp'])
-        except KeyError:
-            timestamp=None
+    def __init__(self, timestamp, nick, mymess, msg, extra):
         xhtml = extra.get('xhtml')
         _date = datetime.fromtimestamp(float(timestamp or time()))
         _msg_class = ["chat_text_msg"]
@@ -243,15 +239,10 @@
         self.content.add(_wid)
         self.content_scroll.scrollToBottom()
 
-    def printMessage(self, from_jid, msg, extra=None, profile=C.PROF_KEY_NONE):
+    def printMessage(self, nick, my_message, message, timestamp, extra=None, profile=C.PROF_KEY_NONE):
         if extra is None:
             extra = {}
-        try:
-            nick, mymess = QuickChat.printMessage(self, from_jid, msg, extra, profile)
-        except TypeError:
-            # None is returned, the message is managed
-            return
-        self.content.add(ChatText(nick, mymess, msg, extra))
+        self.content.add(ChatText(timestamp, nick, my_message, message, extra))
         self.content_scroll.scrollToBottom()
 
     def setTitle(self, title=None, extra=None):