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

Make origin-id interceptor static and rename it

This commit is contained in:
Florian Schmaus 2019-02-23 23:39:58 +01:00
parent 27749b2137
commit 4da4558b29

View file

@ -46,7 +46,7 @@ public final class StableUniqueStanzaIdManager extends Manager {
ToTypeFilter.ENTITY_FULL_OR_BARE_JID); ToTypeFilter.ENTITY_FULL_OR_BARE_JID);
// Listener for outgoing stanzas that adds origin-ids to outgoing stanzas. // Listener for outgoing stanzas that adds origin-ids to outgoing stanzas.
private final StanzaListener stanzaListener = new StanzaListener() { private static final StanzaListener ADD_ORIGIN_ID_INTERCEPTOR = new StanzaListener() {
@Override @Override
public void processStanza(Stanza stanza) { public void processStanza(Stanza stanza) {
OriginIdElement.addOriginId((Message) stanza); OriginIdElement.addOriginId((Message) stanza);
@ -92,7 +92,7 @@ public final class StableUniqueStanzaIdManager extends Manager {
public synchronized void enable() { public synchronized void enable() {
ServiceDiscoveryManager.getInstanceFor(connection()).addFeature(NAMESPACE); ServiceDiscoveryManager.getInstanceFor(connection()).addFeature(NAMESPACE);
StanzaFilter filter = new AndFilter(OUTGOING_FILTER, new NotFilter(OUTGOING_FILTER)); StanzaFilter filter = new AndFilter(OUTGOING_FILTER, new NotFilter(OUTGOING_FILTER));
connection().addStanzaInterceptor(stanzaListener, filter); connection().addStanzaInterceptor(ADD_ORIGIN_ID_INTERCEPTOR, filter);
} }
/** /**
@ -100,7 +100,7 @@ public final class StableUniqueStanzaIdManager extends Manager {
*/ */
public synchronized void disable() { public synchronized void disable() {
ServiceDiscoveryManager.getInstanceFor(connection()).removeFeature(NAMESPACE); ServiceDiscoveryManager.getInstanceFor(connection()).removeFeature(NAMESPACE);
connection().removeStanzaInterceptor(stanzaListener); connection().removeStanzaInterceptor(ADD_ORIGIN_ID_INTERCEPTOR);
} }
/** /**