Mercurial > libervia-backend
diff src/memory/memory.py @ 1224:f0c9b149ed99
bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern)
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 04 Oct 2014 10:25:32 +0200 |
parents | e6e0ea4dc835 |
children | 9c17bd37e6e5 |
line wrap: on
line diff
--- a/src/memory/memory.py Sat Oct 04 10:23:13 2014 +0200 +++ b/src/memory/memory.py Sat Oct 04 10:25:32 2014 +0200 @@ -350,7 +350,7 @@ 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 @@ - 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 @@ 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)