mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
Make IQRequestHandler the only option to handle IQ requests
Previously StanzaListeners and Collectors where able to receive IQ of type 'get' or 'set' (i.e., IQ requests) when no IQRequestHandler was registered. By moving the 'return' statement one level down, even listeners/collectors won't receive them.
This commit is contained in:
parent
9bb0ed150b
commit
8020fc1416
1 changed files with 6 additions and 11 deletions
|
@ -1026,12 +1026,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
protected void invokeStanzaCollectorsAndNotifyRecvListeners(final Stanza packet) {
|
protected void invokeStanzaCollectorsAndNotifyRecvListeners(final Stanza packet) {
|
||||||
if (packet instanceof IQ) {
|
if (packet instanceof IQ) {
|
||||||
final IQ iq = (IQ) packet;
|
final IQ iq = (IQ) packet;
|
||||||
final IQ.Type type = iq.getType();
|
if (iq.isRequestIQ()) {
|
||||||
switch (type) {
|
|
||||||
case set:
|
|
||||||
case get:
|
|
||||||
final String key = XmppStringUtils.generateKey(iq.getChildElementName(), iq.getChildElementNamespace());
|
final String key = XmppStringUtils.generateKey(iq.getChildElementName(), iq.getChildElementNamespace());
|
||||||
IQRequestHandler iqRequestHandler = null;
|
IQRequestHandler iqRequestHandler = null;
|
||||||
|
final IQ.Type type = iq.getType();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case set:
|
case set:
|
||||||
synchronized (setIqRequestHandler) {
|
synchronized (setIqRequestHandler) {
|
||||||
|
@ -1102,15 +1100,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
// The following returns makes it impossible for packet listeners and collectors to
|
// The following returns makes it impossible for packet listeners and collectors to
|
||||||
// filter for IQ request stanzas, i.e. IQs of type 'set' or 'get'. This is the
|
// filter for IQ request stanzas, i.e. IQs of type 'set' or 'get'. This is the
|
||||||
// desired behavior.
|
// desired behavior.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// First handle the async recv listeners. Note that this code is very similar to what follows a few lines below,
|
// First handle the async recv listeners. Note that this code is very similar to what follows a few lines below,
|
||||||
|
|
Loading…
Reference in a new issue