onSasl2FeaturesReceived method
- XMLNode sasl2Features
override
Called by the SASL2 negotiator when we received the SASL2 stream features
sasl2Features
. The return value is a list of XML elements that should be
added to the SASL2
Implementation
@override
Future<List<XMLNode>> onSasl2FeaturesReceived(XMLNode sasl2Features) async {
final children = List<XMLNode>.empty(growable: true);
if (_negotiators.isNotEmpty) {
final inline = sasl2Features
.firstTag('inline')!
.firstTag('bind', xmlns: bind2Xmlns)!
.firstTag('inline');
if (inline != null) {
final features = inline.children
.where((child) => child.tag == 'feature')
.map((child) => child.attributes['var']! as String)
.toList();
// Only call the negotiators if Bind2 allows doing stuff inline
for (final negotiator in _negotiators) {
children.addAll(await negotiator.onBind2FeaturesReceived(features));
}
}
}
return [
XMLNode.xmlns(
tag: 'bind',
xmlns: bind2Xmlns,
children: [
if (tag != null)
XMLNode(
tag: 'tag',
text: tag,
),
...children,
],
),
];
}