mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 22:12:05 +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,8 +407,26 @@ class PacketReader {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Set basic values on the iq packet.
|
||||
// Decide what to do when an IQ packet was not understood
|
||||
if (iqPacket == null) {
|
||||
if (IQ.Type.GET == type || IQ.Type.SET == type ) {
|
||||
// If the IQ stanza is of type "get" or "set" containing a child element
|
||||
// qualified by a namespace it does not understand, then answer an IQ of
|
||||
// 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() {
|
||||
|
@ -416,6 +434,9 @@ class PacketReader {
|
|||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Set basic values on the iq packet.
|
||||
iqPacket.setPacketID(id);
|
||||
iqPacket.setTo(to);
|
||||
iqPacket.setFrom(from);
|
||||
|
|
Loading…
Reference in a new issue