isFeatureSupported method

  1. @protected
Future<bool> isFeatureSupported(
  1. String xmlns
)

Resolves to true when the server supports the disco feature xmlns. Resolves to false when either the disco request fails or the server does not support xmlns. Note that this function requires a registered DiscoManager.

Implementation

@protected
Future<bool> isFeatureSupported(String xmlns) async {
  final dm = _managerAttributes.getManagerById<DiscoManager>(discoManager);
  assert(
    dm != null,
    'The DiscoManager must be registered for isFeatureSupported to work',
  );

  final result = await dm!.discoInfoQuery(
    _managerAttributes.getConnectionSettings().jid.toDomain(),
  );
  if (result.isType<DiscoError>()) {
    return false;
  }

  return result.get<DiscoInfo>().features.contains(xmlns);
}