changeset 3102:7574f795bd1e

core, bridge: encryptionPluginsGet now returns a serialised list + added "directed" in metadata
author Goffi <goffi@goffi.org>
date Mon, 30 Dec 2019 20:44:04 +0100
parents ab7e8ade848a
children f0f48b4deb35
files sat/bridge/bridge_constructor/bridge_template.ini sat/bridge/dbus_bridge.py sat/core/sat_main.py sat_frontends/bridge/dbus_bridge.py sat_frontends/jp/cmd_encryption.py sat_frontends/quick_frontend/quick_app.py
diffstat 6 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sat/bridge/bridge_constructor/bridge_template.ini	Mon Dec 30 20:44:02 2019 +0100
+++ b/sat/bridge/bridge_constructor/bridge_template.ini	Mon Dec 30 20:44:04 2019 +0100
@@ -496,7 +496,7 @@
 type=method
 category=core
 sig_in=
-sig_out=aa{ss}
+sig_out=s
 doc=Retrieve registered plugins for encryption
 
 [encryptionTrustUIGet]
--- a/sat/bridge/dbus_bridge.py	Mon Dec 30 20:44:02 2019 +0100
+++ b/sat/bridge/dbus_bridge.py	Mon Dec 30 20:44:04 2019 +0100
@@ -283,7 +283,7 @@
         return self._callback("encryptionNamespaceGet", str(arg_0))
 
     @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
-                         in_signature='', out_signature='aa{ss}',
+                         in_signature='', out_signature='s',
                          async_callbacks=None)
     def encryptionPluginsGet(self, ):
         return self._callback("encryptionPluginsGet", )
--- a/sat/core/sat_main.py	Mon Dec 30 20:44:02 2019 +0100
+++ b/sat/core/sat_main.py	Mon Dec 30 20:44:04 2019 +0100
@@ -734,9 +734,10 @@
             ret.append({
                 "name": p.name,
                 "namespace": p.namespace,
-                "priority": str(p.priority),
+                "priority": p.priority,
+                "directed": p.directed,
                 })
-        return ret
+        return data_format.serialise(ret)
 
     def _encryptionTrustUIGet(self, to_jid_s, namespace, profile_key):
         client = self.getClient(profile_key)
--- a/sat_frontends/bridge/dbus_bridge.py	Mon Dec 30 20:44:02 2019 +0100
+++ b/sat_frontends/bridge/dbus_bridge.py	Mon Dec 30 20:44:04 2019 +0100
@@ -273,7 +273,7 @@
             kwargs['timeout'] = const_TIMEOUT
             kwargs['reply_handler'] = callback
             kwargs['error_handler'] = error_handler
-        return self.db_core_iface.encryptionPluginsGet(**kwargs)
+        return str(self.db_core_iface.encryptionPluginsGet(**kwargs))
 
     def encryptionTrustUIGet(self, to_jid, namespace, profile_key, callback=None, errback=None):
         if callback is None:
--- a/sat_frontends/jp/cmd_encryption.py	Mon Dec 30 20:44:02 2019 +0100
+++ b/sat_frontends/jp/cmd_encryption.py	Mon Dec 30 20:44:04 2019 +0100
@@ -49,7 +49,8 @@
 
     async def start(self):
         try:
-            plugins = await self.host.bridge.encryptionPluginsGet()
+            plugins_ser = await self.host.bridge.encryptionPluginsGet()
+            plugins = data_format.deserialise(plugins_ser, type_check=list)
         except Exception as e:
             self.disp(f"can't retrieve plugins: {e}", error=True)
             self.host.quit(C.EXIT_BRIDGE_ERRBACK)
--- a/sat_frontends/quick_frontend/quick_app.py	Mon Dec 30 20:44:02 2019 +0100
+++ b/sat_frontends/quick_frontend/quick_app.py	Mon Dec 30 20:44:04 2019 +0100
@@ -351,8 +351,8 @@
     def _namespacesGetEb(self, failure_):
         log.error(_("Can't get namespaces map: {msg}").format(msg=failure_))
 
-    def _encryptionPluginsGetCb(self, plugins):
-        self.encryption_plugins = plugins
+    def _encryptionPluginsGetCb(self, plugins_ser):
+        self.encryption_plugins = data_format.deserialise(plugins_ser, type_check=list)
 
     def _encryptionPluginsGetEb(self, failure_):
         log.warning(_("Can't retrieve encryption plugins: {msg}").format(msg=failure_))