1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +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) { if (packet instanceof IQ) {
final IQ iq = (IQ) packet; final IQ iq = (IQ) packet;
if (iq.isRequestIQ()) { if (iq.isRequestIQ()) {
final IQ iqRequest = iq;
final String key = XmppStringUtils.generateKey(iq.getChildElementName(), iq.getChildElementNamespace()); final String key = XmppStringUtils.generateKey(iq.getChildElementName(), iq.getChildElementNamespace());
IQRequestHandler iqRequestHandler; IQRequestHandler iqRequestHandler;
final IQ.Type type = iq.getType(); final IQ.Type type = iq.getType();
@ -1162,6 +1163,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// e.g. to avoid presence leaks. // e.g. to avoid presence leaks.
return; return;
} }
assert (response.getType() == IQ.Type.result || response.getType() == IQ.Type.error);
response.setTo(iqRequest.getFrom());
response.setStanzaId(iqRequest.getStanzaId());
try { try {
sendStanza(response); sendStanza(response);
} }