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

Fixed incorrect format answer when returning affiliates or subscriptions. JM-708

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3957 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8835574a
...@@ -1870,12 +1870,13 @@ public abstract class Node { ...@@ -1870,12 +1870,13 @@ public abstract class Node {
IQ reply = IQ.createResultIQ(iqRequest); IQ reply = IQ.createResultIQ(iqRequest);
Element childElement = iqRequest.getChildElement().createCopy(); Element childElement = iqRequest.getChildElement().createCopy();
reply.setChildElement(childElement); reply.setChildElement(childElement);
Element affiliations = childElement.element("affiliations");
for (NodeAffiliate affiliate : affiliates) { for (NodeAffiliate affiliate : affiliates) {
if (affiliate.getAffiliation() == NodeAffiliate.Affiliation.none) { if (affiliate.getAffiliation() == NodeAffiliate.Affiliation.none) {
continue; continue;
} }
Element entity = childElement.addElement("affiliation"); Element entity = affiliations.addElement("affiliation");
entity.addAttribute("jid", affiliate.getJID().toString()); entity.addAttribute("jid", affiliate.getJID().toString());
entity.addAttribute("affiliation", affiliate.getAffiliation().name()); entity.addAttribute("affiliation", affiliate.getAffiliation().name());
} }
...@@ -1893,13 +1894,14 @@ public abstract class Node { ...@@ -1893,13 +1894,14 @@ public abstract class Node {
IQ reply = IQ.createResultIQ(iqRequest); IQ reply = IQ.createResultIQ(iqRequest);
Element childElement = iqRequest.getChildElement().createCopy(); Element childElement = iqRequest.getChildElement().createCopy();
reply.setChildElement(childElement); reply.setChildElement(childElement);
Element subscriptions = childElement.element("subscriptions");
for (NodeAffiliate affiliate : affiliates) { for (NodeAffiliate affiliate : affiliates) {
for (NodeSubscription subscription : affiliate.getSubscriptions()) { for (NodeSubscription subscription : affiliate.getSubscriptions()) {
if (subscription.isAuthorizationPending()) { if (subscription.isAuthorizationPending()) {
continue; continue;
} }
Element entity = childElement.addElement("subscription"); Element entity = subscriptions.addElement("subscription");
entity.addAttribute("jid", subscription.getJID().toString()); entity.addAttribute("jid", subscription.getJID().toString());
//entity.addAttribute("affiliation", affiliate.getAffiliation().name()); //entity.addAttribute("affiliation", affiliate.getAffiliation().name());
entity.addAttribute("subscription", subscription.getState().name()); entity.addAttribute("subscription", subscription.getState().name());
......
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