mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-16 12:12:06 +01:00
Answers a "not implemented" error when the IQ is not understood
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2220 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
14896e4d31
commit
5168a66d71
1 changed files with 28 additions and 7 deletions
|
@ -407,15 +407,36 @@ class PacketReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set basic values on the iq packet.
|
// Decide what to do when an IQ packet was not understood
|
||||||
if (iqPacket == null) {
|
if (iqPacket == null) {
|
||||||
// If an IQ packet wasn't created above, create an empty IQ packet.
|
if (IQ.Type.GET == type || IQ.Type.SET == type ) {
|
||||||
iqPacket = new IQ() {
|
// If the IQ stanza is of type "get" or "set" containing a child element
|
||||||
public String getChildElementXML() {
|
// qualified by a namespace it does not understand, then answer an IQ of
|
||||||
return null;
|
// type "error" with code 501 ("feature-not-implemented")
|
||||||
}
|
iqPacket = new IQ() {
|
||||||
};
|
public String getChildElementXML() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
iqPacket.setPacketID(id);
|
||||||
|
iqPacket.setTo(from);
|
||||||
|
iqPacket.setFrom(to);
|
||||||
|
iqPacket.setType(IQ.Type.ERROR);
|
||||||
|
iqPacket.setError(new XMPPError(501, "feature-not-implemented"));
|
||||||
|
connection.sendPacket(iqPacket);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If an IQ packet wasn't created above, create an empty IQ packet.
|
||||||
|
iqPacket = new IQ() {
|
||||||
|
public String getChildElementXML() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set basic values on the iq packet.
|
||||||
iqPacket.setPacketID(id);
|
iqPacket.setPacketID(id);
|
||||||
iqPacket.setTo(to);
|
iqPacket.setTo(to);
|
||||||
iqPacket.setFrom(from);
|
iqPacket.setFrom(from);
|
||||||
|
|
Loading…
Reference in a new issue