feat(xep): Set the resource if SASL2 resulted in a resource
This commit is contained in:
parent
cf425917cf
commit
564a237986
@ -1,4 +1,5 @@
|
|||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:moxxmpp/src/jid.dart';
|
||||||
import 'package:moxxmpp/src/namespaces.dart';
|
import 'package:moxxmpp/src/namespaces.dart';
|
||||||
import 'package:moxxmpp/src/negotiators/namespaces.dart';
|
import 'package:moxxmpp/src/negotiators/namespaces.dart';
|
||||||
import 'package:moxxmpp/src/negotiators/negotiator.dart';
|
import 'package:moxxmpp/src/negotiators/negotiator.dart';
|
||||||
@ -233,6 +234,15 @@ class Sasl2Negotiator extends XmppFeatureNegotiatorBase {
|
|||||||
// We're done
|
// We're done
|
||||||
attributes.setAuthenticated();
|
attributes.setAuthenticated();
|
||||||
attributes.removeNegotiatingFeature(saslXmlns);
|
attributes.removeNegotiatingFeature(saslXmlns);
|
||||||
|
|
||||||
|
// Check if we also received a resource with the SASL2 success
|
||||||
|
final jid = JID.fromString(
|
||||||
|
nonza.firstTag('authorization-identifier')!.innerText(),
|
||||||
|
);
|
||||||
|
if (!jid.isBare()) {
|
||||||
|
attributes.setResource(jid.resource);
|
||||||
|
}
|
||||||
|
|
||||||
return const Result(NegotiatorState.done);
|
return const Result(NegotiatorState.done);
|
||||||
} else if (nonza.tag == 'challenge') {
|
} else if (nonza.tag == 'challenge') {
|
||||||
// We still have to negotiate
|
// We still have to negotiate
|
||||||
|
Loading…
Reference in New Issue
Block a user