diff frontends/src/quick_frontend/quick_chat.py @ 448:17c7e48bf68f

core: - history management improved - better timestamp precision for history bridge + core: history signature change (now return a list instead of a dict, and timestamp is now float) quick_frontend: - use of new history API - removed deprecated keep_last argument in getHistory (was only used by Sortilège)
author Goffi <goffi@goffi.org>
date Sun, 04 Dec 2011 16:18:56 +0100
parents e4e9187e3b5b
children cf005701624b
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py	Sun Dec 04 00:58:20 2011 +0100
+++ b/frontends/src/quick_frontend/quick_chat.py	Sun Dec 04 16:18:56 2011 +0100
@@ -84,21 +84,18 @@
             error (_("[INTERNAL] trying to set subject for a non group chat window"))
             raise Exception("INTERNAL ERROR") #TODO: raise proper Exception here
 
-    def historyPrint(self, size=20, keep_last=False, profile='@NONE@'):
+    def historyPrint(self, size=20, profile='@NONE@'):
         """Print the initial history"""
         debug (_("now we print history"))
         def onHistory(history):
-            stamps=history.keys()
-            stamps.sort()
-            for stamp in stamps: 
-                from_jid, to_jid, message = history[stamp]
-                self.printMessage(JID(from_jid), message, profile, stamp)
-            if keep_last:  ##FIXME hack for sortilege
-                self.last_history = stamps[-1] if stamps else None
+            for line in history: 
+                timestamp, from_jid, to_jid, message = line
+                self.printMessage(JID(from_jid), message, profile, timestamp)
+                    
         def onHistoryError(err):
             error (_("Can't get history"))
 
-        history=self.host.bridge.getHistory(self.host.profiles[profile]['whoami'].short, self.target.short, 20, callback=onHistory, errback=onHistoryError)
+        self.host.bridge.getHistory(self.host.profiles[profile]['whoami'].short, self.target.short, 20, callback=onHistory, errback=onHistoryError)
 
     def _get_nick(self, jid):
         """Return nick of this jid when possible"""