Commit 0fd07881 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Fixed incorrect namespace.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@648 b35dd754-fafc-0310-a699-88a17e54d16e
parent 2a90f667
...@@ -22,6 +22,7 @@ import java.util.Iterator; ...@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.QName;
import org.xmpp.packet.IQ; import org.xmpp.packet.IQ;
import org.xmpp.packet.PacketError; import org.xmpp.packet.PacketError;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
...@@ -99,16 +100,14 @@ public class IQDiscoInfoHandler extends IQHandler { ...@@ -99,16 +100,14 @@ public class IQDiscoInfoHandler extends IQHandler {
Iterator identities = infoProvider.getIdentities(name, node, packet.getFrom()); Iterator identities = infoProvider.getIdentities(name, node, packet.getFrom());
while (identities.hasNext()) { while (identities.hasNext()) {
identity = (Element)identities.next(); identity = (Element)identities.next();
identity.setQName(new QName(identity.getName(), queryElement.getNamespace()));
queryElement.add((Element)identity.clone()); queryElement.add((Element)identity.clone());
} }
// Add to the reply all the features provided by the DiscoInfoProvider // Add to the reply all the features provided by the DiscoInfoProvider
Element featureElement;
Iterator features = infoProvider.getFeatures(name, node, packet.getFrom()); Iterator features = infoProvider.getFeatures(name, node, packet.getFrom());
while (features.hasNext()) { while (features.hasNext()) {
featureElement = DocumentHelper.createElement("feature"); queryElement.addElement("feature").addAttribute("var", (String)features.next());
featureElement.addAttribute("var", (String)features.next());
queryElement.add(featureElement);
} }
// Add to the reply the extended info (XDataForm) provided by the DiscoInfoProvider // Add to the reply the extended info (XDataForm) provided by the DiscoInfoProvider
......
...@@ -17,6 +17,7 @@ import java.util.Iterator; ...@@ -17,6 +17,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.QName;
import org.jivesoftware.messenger.IQHandlerInfo; import org.jivesoftware.messenger.IQHandlerInfo;
import org.jivesoftware.messenger.XMPPServer; import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.spi.BasicServer; import org.jivesoftware.messenger.spi.BasicServer;
...@@ -52,7 +53,7 @@ import org.xmpp.packet.PacketError; ...@@ -52,7 +53,7 @@ import org.xmpp.packet.PacketError;
public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProvider { public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProvider {
private HashMap entities = new HashMap(); private HashMap entities = new HashMap();
private List serverItems = new ArrayList(); private List<Element> serverItems = new ArrayList<Element>();
private IQHandlerInfo info; private IQHandlerInfo info;
private IQDiscoInfoHandler infoHandler; private IQDiscoInfoHandler infoHandler;
...@@ -100,15 +101,16 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -100,15 +101,16 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
//String node = metaData.getProperty("query:node"); //String node = metaData.getProperty("query:node");
// Check if we have items associated with the requested name and node // Check if we have items associated with the requested name and node
Iterator itemsItr = itemsProvider.getItems(name, node, packet.getFrom()); Iterator<Element> itemsItr = itemsProvider.getItems(name, node, packet.getFrom());
if (itemsItr != null) { if (itemsItr != null) {
Element queryElement = reply.getChildElement(); Element queryElement = reply.getChildElement();
// Add to the reply all the items provided by the DiscoItemsProvider // Add to the reply all the items provided by the DiscoItemsProvider
Element item; Element item;
while (itemsItr.hasNext()) { while (itemsItr.hasNext()) {
item = (Element)itemsItr.next(); item = itemsItr.next();
queryElement.add((Element)item.clone()); item.setQName(new QName(item.getName(), queryElement.getNamespace()));
queryElement.add(item.createCopy());
} }
; ;
} }
...@@ -211,7 +213,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -211,7 +213,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
private DiscoItemsProvider getServerItemsProvider() { private DiscoItemsProvider getServerItemsProvider() {
DiscoItemsProvider discoItemsProvider = new DiscoItemsProvider() { DiscoItemsProvider discoItemsProvider = new DiscoItemsProvider() {
public Iterator getItems(String name, String node, JID senderJID) public Iterator<Element> getItems(String name, String node, JID senderJID)
throws UnauthorizedException { throws UnauthorizedException {
return serverItems.iterator(); return serverItems.iterator();
} }
......
...@@ -17,6 +17,7 @@ import java.util.Iterator; ...@@ -17,6 +17,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.QName;
import org.jivesoftware.messenger.forms.FormField; import org.jivesoftware.messenger.forms.FormField;
/** /**
...@@ -64,7 +65,7 @@ public class XFormFieldImpl implements FormField { ...@@ -64,7 +65,7 @@ public class XFormFieldImpl implements FormField {
} }
public Element asXMLElement() { public Element asXMLElement() {
Element field = DocumentHelper.createElement("field"); Element field = DocumentHelper.createElement(QName.get("field", "jabber:x:data"));
if (getLabel() != null) { if (getLabel() != null) {
field.addAttribute("label", getLabel()); field.addAttribute("label", getLabel());
} }
......
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