1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 10:37:59 +01:00

Ensure that IQ response 'to' address and ID are set correctly

Fixes SMACK-845.
This commit is contained in:
Florian Schmaus 2018-12-14 17:18:53 +01:00
parent 5ddaa623da
commit f6da386dea

View file

@ -1097,6 +1097,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
if (packet instanceof IQ) {
final IQ iq = (IQ) packet;
if (iq.isRequestIQ()) {
final IQ iqRequest = iq;
final String key = XmppStringUtils.generateKey(iq.getChildElementName(), iq.getChildElementNamespace());
IQRequestHandler iqRequestHandler;
final IQ.Type type = iq.getType();
@ -1162,6 +1163,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// e.g. to avoid presence leaks.
return;
}
assert (response.getType() == IQ.Type.result || response.getType() == IQ.Type.error);
response.setTo(iqRequest.getFrom());
response.setStanzaId(iqRequest.getStanzaId());
try {
sendStanza(response);
}