diff sat_frontends/bridge/dbus_bridge.py @ 2646:712cb4ff3e13

core: new EncryptionHandler class which manage encrypted session as a core feature: Plugin handling encryption can now register using host.registerEncryptionPlugin, and an encryption session can now be started using messageEncryptionStart bridge method. This will make encryption handling more easy, as we now know if a session is clear or e2e encrypted, and which plugin handle it.
author Goffi <goffi@goffi.org>
date Sun, 29 Jul 2018 19:22:56 +0200
parents 779351da2c13
children 4e130cc9bfc0
line wrap: on
line diff
--- a/sat_frontends/bridge/dbus_bridge.py	Sun Jul 29 19:22:51 2018 +0200
+++ b/sat_frontends/bridge/dbus_bridge.py	Sun Jul 29 19:22:56 2018 +0200
@@ -504,6 +504,20 @@
             kwargs['error_handler'] = error_handler
         return self.db_core_iface.menusGet(language, security_limit, **kwargs)
 
+    def messageEncryptionStart(self, to_jid, encryption_ns='', profile_key="@NONE@", callback=None, errback=None):
+        if callback is None:
+            error_handler = None
+        else:
+            if errback is None:
+                errback = log.error
+            error_handler = lambda err:errback(dbus_to_bridge_exception(err))
+        kwargs={}
+        if callback is not None:
+            kwargs['timeout'] = const_TIMEOUT
+            kwargs['reply_handler'] = callback
+            kwargs['error_handler'] = error_handler
+        return self.db_core_iface.messageEncryptionStart(to_jid, encryption_ns, profile_key, **kwargs)
+
     def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
         if callback is None:
             error_handler = None