mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-19 02:22:05 +01:00
[sid] Add <origin-id/> to MUC messages if not muc#stable_id
This commit is contained in:
parent
4381d04831
commit
64a2db3f19
1 changed files with 9 additions and 0 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue