powered by Jive Software

Service Discovery extensions (JEP-0128)

I’‘m trying to use JEP-0128, which basically just uses a data form to extend a service discovery info response. I thought Smack would be able to handle this without modification, but the DiscoverInfo object I get from the ServiceDiscoveryManager has no extension (even though it’‘s definitely present in the XML). DiscoverInfoProvider just ignores any tags that aren’‘t “identity” or “feature”. Shouldn’'t IQ providers always parse unrecognized tags into PacketExtension objects, the way PacketReader does for message and presence packets? Is there a way for me to add this besides just registering my own DiscoverInfoProvider with the ProviderManager?

Doug,

As you have noticed JEP-128 has not been implemented yet although the pieces are just there. A few weeks ago I created a Jira issue (our bug tracking tool) and added it for the next release.

I didn’‘t test the following code but maybe it’'s all that we need to have JEP-128 implemented. Modify the DiscoverInfoProvider.parseIQ() method:

if (eventType == XmlPullParser.START_TAG) {
        if (parser.getName().equals("identity")) {
            // Initialize the variables from the parsed XML
            category = parser.getAttributeValue("", "category");
            name = parser.getAttributeValue("", "name");
            type = parser.getAttributeValue("", "type");
        }
        else if (parser.getName().equals("feature")) {
            // Initialize the variables from the parsed XML
            variable = parser.getAttributeValue("", "var");
        }
        // ADDED CODE! Also replaced the above if with an else if
        // Otherwise, it must be a packet extension.
        else {
            discoverInfo.addExtension(PacketParserUtils.parsePacketExtension(parser
                    .getName(), parser.getNamespace(), parser));
        }

Regards,

– Gato

Doug,

This feature has just been implemented. You can try downloading tomorrow’'s daily build to get the latest code.

Regards,

– Gato