bridge: add message_update signal

This commit is contained in:
Goffi 2023-11-22 14:26:13 +01:00
commit da5d3dfb86
4 changed files with 26 additions and 4 deletions

View file

@ -39,7 +39,7 @@ type=signal
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 @@ doc_param_7=extra: extra message information, can have data added by plugins and
- 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_1_default=''
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 @@ sig_out=b
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_0_default=-1
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

View file

@ -168,6 +168,7 @@ class DBusObject(objects.DBusObject):
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 @@ class bridge:
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)

View file

@ -193,6 +193,9 @@ class bridge(object):
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)

View file

@ -122,6 +122,11 @@ class Const(object):
)
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"