Commit 1ba9c8a3 authored by Dave Cridland's avatar Dave Cridland

Merge pull request #516 from sco0ter/of462

OF-462 PEP should process IQ-gets that have no 'to' attribute.
parents 9e966176 95f40ab7
......@@ -78,7 +78,6 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
private List<Element> anonymousUserIdentities = new ArrayList<>();
private List<Element> registeredUserIdentities = new ArrayList<>();
private List<String> userFeatures = new ArrayList<>();
public IQDiscoInfoHandler() {
super("XMPP Disco Info Handler");
......@@ -93,7 +92,6 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
userIdentity.addAttribute("category", "account");
userIdentity.addAttribute("type", "registered");
registeredUserIdentities.add(userIdentity);
userFeatures.add(NAMESPACE_DISCO_INFO);
}
@Override
......@@ -428,7 +426,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
// Redirect the request to the disco info provider of the specified node
return serverNodeProviders.get(node).getIdentities(name, node, senderJID);
}
if (name == null) {
if (name != null && name.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
// Answer identity of the server
synchronized (identities) {
if (identities.isEmpty()) {
......@@ -467,14 +465,8 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
// Redirect the request to the disco info provider of the specified node
return serverNodeProviders.get(node).getFeatures(name, node, senderJID);
}
if (name == null) {
// Answer features of the server
return new HashSet<>(serverFeatures.keySet()).iterator();
}
else {
// Answer features of the user
return userFeatures.iterator();
}
// Answer features of the server
return new HashSet<>(serverFeatures.keySet()).iterator();
}
@Override
......
......@@ -116,7 +116,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
// DiscoItemsProvider responsibility to provide the items associated with the JID's name
// together with any possible requested node.
DiscoItemsProvider itemsProvider = getProvider(packet.getTo() == null ?
XMPPServer.getInstance().getServerInfo().getXMPPDomain() : packet.getTo().getDomain());
packet.getFrom().getNode() : packet.getTo().getNode() != null ? packet.getTo().getNode() : packet.getTo().getDomain());
if (itemsProvider != null) {
// Get the JID's name
String name = packet.getTo() == null ? null : packet.getTo().getNode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment