From 64a2db3f193002bbd557b76b07c90241a78defb6 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 23 Mar 2021 21:21:31 +0100 Subject: [PATCH] [sid] Add to MUC messages if not muc#stable_id --- .../smackx/sid/StableUniqueStanzaIdManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 ec492b006..3f016cde2 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 @@ -31,6 +31,7 @@ import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.filter.ToTypeFilter; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; +import org.jivesoftware.smackx.muc.MultiUserChatManager; import org.jivesoftware.smackx.sid.element.OriginIdElement; /** @@ -68,6 +69,14 @@ public final class StableUniqueStanzaIdManager extends Manager { if (enabledByDefault) { getInstanceFor(connection).enable(); } + + MultiUserChatManager.addDefaultMessageInterceptor((mb, muc) -> { + // No need to add an if the MUC service supports stable IDs. + if (muc.serviceSupportsStableIds()) { + return; + } + OriginIdElement.addTo(mb); + }); } }); }