diff 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
line wrap: on
line diff
--- a/libervia/backend/bridge/dbus_bridge.py	Wed Oct 18 15:30:07 2023 +0200
+++ b/libervia/backend/bridge/dbus_bridge.py	Mon Oct 16 17:29:31 2023 +0200
@@ -124,6 +124,10 @@
         Method('message_encryption_stop', arguments='ss', returns=''),
         Method('message_send', arguments='sa{ss}a{ss}sss', returns=''),
         Method('namespaces_get', arguments='', returns='a{ss}'),
+        Method('notification_add', arguments='ssssbbsdss', returns=''),
+        Method('notification_delete', arguments='sbs', returns=''),
+        Method('notifications_expired_clean', arguments='ds', returns=''),
+        Method('notifications_get', arguments='ss', returns='s'),
         Method('param_get_a', arguments='ssss', returns='s'),
         Method('param_get_a_async', arguments='sssis', returns='s'),
         Method('param_set', arguments='sssis', returns=''),
@@ -164,6 +168,8 @@
         Signal('message_encryption_started', 'sss'),
         Signal('message_encryption_stopped', 'sa{ss}s'),
         Signal('message_new', 'sdssa{ss}a{ss}sss'),
+        Signal('notification_deleted', 'ss'),
+        Signal('notification_new', 'sdssssbidss'),
         Signal('param_update', 'ssss'),
         Signal('presence_update', 'ssia{ss}s'),
         Signal('progress_error', 'sss'),
@@ -304,6 +310,18 @@
     def dbus_namespaces_get(self, ):
         return self._callback("namespaces_get", )
 
+    def dbus_notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra):
+        return self._callback("notification_add", type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra)
+
+    def dbus_notification_delete(self, id_, is_global, profile_key):
+        return self._callback("notification_delete", id_, is_global, profile_key)
+
+    def dbus_notifications_expired_clean(self, limit_timestamp, profile_key):
+        return self._callback("notifications_expired_clean", limit_timestamp, profile_key)
+
+    def dbus_notifications_get(self, filters, profile_key):
+        return self._callback("notifications_get", filters, profile_key)
+
     def dbus_param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"):
         return self._callback("param_get_a", name, category, attribute, profile_key)
 
@@ -447,6 +465,12 @@
     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 notification_deleted(self, id, profile):
+        self._obj.emitSignal("notification_deleted", id, profile)
+
+    def notification_new(self, id, timestamp, type, body_plain, body_rich, title, requires_action, priority, expire_at, extra, profile):
+        self._obj.emitSignal("notification_new", id, timestamp, type, body_plain, body_rich, title, requires_action, priority, expire_at, extra, profile)
+
     def param_update(self, name, value, category, profile):
         self._obj.emitSignal("param_update", name, value, category, profile)