From f22d19f7d07733c524730627b1dca72a7bdfaafb Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 30 Mar 2024 14:54:28 +0100 Subject: [PATCH] disable mds for bug fix release --- src/main/java/eu/siacs/conversations/Config.java | 2 ++ .../conversations/generator/AbstractGenerator.java | 10 ++++++---- .../eu/siacs/conversations/parser/MessageParser.java | 10 ++++++++-- .../eu/siacs/conversations/xmpp/XmppConnection.java | 4 +++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index da3628b6f..06434a20d 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -56,6 +56,8 @@ public final class Config { public static final boolean USE_RANDOM_RESOURCE_ON_EVERY_BIND = false; + public static final boolean MESSAGE_DISPLAYED_SYNCHRONIZATION = false; + public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; // very dangerous. you should have a good reason to set this to true diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 3f63edbd7..905b08286 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -24,7 +24,7 @@ import java.util.TimeZone; public abstract class AbstractGenerator { private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); - private final String[] FEATURES = { + private final String[] STATIC_FEATURES = { Namespace.JINGLE, Namespace.JINGLE_APPS_FILE_TRANSFER, Namespace.JINGLE_TRANSPORTS_S5B, @@ -40,8 +40,7 @@ public abstract class AbstractGenerator { Namespace.NICK + "+notify", "urn:xmpp:ping", "jabber:iq:version", - "http://jabber.org/protocol/chatstates", - Namespace.MDS_DISPLAYED + "+notify" + "http://jabber.org/protocol/chatstates" }; private final String[] MESSAGE_CONFIRMATION_FEATURES = { "urn:xmpp:chat-markers:0", "urn:xmpp:receipts" @@ -108,7 +107,10 @@ public abstract class AbstractGenerator { public List getFeatures(Account account) { final XmppConnection connection = account.getXmppConnection(); - final ArrayList features = new ArrayList<>(Arrays.asList(FEATURES)); + final ArrayList features = new ArrayList<>(Arrays.asList(STATIC_FEATURES)); + if (Config.MESSAGE_DISPLAYED_SYNCHRONIZATION) { + features.add(Namespace.MDS_DISPLAYED + "+notify"); + } if (mXmppConnectionService.confirmMessages()) { features.addAll(Arrays.asList(MESSAGE_CONFIRMATION_FEATURES)); } diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index ece8a7862..a949b088d 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -271,11 +271,17 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece mXmppConnectionService.updateConversationUi(); } } - } else if (Namespace.MDS_DISPLAYED.equals(node) && account.getJid().asBareJid().equals(from)) { + } else if (Config.MESSAGE_DISPLAYED_SYNCHRONIZATION + && Namespace.MDS_DISPLAYED.equals(node) + && account.getJid().asBareJid().equals(from)) { final Element item = items.findChild("item"); mXmppConnectionService.processMdsItem(account, item); } else { - Log.d(Config.LOGTAG, account.getJid().asBareJid() + " received pubsub notification for node=" + node); + Log.d( + Config.LOGTAG, + account.getJid().asBareJid() + + " received pubsub notification for node=" + + node); } } diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index b29129ee2..58f9e5644 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -3074,7 +3074,9 @@ public class XmppConnection implements Runnable { } public boolean mds() { - return pepPublishOptions() && pepConfigNodeMax(); + return pepPublishOptions() + && pepConfigNodeMax() + && Config.MESSAGE_DISPLAYED_SYNCHRONIZATION; } public boolean mdsServerAssist() {