1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-17 17:04:49 +02: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:
Gaston Dombiak 2004-01-29 22:02:50 +00:00 committed by gdombiak
parent 14896e4d31
commit 5168a66d71

View file

@ -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);