From e1e36fc98e460a8cadba9b81af7a14b47806758a Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 21 May 2019 22:04:49 +0200 Subject: Fix notifications for servers without MAM using StreamFlag as availability indicator --- libdino/src/service/notification_events.vala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libdino') diff --git a/libdino/src/service/notification_events.vala b/libdino/src/service/notification_events.vala index 47ec44e1..1beeb4ed 100644 --- a/libdino/src/service/notification_events.vala +++ b/libdino/src/service/notification_events.vala @@ -44,7 +44,15 @@ public class NotificationEvents : StreamInteractionModule, Object { } private void on_content_item_received(ContentItem item, Conversation conversation) { - if (!synced_accounts.contains(conversation.account)) { + + // Don't wait for MAM sync on servers without MAM + bool mam_available = true; + XmppStream? stream = stream_interactor.get_stream(conversation.account); + if (stream != null) { + mam_available = stream.get_flag(Xep.MessageArchiveManagement.Flag.IDENTITY) != null; + } + + if (mam_available && !synced_accounts.contains(conversation.account)) { if (!mam_potential_new.has_key(conversation.account)) { mam_potential_new[conversation.account] = new HashMap(Conversation.hash_func, Conversation.equals_func); } -- cgit v1.2.3-70-g09d2