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 ...@@ -78,7 +78,6 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
private List<Element> anonymousUserIdentities = new ArrayList<>(); private List<Element> anonymousUserIdentities = new ArrayList<>();
private List<Element> registeredUserIdentities = new ArrayList<>(); private List<Element> registeredUserIdentities = new ArrayList<>();
private List<String> userFeatures = new ArrayList<>();
public IQDiscoInfoHandler() { public IQDiscoInfoHandler() {
super("XMPP Disco Info Handler"); super("XMPP Disco Info Handler");
...@@ -93,7 +92,6 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene ...@@ -93,7 +92,6 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
userIdentity.addAttribute("category", "account"); userIdentity.addAttribute("category", "account");
userIdentity.addAttribute("type", "registered"); userIdentity.addAttribute("type", "registered");
registeredUserIdentities.add(userIdentity); registeredUserIdentities.add(userIdentity);
userFeatures.add(NAMESPACE_DISCO_INFO);
} }
@Override @Override
...@@ -428,7 +426,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene ...@@ -428,7 +426,7 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
// Redirect the request to the disco info provider of the specified node // Redirect the request to the disco info provider of the specified node
return serverNodeProviders.get(node).getIdentities(name, node, senderJID); 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 // Answer identity of the server
synchronized (identities) { synchronized (identities) {
if (identities.isEmpty()) { if (identities.isEmpty()) {
...@@ -467,15 +465,9 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene ...@@ -467,15 +465,9 @@ public class IQDiscoInfoHandler extends IQHandler implements ClusterEventListene
// Redirect the request to the disco info provider of the specified node // Redirect the request to the disco info provider of the specified node
return serverNodeProviders.get(node).getFeatures(name, node, senderJID); return serverNodeProviders.get(node).getFeatures(name, node, senderJID);
} }
if (name == null) {
// Answer features of the server // Answer features of the server
return new HashSet<>(serverFeatures.keySet()).iterator(); return new HashSet<>(serverFeatures.keySet()).iterator();
} }
else {
// Answer features of the user
return userFeatures.iterator();
}
}
@Override @Override
public boolean hasInfo(String name, String node, JID senderJID) { public boolean hasInfo(String name, String node, JID senderJID) {
......
...@@ -116,7 +116,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -116,7 +116,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
// DiscoItemsProvider responsibility to provide the items associated with the JID's name // DiscoItemsProvider responsibility to provide the items associated with the JID's name
// together with any possible requested node. // together with any possible requested node.
DiscoItemsProvider itemsProvider = getProvider(packet.getTo() == null ? 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) { if (itemsProvider != null) {
// Get the JID's name // Get the JID's name
String name = packet.getTo() == null ? null : packet.getTo().getNode(); 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