diff sat/plugins/plugin_xep_0060.py @ 3586:5f65f4e9f8cb

plugin XEP-0060: getItems extra is now serialised dict
author Goffi <goffi@goffi.org>
date Wed, 28 Jul 2021 23:01:15 +0200
parents edc79cefe968
children 2715da5b2aa7
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0060.py	Wed Jul 28 22:15:31 2021 +0200
+++ b/sat/plugins/plugin_xep_0060.py	Wed Jul 28 23:01:15 2021 +0200
@@ -197,7 +197,7 @@
         host.bridge.addMethod(
             "psItemsGet",
             ".plugin",
-            in_sign="ssiassa{ss}s",
+            in_sign="ssiassss",
             out_sign="s",
             method=self._getItems,
             async_=True,
@@ -284,7 +284,7 @@
         host.bridge.addMethod(
             "psGetFromMany",
             ".plugin",
-            in_sign="a(ss)ia{ss}s",
+            in_sign="a(ss)iss",
             out_sign="s",
             method=self._getFromMany,
         )
@@ -613,7 +613,7 @@
         return data_format.serialise(metadata)
 
     def _getItems(self, service="", node="", max_items=10, item_ids=None, sub_id=None,
-                  extra_dict=None, profile_key=C.PROF_KEY_NONE):
+                  extra="", profile_key=C.PROF_KEY_NONE):
         """Get items from pubsub node
 
         @param max_items(int): maximum number of item to get, C.NO_LIMIT for no limit
@@ -621,7 +621,7 @@
         client = self.host.getClient(profile_key)
         service = jid.JID(service) if service else None
         max_items = None if max_items == C.NO_LIMIT else max_items
-        extra = self.parseExtra(extra_dict)
+        extra = self.parseExtra(data_format.deserialise(extra))
         d = defer.ensureDeferred(self.getItems(
             client,
             service,
@@ -1439,13 +1439,13 @@
         return d
 
     def _getFromMany(
-        self, node_data, max_item=10, extra_dict=None, profile_key=C.PROF_KEY_NONE
+        self, node_data, max_item=10, extra="", profile_key=C.PROF_KEY_NONE
     ):
         """
         @param max_item(int): maximum number of item to get, C.NO_LIMIT for no limit
         """
         max_item = None if max_item == C.NO_LIMIT else max_item
-        extra = self.parseExtra(extra_dict)
+        extra = self.parseExtra(data_format.deserialise(extra))
         return self.getFromMany(
             [(jid.JID(service), str(node)) for service, node in node_data],
             max_item,