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)
This commit is contained in:
Goffi 2011-12-04 16:18:56 +01:00
commit 53f1b5fcce

View file

@ -84,21 +84,18 @@ class QuickChat():
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"""