Mercurial > libervia-backend
changeset 3738:ffa8c8c78115
plugin XEP-0059, cache: allow those plugins to work in component mode
rel 364
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 22 Mar 2022 17:00:42 +0100 |
parents | 783d6dc87b80 |
children | 0a87cae85746 |
files | sat/plugins/plugin_pubsub_cache.py sat/plugins/plugin_xep_0059.py |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/plugins/plugin_pubsub_cache.py Tue Mar 22 17:00:42 2022 +0100 +++ b/sat/plugins/plugin_pubsub_cache.py Tue Mar 22 17:00:42 2022 +0100 @@ -18,7 +18,7 @@ import time from datetime import datetime -from typing import Optional, List, Tuple +from typing import Optional, List, Tuple, Dict, Any from twisted.words.protocols.jabber import jid, error from twisted.words.xish import domish from twisted.internet import defer @@ -39,6 +39,7 @@ C.PI_NAME: "PubSub Cache", C.PI_IMPORT_NAME: "PUBSUB_CACHE", C.PI_TYPE: C.PLUG_TYPE_PUBSUB, + C.PI_MODES: C.PLUG_MODE_BOTH, C.PI_PROTOCOLS: [], C.PI_DEPENDENCIES: ["XEP-0059", "XEP-0060"], C.PI_RECOMMENDATIONS: [], @@ -483,9 +484,11 @@ item_ids: Optional[List[str]] = None, sub_id: Optional[str] = None, rsm_request: Optional[rsm.RSMRequest] = None, - extra: Optional[dict] = None + extra: Optional[Dict[str, Any]] = None ) -> Tuple[List[PubsubItem], dict]: """Get items from cache, using same arguments as for external Pubsub request""" + if extra is None: + extra = {} if "mam" in extra: raise NotImplementedError("MAM queries are not supported yet") if max_items is None and rsm_request is None:
--- a/sat/plugins/plugin_xep_0059.py Tue Mar 22 17:00:42 2022 +0100 +++ b/sat/plugins/plugin_xep_0059.py Tue Mar 22 17:00:42 2022 +0100 @@ -35,6 +35,7 @@ C.PI_NAME: "Result Set Management", C.PI_IMPORT_NAME: "XEP-0059", C.PI_TYPE: "XEP", + C.PI_MODES: C.PLUG_MODE_BOTH, C.PI_PROTOCOLS: ["XEP-0059"], C.PI_MAIN: "XEP_0059", C.PI_HANDLER: "yes",