Commit cec7c04c authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Return an empry result instead of an error when no subscriptions were found. JM-1395

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10544 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1d220323
...@@ -850,27 +850,21 @@ public class PubSubEngine { ...@@ -850,27 +850,21 @@ public class PubSubEngine {
IQ reply = IQ.createResultIQ(iq); IQ reply = IQ.createResultIQ(iq);
Element replyChildElement = childElement.createCopy(); Element replyChildElement = childElement.createCopy();
reply.setChildElement(replyChildElement); reply.setChildElement(replyChildElement);
if (subscriptions.isEmpty()) { Element affiliationsElement = replyChildElement.element("subscriptions");
// User does not have any affiliation or subscription with the pubsub service // Add information about subscriptions including existing affiliations
reply.setError(PacketError.Condition.item_not_found); for (NodeSubscription subscription : subscriptions) {
} Element subElement = affiliationsElement.addElement("subscription");
else { Node node = subscription.getNode();
Element affiliationsElement = replyChildElement.element("subscriptions"); NodeAffiliate nodeAffiliate = subscription.getAffiliate();
// Add information about subscriptions including existing affiliations // Do not include the node id when node is the root collection node
for (NodeSubscription subscription : subscriptions) { if (!node.isRootCollectionNode()) {
Element subElement = affiliationsElement.addElement("subscription"); subElement.addAttribute("node", node.getNodeID());
Node node = subscription.getNode(); }
NodeAffiliate nodeAffiliate = subscription.getAffiliate(); subElement.addAttribute("jid", subscription.getJID().toString());
// Do not include the node id when node is the root collection node subElement.addAttribute("affiliation", nodeAffiliate.getAffiliation().name());
if (!node.isRootCollectionNode()) { subElement.addAttribute("subscription", subscription.getState().name());
subElement.addAttribute("node", node.getNodeID()); if (node.isMultipleSubscriptionsEnabled()) {
} subElement.addAttribute("subid", subscription.getID());
subElement.addAttribute("jid", subscription.getJID().toString());
subElement.addAttribute("affiliation", nodeAffiliate.getAffiliation().name());
subElement.addAttribute("subscription", subscription.getState().name());
if (node.isMultipleSubscriptionsEnabled()) {
subElement.addAttribute("subid", subscription.getID());
}
} }
} }
// Send reply // Send reply
......
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