diff --git a/src/gotify_receiver.rs b/src/gotify_receiver.rs index 9a2c749..5a1e729 100644 --- a/src/gotify_receiver.rs +++ b/src/gotify_receiver.rs @@ -44,7 +44,7 @@ async fn send_unregister(conn: &zbus::azync::Connection, appid: &str, token: &st Some(appid), "/org/unifiedpush/Connector", Some("org.unifiedpush.Connector1"), - "Unregister", + "Unregistered", &(token)).unwrap()).await { eprintln!("Unregistered from Gotify: {}", appid); } else { @@ -197,4 +197,4 @@ pub async fn run( tokio::time::sleep(std::time::Duration::from_secs(10)).await; } } -} \ No newline at end of file +} diff --git a/src/registration.rs b/src/registration.rs index 449e2a4..3038ea8 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -108,6 +108,21 @@ impl Distributor { client.delete(format!("{}/application/{}", self.gotify_login.gotify_base_url, row.gotify_id).as_str()) .header("X-Gotify-Key", &self.gotify_login.gotify_device_token) .send(); + if let Ok(_) = self.dbus_conn.send_message( + zbus::Message::method( + Some("org.unifiedpush.Distributor.gotify"), + Some(&row.appid), + "/org/unifiedpush/Connector", + Some("org.unifiedpush.Connector1"), + "Unregistered", + &row.token, + ) + .unwrap(), + ) { + eprintln!("Unregistered from Gotify: {}", &row.appid); + } else { + eprintln!("Sending Unregister failed: {}", &row.appid); + } } self.sqlite_pool.get().map_err(|_|()) .and_then(|c| c.execute("DELETE FROM connections WHERE token=?", &[token]).map_err(|_|()));