Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/gotify_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -197,4 +197,4 @@ pub async fn run(
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
}
}
}
}
15 changes: 15 additions & 0 deletions src/registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(|_|()));
Expand Down