From 837de4063dbe398735a5b1d35bde1821c177b555 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 11 May 2019 09:39:02 -0600 Subject: OMEMO: Move files to fitting subdirectory --- plugins/omemo/src/own_notifications.vala | 42 -------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 plugins/omemo/src/own_notifications.vala (limited to 'plugins/omemo/src/own_notifications.vala') diff --git a/plugins/omemo/src/own_notifications.vala b/plugins/omemo/src/own_notifications.vala deleted file mode 100644 index f882d03a..00000000 --- a/plugins/omemo/src/own_notifications.vala +++ /dev/null @@ -1,42 +0,0 @@ -using Dino.Entities; -using Xmpp; -using Gtk; - -namespace Dino.Plugins.Omemo { - -public class OwnNotifications { - - private StreamInteractor stream_interactor; - private Plugin plugin; - private Account account; - - public OwnNotifications (Plugin plugin, StreamInteractor stream_interactor, Account account) { - this.stream_interactor = (!)stream_interactor; - this.plugin = plugin; - this.account = account; - stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).bundle_fetched.connect_after((jid, device_id, bundle) => { - if (jid.equals(account.bare_jid) && has_new_devices(account.bare_jid)) { - display_notification(); - } - }); - - if (has_new_devices(account.bare_jid)) { - display_notification(); - } - } - - public bool has_new_devices(Jid jid) { - int identity_id = plugin.db.identity.get_id(account.id); - if (identity_id < 0) return false; - - return plugin.db.identity_meta.get_new_devices(identity_id, jid.bare_jid.to_string()).count() > 0; - } - - private void display_notification() { - Notification notification = new Notification(_("OMEMO trust decision required")); - notification.set_default_action_and_target_value("app.own-keys", new Variant.int32(account.id)); - notification.set_body(_("Did you add a new device for account %s?").printf(@"$(account.bare_jid.to_string())")); - plugin.app.send_notification(account.id.to_string()+"-new-device", notification); - } -} -} -- cgit v1.2.3-70-g09d2