From 80793910b88f0b57437d5d32ef140c145961eaef Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 2 Sep 2019 17:39:27 +0200 Subject: [PATCH] Make adding originId by default configurable --- .../smackx/sid/StableUniqueStanzaIdManager.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java index b43cc6078..fbe507e4e 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java @@ -51,6 +51,8 @@ public final class StableUniqueStanzaIdManager extends Manager { private static final Map INSTANCES = new WeakHashMap<>(); + private static boolean enabledByDefault = true; + // Filter for outgoing stanzas. private static final StanzaFilter OUTGOING_FILTER = new AndFilter( MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE, @@ -72,7 +74,9 @@ public final class StableUniqueStanzaIdManager extends Manager { XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() { @Override public void connectionCreated(XMPPConnection connection) { - getInstanceFor(connection); + if (enabledByDefault) { + getInstanceFor(connection).enable(); + } } }); } @@ -83,7 +87,10 @@ public final class StableUniqueStanzaIdManager extends Manager { */ private StableUniqueStanzaIdManager(XMPPConnection connection) { super(connection); - enable(); + } + + public static void setEnabledByDefault(boolean enabled) { + enabledByDefault = enabled; } /**