aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-03-14 22:53:47 +0100
committerfiaxh <git@lightrise.org>2019-03-14 23:00:27 +0100
commita49326979140750cc22cf483182274638568e43d (patch)
treea490054a17a176b83ff32adf529a6a4df50d581c /plugins
parent952ac9548402744ac9b13917255b9e461a96abe5 (diff)
downloaddino-a49326979140750cc22cf483182274638568e43d.tar.gz
dino-a49326979140750cc22cf483182274638568e43d.zip
Fix OMEMO new device notifications appearing in wrong context
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omemo/src/device_notification_populator.vala17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/omemo/src/device_notification_populator.vala b/plugins/omemo/src/device_notification_populator.vala
index 900cac96..bcb99f11 100644
--- a/plugins/omemo/src/device_notification_populator.vala
+++ b/plugins/omemo/src/device_notification_populator.vala
@@ -17,6 +17,8 @@ public class DeviceNotificationPopulator : NotificationPopulator, Object {
public DeviceNotificationPopulator(Plugin plugin, StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
this.plugin = plugin;
+
+ stream_interactor.account_added.connect(on_account_added);
}
public bool has_new_devices(Jid jid) {
@@ -28,11 +30,6 @@ public class DeviceNotificationPopulator : NotificationPopulator, Object {
public void init(Conversation conversation, NotificationCollection notification_collection, Plugins.WidgetType type) {
current_conversation = conversation;
this.notification_collection = notification_collection;
- stream_interactor.module_manager.get_module(conversation.account, StreamModule.IDENTITY).bundle_fetched.connect_after((jid, device_id, bundle) => {
- if (jid.equals(conversation.counterpart) && has_new_devices(conversation.counterpart) && conversation.type_ == Conversation.Type.CHAT) {
- display_notification();
- }
- });
if (has_new_devices(conversation.counterpart) && conversation.type_ == Conversation.Type.CHAT) {
display_notification();
}
@@ -43,7 +40,7 @@ public class DeviceNotificationPopulator : NotificationPopulator, Object {
}
private void display_notification() {
- if(notification == null) {
+ if (notification == null) {
notification = new ConversationNotification(plugin, current_conversation.account, current_conversation.counterpart);
notification.should_hide.connect(should_hide);
notification_collection.add_meta_notification(notification);
@@ -56,6 +53,14 @@ public class DeviceNotificationPopulator : NotificationPopulator, Object {
notification = null;
}
}
+
+ private void on_account_added(Account account) {
+ stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).bundle_fetched.connect_after((jid, device_id, bundle) => {
+ if (jid.equals(current_conversation.counterpart) && has_new_devices(current_conversation.counterpart)) {
+ display_notification();
+ }
+ });
+ }
}
private class ConversationNotification : MetaConversationNotification {