Answer an item-not-found error when Smack receives a disco#info and node is not null. SMACK-8

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2402 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2004-10-31 03:35:20 +00:00 committed by gaston
parent d7668b3dcc
commit 207c0aea02
1 changed files with 17 additions and 9 deletions

View File

@ -218,17 +218,25 @@ public class ServiceDiscoveryManager {
response.setType(IQ.Type.RESULT); response.setType(IQ.Type.RESULT);
response.setTo(discoverInfo.getFrom()); response.setTo(discoverInfo.getFrom());
response.setPacketID(discoverInfo.getPacketID()); response.setPacketID(discoverInfo.getPacketID());
// Set this client identity // Add the client's identity and features only if "node" is null
DiscoverInfo.Identity identity = new DiscoverInfo.Identity("client", if (discoverInfo.getNode() == null) {
getIdentityName()); // Set this client identity
identity.setType(getIdentityType()); DiscoverInfo.Identity identity = new DiscoverInfo.Identity("client",
response.addIdentity(identity); getIdentityName());
// Add the registered features to the response identity.setType(getIdentityType());
synchronized (features) { response.addIdentity(identity);
for (Iterator it = getFeatures(); it.hasNext();) { // Add the registered features to the response
response.addFeature((String) it.next()); synchronized (features) {
for (Iterator it = getFeatures(); it.hasNext();) {
response.addFeature((String) it.next());
}
} }
} }
else {
// Return an <item-not-found/> error since a client doesn't have nodes
response.setType(IQ.Type.ERROR);
response.setError(new XMPPError(404, "item-not-found"));
}
connection.sendPacket(response); connection.sendPacket(response);
} }
} }