Mercurial > libervia-backend
diff src/memory/memory.py @ 2013:b536dd121da1
backend (memory), frontends: improved history filtering:
a "filters" dictionnary is now use to filter, it can have, for now, filtering on:
- "body": filter only on the body (equivalent to former "search" parameter, but not case sensitive)
- "search": fitler on body + source resource
- "types": allowed types
- "not_types": forbidden types
primitivus now do searching using "search", i.e. source resource is now taken into account (and search is now case insensitive)
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 18 Jul 2016 00:52:02 +0200 |
parents | 200cd707a46d |
children | d44efd32bc2f |
line wrap: on
line diff
--- a/src/memory/memory.py Sun Jul 17 19:44:15 2016 +0200 +++ b/src/memory/memory.py Mon Jul 18 00:52:02 2016 +0200 @@ -513,10 +513,10 @@ def addToHistory(self, client, data): return self.storage.addToHistory(data, client.profile) - def _historyGet(self, from_jid_s, to_jid_s, limit=C.HISTORY_LIMIT_NONE, between=True, search=None, profile=C.PROF_KEY_NONE): - return self.historyGet(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between, search, profile) + def _historyGet(self, from_jid_s, to_jid_s, limit=C.HISTORY_LIMIT_NONE, between=True, filters=None, profile=C.PROF_KEY_NONE): + return self.historyGet(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between, filters, profile) - def historyGet(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True, search=None, profile=C.PROF_KEY_NONE): + def historyGet(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True, filters=None, profile=C.PROF_KEY_NONE): """Retrieve messages in history @param from_jid (JID): source JID (full, or bare for catchall) @@ -526,7 +526,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 filters (str): pattern to filter the history results (see bridge API for details) @param profile (str): %(doc_profile)s @return (D(list)): list of message data as in [messageNew] """ @@ -537,7 +537,7 @@ limit = None if limit == 0: return defer.succeed([]) - return self.storage.historyGet(from_jid, to_jid, limit, between, search, profile) + return self.storage.historyGet(from_jid, to_jid, limit, between, filters, profile) ## Statuses ##