1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-21 22:02:06 +01:00

[sid] Add <origin-id/> to MUC messages if not muc#stable_id

This commit is contained in:
Florian Schmaus 2021-03-23 21:21:31 +01:00
parent 4381d04831
commit 64a2db3f19

View file

@ -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 <origin-id/> if the MUC service supports stable IDs.
if (muc.serviceSupportsStableIds()) {
return;
}
OriginIdElement.addTo(mb);
});
}
});
}