mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Merge pull request #345 from vanitasvitae/enableStanzaId
Make adding originId by default configurable
This commit is contained in:
commit
a2acb7b66e
1 changed files with 9 additions and 2 deletions
|
@ -51,6 +51,8 @@ public final class StableUniqueStanzaIdManager extends Manager {
|
||||||
|
|
||||||
private static final Map<XMPPConnection, StableUniqueStanzaIdManager> INSTANCES = new WeakHashMap<>();
|
private static final Map<XMPPConnection, StableUniqueStanzaIdManager> INSTANCES = new WeakHashMap<>();
|
||||||
|
|
||||||
|
private static boolean enabledByDefault = true;
|
||||||
|
|
||||||
// Filter for outgoing stanzas.
|
// Filter for outgoing stanzas.
|
||||||
private static final StanzaFilter OUTGOING_FILTER = new AndFilter(
|
private static final StanzaFilter OUTGOING_FILTER = new AndFilter(
|
||||||
MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE,
|
MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE,
|
||||||
|
@ -72,7 +74,9 @@ public final class StableUniqueStanzaIdManager extends Manager {
|
||||||
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
|
XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void connectionCreated(XMPPConnection connection) {
|
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) {
|
private StableUniqueStanzaIdManager(XMPPConnection connection) {
|
||||||
super(connection);
|
super(connection);
|
||||||
enable();
|
}
|
||||||
|
|
||||||
|
public static void setEnabledByDefault(boolean enabled) {
|
||||||
|
enabledByDefault = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue