1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-23 06:42:05 +01:00

Allows a disco#info packet to include a dataform. SMACK-153

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2382 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2004-09-19 16:20:10 +00:00 committed by gdombiak
parent f103a16a07
commit c396be83d1
2 changed files with 9 additions and 1 deletions

View file

@ -180,6 +180,8 @@ public class DiscoverInfo extends IQ {
buf.append(feature.toXML()); buf.append(feature.toXML());
} }
} }
// Add packet extensions, if any are defined.
buf.append(getExtensionsXML());
buf.append("</query>"); buf.append("</query>");
return buf.toString(); return buf.toString();
} }

View file

@ -54,6 +54,7 @@ package org.jivesoftware.smackx.provider;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.packet.DiscoverInfo; import org.jivesoftware.smackx.packet.DiscoverInfo;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
@ -83,10 +84,15 @@ public class DiscoverInfoProvider implements IQProvider {
name = parser.getAttributeValue("", "name"); name = parser.getAttributeValue("", "name");
type = parser.getAttributeValue("", "type"); type = parser.getAttributeValue("", "type");
} }
if (parser.getName().equals("feature")) { else if (parser.getName().equals("feature")) {
// Initialize the variables from the parsed XML // Initialize the variables from the parsed XML
variable = parser.getAttributeValue("", "var"); variable = parser.getAttributeValue("", "var");
} }
// Otherwise, it must be a packet extension.
else {
discoverInfo.addExtension(PacketParserUtils.parsePacketExtension(parser
.getName(), parser.getNamespace(), parser));
}
} else if (eventType == XmlPullParser.END_TAG) { } else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("identity")) { if (parser.getName().equals("identity")) {
// Create a new identity and add it to the discovered info. // Create a new identity and add it to the discovered info.