From 80b946c85c9235deb5471cdc4f0d561a4fb5a3bb Mon Sep 17 00:00:00 2001 From: Rahix Date: Thu, 16 May 2019 08:24:23 +0200 Subject: [PATCH 1/2] Fix notifications for servers without MAM This commit re-adds the change from 4ad07fe: Fix messages never being notified from servers without MAM (#432) Signed-off-by: Rahix --- libdino/src/service/notification_events.vala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libdino/src/service/notification_events.vala b/libdino/src/service/notification_events.vala index 010341e3..6a99653e 100644 --- a/libdino/src/service/notification_events.vala +++ b/libdino/src/service/notification_events.vala @@ -44,7 +44,12 @@ public class NotificationEvents : StreamInteractionModule, Object { } private void on_content_item_received(ContentItem item, Conversation conversation) { - if (!synced_accounts.contains(conversation.account)) { + bool is_mam_message = true; + if (item.type_ == MessageItem.TYPE) { + // If this message is not for MAM, always notify + is_mam_message = Xep.MessageArchiveManagement.MessageFlag.get_flag((item as MessageItem).message.stanza) != null; + } + if (!synced_accounts.contains(conversation.account) && is_mam_message) { if (!mam_potential_new.has_key(conversation.account)) { mam_potential_new[conversation.account] = new HashMap(Conversation.hash_func, Conversation.equals_func); } From 7ff99104d2d95ece9ad78fb718aed5c023e66714 Mon Sep 17 00:00:00 2001 From: Rahix Date: Thu, 16 May 2019 08:49:44 +0200 Subject: [PATCH 2/2] Disable notification on file in "mention only" groupchat Signed-off-by: Rahix --- libdino/src/service/notification_events.vala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdino/src/service/notification_events.vala b/libdino/src/service/notification_events.vala index 6a99653e..ea95278d 100644 --- a/libdino/src/service/notification_events.vala +++ b/libdino/src/service/notification_events.vala @@ -70,6 +70,8 @@ public class NotificationEvents : StreamInteractionModule, Object { break; case FileItem.TYPE: FileTransfer file_transfer = (content_item as FileItem).file_transfer; + // Don't notify on file transfers in a groupchat set to "mention only" + if (notify == Conversation.NotifySetting.HIGHLIGHT) return false; if (file_transfer.direction == FileTransfer.DIRECTION_SENT) return false; break; }