From 8fcb05ee54e250ae23113549e09fc11410829272 Mon Sep 17 00:00:00 2001 From: Caroline Larimore Date: Thu, 30 Jan 2025 22:26:55 -0800 Subject: Add dismissal commands --- srv/corvidServer.go | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'srv/corvidServer.go') diff --git a/srv/corvidServer.go b/srv/corvidServer.go index 4a0556d..8b08a6e 100644 --- a/srv/corvidServer.go +++ b/srv/corvidServer.go @@ -1,39 +1,24 @@ package srv import ( - "log" - "github.com/godbus/dbus/v5" ) type corvidServer server -func (s corvidServer) Test(param uint32) (e *dbus.Error) { - log.Printf("Test called %d", param) +func (s corvidServer) Dismiss(id uint32) (e *dbus.Error) { + // log.Print("Dismiss called") + server(s).close(id, CloseReasonDismissed) + server(s).output() return nil } -// func (s corvidServer) GetCapabilities() (e *dbus.Error) { -// log.Print("GetCapabilities called") -// return nil -// } - -// func (s corvidServer) GetServerInformation() (name, vendor, version, specVersion string, e *dbus.Error) { -// // log.Print("GetServerInformation called") -// return "corvid", "CartConnoisseur", "0.1.0", "1.2", nil -// } - -// func (s corvidServer) CloseNotification(id uint32) (e *dbus.Error) { -// // log.Printf("CloseNotification called: %d", id) -// notification, ok := notifications.notifications[id] -// if ok { -// notification.close(CloseReasonClosed) -// } - -// return nil -// } +func (s corvidServer) DismissAll() (e *dbus.Error) { + // log.Print("DismissAll called") + for _, notification := range s.notifications.notifications { + server(s).close(notification.Id, CloseReasonDismissed) + } -// func (s corvidServer) Notify(appName string, replacesId uint32, appIcon string, summary string, body string, actions []string, hints map[string]dbus.Variant, expireTimeout int32) (id uint32, e *dbus.Error) { -// // log.Print("Notify called") - -// } + server(s).output() + return nil +} -- cgit v1.2.3