diff sat/plugins/plugin_pubsub_cache.py @ 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 342e3ddefd23
children c4881833cf8a
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: