comparison libervia/backend/bridge/dbus_bridge.py @ 4130:02f0adc745c6

core: notifications implementation, first draft: add a new table for notifications, and methods/bridge methods to manipulate them.
author Goffi <goffi@goffi.org>
date Mon, 16 Oct 2023 17:29:31 +0200
parents 4b842c1fb686
children a8a0fa678ce2
comparison
equal deleted inserted replaced
4129:51744ad00a42 4130:02f0adc745c6
122 Method('message_encryption_get', arguments='ss', returns='s'), 122 Method('message_encryption_get', arguments='ss', returns='s'),
123 Method('message_encryption_start', arguments='ssbs', returns=''), 123 Method('message_encryption_start', arguments='ssbs', returns=''),
124 Method('message_encryption_stop', arguments='ss', returns=''), 124 Method('message_encryption_stop', arguments='ss', returns=''),
125 Method('message_send', arguments='sa{ss}a{ss}sss', returns=''), 125 Method('message_send', arguments='sa{ss}a{ss}sss', returns=''),
126 Method('namespaces_get', arguments='', returns='a{ss}'), 126 Method('namespaces_get', arguments='', returns='a{ss}'),
127 Method('notification_add', arguments='ssssbbsdss', returns=''),
128 Method('notification_delete', arguments='sbs', returns=''),
129 Method('notifications_expired_clean', arguments='ds', returns=''),
130 Method('notifications_get', arguments='ss', returns='s'),
127 Method('param_get_a', arguments='ssss', returns='s'), 131 Method('param_get_a', arguments='ssss', returns='s'),
128 Method('param_get_a_async', arguments='sssis', returns='s'), 132 Method('param_get_a_async', arguments='sssis', returns='s'),
129 Method('param_set', arguments='sssis', returns=''), 133 Method('param_set', arguments='sssis', returns=''),
130 Method('param_ui_get', arguments='isss', returns='s'), 134 Method('param_ui_get', arguments='isss', returns='s'),
131 Method('params_categories_get', arguments='', returns='as'), 135 Method('params_categories_get', arguments='', returns='as'),
162 Signal('disconnected', 's'), 166 Signal('disconnected', 's'),
163 Signal('entity_data_updated', 'ssss'), 167 Signal('entity_data_updated', 'ssss'),
164 Signal('message_encryption_started', 'sss'), 168 Signal('message_encryption_started', 'sss'),
165 Signal('message_encryption_stopped', 'sa{ss}s'), 169 Signal('message_encryption_stopped', 'sa{ss}s'),
166 Signal('message_new', 'sdssa{ss}a{ss}sss'), 170 Signal('message_new', 'sdssa{ss}a{ss}sss'),
171 Signal('notification_deleted', 'ss'),
172 Signal('notification_new', 'sdssssbidss'),
167 Signal('param_update', 'ssss'), 173 Signal('param_update', 'ssss'),
168 Signal('presence_update', 'ssia{ss}s'), 174 Signal('presence_update', 'ssia{ss}s'),
169 Signal('progress_error', 'sss'), 175 Signal('progress_error', 'sss'),
170 Signal('progress_finished', 'sa{ss}s'), 176 Signal('progress_finished', 'sa{ss}s'),
171 Signal('progress_started', 'sa{ss}s'), 177 Signal('progress_started', 'sa{ss}s'),
301 def dbus_message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"): 307 def dbus_message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"):
302 return self._callback("message_send", to_jid, message, subject, mess_type, extra, profile_key) 308 return self._callback("message_send", to_jid, message, subject, mess_type, extra, profile_key)
303 309
304 def dbus_namespaces_get(self, ): 310 def dbus_namespaces_get(self, ):
305 return self._callback("namespaces_get", ) 311 return self._callback("namespaces_get", )
312
313 def dbus_notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra):
314 return self._callback("notification_add", type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra)
315
316 def dbus_notification_delete(self, id_, is_global, profile_key):
317 return self._callback("notification_delete", id_, is_global, profile_key)
318
319 def dbus_notifications_expired_clean(self, limit_timestamp, profile_key):
320 return self._callback("notifications_expired_clean", limit_timestamp, profile_key)
321
322 def dbus_notifications_get(self, filters, profile_key):
323 return self._callback("notifications_get", filters, profile_key)
306 324
307 def dbus_param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"): 325 def dbus_param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"):
308 return self._callback("param_get_a", name, category, attribute, profile_key) 326 return self._callback("param_get_a", name, category, attribute, profile_key)
309 327
310 def dbus_param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"): 328 def dbus_param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"):
444 def message_encryption_stopped(self, to_jid, encryption_data, profile_key): 462 def message_encryption_stopped(self, to_jid, encryption_data, profile_key):
445 self._obj.emitSignal("message_encryption_stopped", to_jid, encryption_data, profile_key) 463 self._obj.emitSignal("message_encryption_stopped", to_jid, encryption_data, profile_key)
446 464
447 def message_new(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile): 465 def message_new(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
448 self._obj.emitSignal("message_new", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile) 466 self._obj.emitSignal("message_new", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile)
467
468 def notification_deleted(self, id, profile):
469 self._obj.emitSignal("notification_deleted", id, profile)
470
471 def notification_new(self, id, timestamp, type, body_plain, body_rich, title, requires_action, priority, expire_at, extra, profile):
472 self._obj.emitSignal("notification_new", id, timestamp, type, body_plain, body_rich, title, requires_action, priority, expire_at, extra, profile)
449 473
450 def param_update(self, name, value, category, profile): 474 def param_update(self, name, value, category, profile):
451 self._obj.emitSignal("param_update", name, value, category, profile) 475 self._obj.emitSignal("param_update", name, value, category, profile)
452 476
453 def presence_update(self, entity_jid, show, priority, statuses, profile): 477 def presence_update(self, entity_jid, show, priority, statuses, profile):