bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern)
This commit is contained in:
parent
7a344fcf5d
commit
767f3d50dc
6 changed files with 22 additions and 13 deletions
|
|
@ -350,7 +350,7 @@ class Memory(object):
|
|||
extra = {}
|
||||
return self.storage.addToHistory(from_jid, to_jid, message, type_, extra, timestamp, profile)
|
||||
|
||||
def getHistory(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True, profile=C.PROF_KEY_NONE):
|
||||
def getHistory(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True, search=None, profile=C.PROF_KEY_NONE):
|
||||
"""Retrieve messages in history
|
||||
@param from_jid (JID): source JID (full, or bare for catchall)
|
||||
@param to_jid (JID): dest JID (full, or bare for catchall)
|
||||
|
|
@ -359,6 +359,7 @@ class Memory(object):
|
|||
- C.HISTORY_LIMIT_NONE or None for unlimited
|
||||
- C.HISTORY_LIMIT_DEFAULT to use the HISTORY_LIMIT parameter value
|
||||
@param between (bool): confound source and dest (ignore the direction)
|
||||
@param search (str): pattern to filter the history results
|
||||
@param profile (str): %(doc_profile)s
|
||||
@return: list of tuple as in http://wiki.goffi.org/wiki/Bridge_API#getHistory
|
||||
"""
|
||||
|
|
@ -369,7 +370,7 @@ class Memory(object):
|
|||
limit = None
|
||||
if limit == 0:
|
||||
return defer.succeed([])
|
||||
return self.storage.getHistory(jid.JID(from_jid), jid.JID(to_jid), limit, between, profile)
|
||||
return self.storage.getHistory(jid.JID(from_jid), jid.JID(to_jid), limit, between, search, profile)
|
||||
|
||||
def _getLastResource(self, jid_s, profile_key):
|
||||
jid_ = jid.JID(jid_s)
|
||||
|
|
|
|||
Loading…
Reference in a new issue