changeset 4148:a8a0fa678ce2

bridge: add `message_update` signal
author Goffi <goffi@goffi.org>
date Wed, 22 Nov 2023 14:26:13 +0100
parents 11f95dfe5b17
children c36295487082
files libervia/backend/bridge/bridge_constructor/bridge_template.ini libervia/backend/bridge/dbus_bridge.py libervia/backend/bridge/pb.py libervia/backend/core/constants.py
diffstat 4 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/backend/bridge/bridge_constructor/bridge_template.ini	Fri Nov 03 15:33:04 2023 +0100
+++ b/libervia/backend/bridge/bridge_constructor/bridge_template.ini	Wed Nov 22 14:26:13 2023 +0100
@@ -39,7 +39,7 @@
 category=core
 sig_in=sdssa{ss}a{ss}sss
 doc=A message has been received
-doc_param_0=uid: unique ID of the message (id specific to SàT, this it *NOT* an XMPP id)
+doc_param_0=uid: unique ID of the message (id specific to Libervia, this it *NOT* an XMPP id)
 doc_param_1=timestamp: when the message was sent (or declared sent for delayed messages)
 doc_param_2=from_jid: JID where the message is comming from
 doc_param_3=to_jid: JID where the message must be sent
@@ -54,6 +54,16 @@
   - info_type: subtype for info messages
 doc_param_8=%(doc_profile)s
 
+[message_update]
+type=signal
+category=core
+sig_in=ssss
+doc=An existing message has been updated
+doc_param_0=uid: unique ID of the message (id specific to Libervia, this is *NOT* an XMPP id)
+doc_param_1=message_type: Type of the update (can be "EDIT", "REACTION", or any of C.MESS_UPDATE_*)
+doc_param_2=message_data: JSON serialized dictionary containing the updated message data. Keys and values will depend on the specific message and use case.
+doc_param_3=%(doc_profile)s
+
 [message_encryption_started]
 type=signal
 category=core
@@ -342,7 +352,7 @@
 param_2_default={}
 doc=Connect a profile
 doc_param_0=%(doc_profile_key)s
-doc_param_1=password: the SàT profile password
+doc_param_1=password: the Libervia profile password
 doc_param_2=options: connection options
 doc_return=a deferred boolean or failure:
     - boolean if the profile authentication succeed:
@@ -359,7 +369,7 @@
 param_0_default=''
 param_1_default="@DEFAULT@"
 doc=Start a profile session without connecting it (if it's not already the case)
-doc_param_0=password: the SàT profile password
+doc_param_0=password: the Libervia profile password
 doc_param_1=%(doc_profile_key)s
 doc_return=D(bool):
         - True if the profile session was already started
@@ -690,7 +700,7 @@
 param_1_default=''
 param_2_default=''
 param_3_default="@DEFAULT@"
-doc=Return a SàT XMLUI for parameters, eventually restrict the result to the parameters concerning a given frontend
+doc=Return a Libervia XMLUI for parameters, eventually restrict the result to the parameters concerning a given frontend
 doc_param_0=%(doc_security_limit)s
 doc_param_1=app: name of the frontend requesting the parameters, or '' to get all parameters
 doc_param_2=extra: extra options/filters
--- a/libervia/backend/bridge/dbus_bridge.py	Fri Nov 03 15:33:04 2023 +0100
+++ b/libervia/backend/bridge/dbus_bridge.py	Wed Nov 22 14:26:13 2023 +0100
@@ -168,6 +168,7 @@
         Signal('message_encryption_started', 'sss'),
         Signal('message_encryption_stopped', 'sa{ss}s'),
         Signal('message_new', 'sdssa{ss}a{ss}sss'),
+        Signal('message_update', 'ssss'),
         Signal('notification_deleted', 'ss'),
         Signal('notification_new', 'sdssssbidss'),
         Signal('param_update', 'ssss'),
@@ -465,6 +466,9 @@
     def message_new(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
         self._obj.emitSignal("message_new", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile)
 
+    def message_update(self, uid, message_type, message_data, profile):
+        self._obj.emitSignal("message_update", uid, message_type, message_data, profile)
+
     def notification_deleted(self, id, profile):
         self._obj.emitSignal("notification_deleted", id, profile)
 
--- a/libervia/backend/bridge/pb.py	Fri Nov 03 15:33:04 2023 +0100
+++ b/libervia/backend/bridge/pb.py	Wed Nov 22 14:26:13 2023 +0100
@@ -193,6 +193,9 @@
     def message_new(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
         self.send_signal("message_new", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile)
 
+    def message_update(self, uid, message_type, message_data, profile):
+        self.send_signal("message_update", uid, message_type, message_data, profile)
+
     def notification_deleted(self, id, profile):
         self.send_signal("notification_deleted", id, profile)
 
--- a/libervia/backend/core/constants.py	Fri Nov 03 15:33:04 2023 +0100
+++ b/libervia/backend/core/constants.py	Wed Nov 22 14:26:13 2023 +0100
@@ -122,6 +122,11 @@
     )
     MESS_TYPE_ALL = MESS_TYPE_STANDARD + (MESS_TYPE_INFO, MESS_TYPE_AUTO)
 
+    # Update
+
+    MESS_UPDATE_EDIT = "EDIT"
+    MESS_UPDATE_REACTION = "REACTION"
+
     MESS_EXTRA_INFO = "info_type"
     EXTRA_INFO_DECR_ERR = "DECRYPTION_ERROR"
     EXTRA_INFO_ENCR_ERR = "ENCRYPTION_ERROR"