Fix notifications for servers without MAM using StreamFlag as availability indicator

This commit is contained in:
fiaxh 2019-05-21 22:04:49 +02:00
parent 03f25e1f87
commit e1e36fc98e

View file

@ -44,7 +44,15 @@ public class NotificationEvents : StreamInteractionModule, Object {
} }
private void on_content_item_received(ContentItem item, Conversation conversation) { 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)) { if (!mam_potential_new.has_key(conversation.account)) {
mam_potential_new[conversation.account] = new HashMap<Conversation, ContentItem>(Conversation.hash_func, Conversation.equals_func); mam_potential_new[conversation.account] = new HashMap<Conversation, ContentItem>(Conversation.hash_func, Conversation.equals_func);
} }