diff sat_frontends/bridge/pb.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/pb.py	Sun Jul 29 19:22:51 2018 +0200
+++ b/sat_frontends/bridge/pb.py	Sun Jul 29 19:22:56 2018 +0200
@@ -382,6 +382,14 @@
             errback = self._generic_errback
         d.addErrback(errback)
 
+    def messageEncryptionStart(self, to_jid, encryption_ns='', profile_key="@NONE@", callback=None, errback=None):
+        d = self.root.callRemote("messageEncryptionStart", to_jid, encryption_ns, profile_key)
+        if callback is not None:
+            d.addCallback(lambda dummy: callback())
+        if errback is None:
+            errback = self._generic_errback
+        d.addErrback(errback)
+
     def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
         d = self.root.callRemote("messageSend", to_jid, message, subject, mess_type, extra, profile_key)
         if callback is not None: