core, bridge: encryptionPluginsGet now returns a serialised list + added "directed" in metadata

This commit is contained in:
Goffi 2019-12-30 20:44:04 +01:00
commit 7dd0df7f41
6 changed files with 10 additions and 8 deletions

View file

@ -496,7 +496,7 @@ doc=Get algorithm namespace from its name
type=method
category=core
sig_in=
sig_out=aa{ss}
sig_out=s
doc=Retrieve registered plugins for encryption
[encryptionTrustUIGet]

View file

@ -283,7 +283,7 @@ class DbusObject(dbus.service.Object):
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", )

View file

@ -734,9 +734,10 @@ class SAT(service.Service):
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)

View file

@ -273,7 +273,7 @@ class Bridge:
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:

View file

@ -49,7 +49,8 @@ class EncryptionAlgorithms(base.CommandBase):
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)

View file

@ -351,8 +351,8 @@ class QuickApp(object):
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_))