matchesFeature method

  1. @override
bool matchesFeature(
  1. List<XMLNode> features
)
override

Returns true if a feature in features, which are the children of the <stream:features /> nonza, can be negotiated. Otherwise, returns false.

Implementation

@override
bool matchesFeature(List<XMLNode> features) {
  final sm = attributes.getManagerById<StreamManagementManager>(smManager)!;

  if (sm.state.streamResumptionId != null && !_resumeFailed) {
    // We could do Stream resumption
    return super.matchesFeature(features) &&
        attributes.isAuthenticated() &&
        resource.isNotEmpty;
  } else {
    // We cannot do a stream resumption
    return super.matchesFeature(features) &&
        attributes.getConnection().resource.isNotEmpty &&
        attributes.isAuthenticated();
  }
}