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)
This commit is contained in:
Goffi 2016-07-18 00:52:02 +02:00
commit 9647e90943
2 changed files with 58 additions and 36 deletions

View file

@ -399,10 +399,10 @@ class DbusObject(dbus.service.Object):
return self._callback("getWaitingSub", unicode(profile_key))
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='ssibss', out_signature='a(sdssa{ss}a{ss}sa{ss})',
in_signature='ssiba{ss}s', out_signature='a(sdssa{ss}a{ss}sa{ss})',
async_callbacks=('callback', 'errback'))
def historyGet(self, from_jid, to_jid, limit, between=True, search='', profile="@NONE@", callback=None, errback=None):
return self._callback("historyGet", unicode(from_jid), unicode(to_jid), limit, between, unicode(search), unicode(profile), callback=callback, errback=errback)
def historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@", callback=None, errback=None):
return self._callback("historyGet", unicode(from_jid), unicode(to_jid), limit, between, filters, unicode(profile), callback=callback, errback=errback)
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='b',

View file

@ -591,7 +591,7 @@ doc_param_2=app: name of the frontend registering the parameters
async=
type=method
category=core
sig_in=ssibss
sig_in=ssiba{ss}s
sig_out=a(sdssa{ss}a{ss}sa{ss})
param_3_default=True
param_4_default=''
@ -601,7 +601,11 @@ doc_param_0=from_jid: source JID (bare jid for catch all, full jid else)
doc_param_1=to_jid: dest JID (bare jid for catch all, full jid else)
doc_param_2=limit: max number of history elements to get (0 for the whole history)
doc_param_3=between: True if we want history between the two jids (in both direction), False if we only want messages from from_jid to to_jid
doc_param_4=search: pattern to filter the history results
doc_param_4=filters: patterns to filter the history results, can be:
- body: pattern must be in message body
- search: pattern must be in message body or source resource
- types: type must one of those, values are separated by spaces
- not_types: type must not be one of those, values are separated by spaces
doc_param_5=%(doc_profile)s
doc_return=Ordered list (by timestamp) of data as in [messageNew] (without final profile)