comparison src/memory/sqlite.py @ 1222:e6e0ea4dc835

memory: add Parameter "Chat history limit"
author souliane <souliane@mailoo.org>
date Wed, 24 Sep 2014 13:49:43 +0200
parents 5e5661ab5c81
children f0c9b149ed99
comparison
equal deleted inserted replaced
1221:5e5661ab5c81 1222:e6e0ea4dc835
263 d.addErrback(lambda ignore: log.error(_("Can't save following message in history: from [%(from_jid)s] to [%(to_jid)s] ==> [%(message)s]" % 263 d.addErrback(lambda ignore: log.error(_("Can't save following message in history: from [%(from_jid)s] to [%(to_jid)s] ==> [%(message)s]" %
264 {"from_jid": from_jid.full(), "to_jid": to_jid.full(), "message": message}))) 264 {"from_jid": from_jid.full(), "to_jid": to_jid.full(), "message": message})))
265 return d 265 return d
266 266
267 def getHistory(self, from_jid, to_jid, limit=None, between=True, profile=None): 267 def getHistory(self, from_jid, to_jid, limit=None, between=True, profile=None):
268 """Store a new message in history 268 """Retrieve messages in history
269 @param from_jid: source JID (full, or bare for catchall 269 @param from_jid (JID): source JID (full, or bare for catchall)
270 @param to_jid: dest JID (full, or bare for catchall 270 @param to_jid (JID): dest JID (full, or bare for catchall)
271 @param size: maximum number of messages to get, or None for unlimited 271 @param limit (int): maximum number of messages to get:
272 - 0 for no message (returns the empty list)
273 - None for unlimited
274 @param between (bool): confound source and dest (ignore the direction)
275 @param profile (str): %(doc_profile)s
276 @return: list of tuple as in http://wiki.goffi.org/wiki/Bridge_API#getHistory
272 """ 277 """
273 assert(profile) 278 assert(profile)
274 if limit == 0: 279 if limit == 0:
275 return defer.succeed([]) 280 return defer.succeed([])
276 281