Smack 4.2.0-beta3 AbstractXMPPConnection#parseFeatures missing case for stream feature <register xmlns='http://jabber.org/features/iq-register'/>

For XMPP server that supports “iq-register”, following stream:features/ is send during initial connection:

01-01 07:13:53.675 11086-26982/org.atalk.android D/SMACK: RECV (5): stream:featuresSCRAM-SHA-1PLAINX-OAUTH2</stream:fea tures>

However Smack AbstractXMPPConnection#parseFeatures method does not include a case to capture the stream feature as attached below:

/** ======================================================

protected final void parseFeatures(XmlPullParser parser) throws Exception {
streamFeatures.clear();
final int initialDepth = parser.getDepth();
while (true) {
int eventType = parser.next();

if (eventType == XmlPullParser.START_TAG && parser.getDepth() == initialDepth + 1) {
ExtensionElement streamFeature = null;
String name = parser.getName();
String namespace = parser.getNamespace();
switch (name) {
case StartTls.ELEMENT:
streamFeature = PacketParserUtils.parseStartTlsFeature(parser);
break;
case Mechanisms.ELEMENT:
streamFeature = new Mechanisms(PacketParserUtils.parseMechanisms(parser));
break;
case Bind.ELEMENT:
streamFeature = Bind.Feature.INSTANCE;
break;
case Session.ELEMENT:
streamFeature = PacketParserUtils.parseSessionFeature(parser);
break;
case Compress.Feature.ELEMENT:
streamFeature = PacketParserUtils.parseCompressionFeature(parser);
break;
default:
ExtensionElementProvider provider = ProviderManager.getStreamFeatureProvider(name, namespace);
if (provider != null) {
streamFeature = provider.parse(parser);
}
break;
}
if (streamFeature != null) {
addStreamFeature(streamFeature);
}
}
else if (eventType == XmlPullParser.END_TAG && parser.getDepth() == initialDepth) {
break;
}
}

==================================================== **/

Also the AccountManager#isSupported is checking against this feature using

public static final String ELEMENT = “query”;
public static final String NAMESPACE = “jabber:iq:register”;

//====================================================================

public boolean isSupported()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
XMPPConnection connection = connection();

ExtensionElement extensionElement = connection.getFeature(Registration.ELEMENT, Registration.NAMESPACE);
if (extensionElement != null) {
return true;
}

return ServiceDiscoveryManager.getInstanceFor(connection).serverSupportsFeature(Registration.NAMESPACE);
}

cont …

where extensionElement is always null.

Should the isSupported() method uses

ExtensionElement extensionElement = connection.getFeature(ELEMENT, NAMESPACE);

with the following definition.

public static final String ELEMENT = “register”;

public static final String NAMESPACE = “http://jabber.org/features/iq-register”;

cont…

or accountCreationSupported should be set when the

is received.

Sorry for the fragmented messages, accidentally press control-S to save draft…

However Smack AbstractXMPPConnection#parseFeatures method does not include a case to capture the stream feature

It doesn’t need to, the ‘default’ case is used. The stream feature is parsed via a stream future provider.

Thanks for the clarification.

However there is something I cannot understand while trying to implement InBand Registration for aTalk.

When I made access to the method AccountManager#isSupported(), and it contains the following statement:

ExtensionElement extensionElement = connection.getFeature(Registration.ELEMENT, Registration.NAMESPACE);

which uses connection.getFeature(…) that made access to the AbstractXmppConnection parameter i.e. protected final Map<String, ExtensionElement> streamFeatures = new HashMap<>();

Using Android Studio, I found that the “streamFeatures” map gets setup only in AbstractXmppConnection class and the above statement always hold true for (extensionElement == null). May I know which Smack class is actually made access to

connection.addFeature(Registration.ELEMENT, Registration.NAMESPACE)

Also when I made access to AccountManager#supportsAccountCreation(), the accountCreationSupported is always false. I am also unable to trace where this accountCreationSupported flag is being set.

.