changeset 2655:b8600f8130ac

core (bridge): new messageEncryptionStarted and messageEncryptionStopped signals (not used yet)
author Goffi <goffi@goffi.org>
date Sat, 11 Aug 2018 18:24:55 +0200
parents e7bfbded652a
children 8cacf7929f3c
files sat/bridge/bridge_constructor/bridge_template.ini sat/bridge/dbus_bridge.py sat/bridge/pb.py
diffstat 3 files changed, 47 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/bridge/bridge_constructor/bridge_template.ini	Sat Aug 11 18:24:55 2018 +0200
+++ b/sat/bridge/bridge_constructor/bridge_template.ini	Sat Aug 11 18:24:55 2018 +0200
@@ -54,6 +54,31 @@
   - info_type: subtype for info messages
 doc_param_8=%(doc_profile)s
 
+[messageEncryptionStarted]
+type=signal
+category=core
+sig_in=sss
+doc=A message encryption session has been started
+doc_param_0=to_jid: JID of the recipient (bare jid if it's encrypted for all devices)
+doc_param_1=encryption_data: [JSON_OBJ] data of the encryption algorithm used, encoded as a json object.
+    it always has the following keys:
+        - name: human readable name of the algorithm
+        - namespace: namespace of the encryption plugin
+    following keys are present if suitable:
+        - directed_devices: list or resource where session is encrypted
+doc_param_2=%(doc_profile_key)s
+
+[messageEncryptionStopped]
+type=signal
+category=core
+sig_in=sa{ss}s
+doc=A message encryption session has been stopped
+doc_param_0=to_jid: JID of the recipient (full jid if it's only stopped for one device)
+doc_param_1=encryption_data: data of the encryption algorithm stopped, has a least following keys:
+    - name: human readable name of the algorithm
+    - namespace: namespace of the encryption plugin
+doc_param_2=%(doc_profile_key)s
+
 [presenceUpdate]
 type=signal
 category=core
--- a/sat/bridge/dbus_bridge.py	Sat Aug 11 18:24:55 2018 +0200
+++ b/sat/bridge/dbus_bridge.py	Sat Aug 11 18:24:55 2018 +0200
@@ -154,6 +154,16 @@
         pass
 
     @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
+                         signature='sss')
+    def messageEncryptionStarted(self, to_jid, encryption_data, profile_key):
+        pass
+
+    @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
+                         signature='sa{ss}s')
+    def messageEncryptionStopped(self, to_jid, encryption_data, profile_key):
+        pass
+
+    @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
                          signature='sdssa{ss}a{ss}sa{ss}s')
     def messageNew(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
         pass
@@ -656,6 +666,12 @@
     def entityDataUpdated(self, jid, name, value, profile):
         self.dbus_bridge.entityDataUpdated(jid, name, value, profile)
 
+    def messageEncryptionStarted(self, to_jid, encryption_data, profile_key):
+        self.dbus_bridge.messageEncryptionStarted(to_jid, encryption_data, profile_key)
+
+    def messageEncryptionStopped(self, to_jid, encryption_data, profile_key):
+        self.dbus_bridge.messageEncryptionStopped(to_jid, encryption_data, profile_key)
+
     def messageNew(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
         self.dbus_bridge.messageNew(uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile)
 
--- a/sat/bridge/pb.py	Sat Aug 11 18:24:55 2018 +0200
+++ b/sat/bridge/pb.py	Sat Aug 11 18:24:55 2018 +0200
@@ -119,6 +119,12 @@
     def entityDataUpdated(self, jid, name, value, profile):
         self.sendSignal("entityDataUpdated", jid, name, value, profile)
 
+    def messageEncryptionStarted(self, to_jid, encryption_data, profile_key):
+        self.sendSignal("messageEncryptionStarted", to_jid, encryption_data, profile_key)
+
+    def messageEncryptionStopped(self, to_jid, encryption_data, profile_key):
+        self.sendSignal("messageEncryptionStopped", to_jid, encryption_data, profile_key)
+
     def messageNew(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
         self.sendSignal("messageNew", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile)