fix(xep): Just receiving <stanza-id/>s does not require disco

It is only required when we try to use them.
This commit is contained in:
PapaTutuWawa 2023-05-25 12:42:42 +02:00
parent b949ec6ff5
commit 1475cb542f
6 changed files with 294 additions and 245 deletions

View File

@ -79,12 +79,13 @@ class MessageEvent extends XmppEvent {
required this.fromJid, required this.fromJid,
required this.toJid, required this.toJid,
required this.sid, required this.sid,
required this.stanzaId,
required this.isCarbon, required this.isCarbon,
required this.deliveryReceiptRequested, required this.deliveryReceiptRequested,
required this.isMarkable, required this.isMarkable,
required this.encrypted, required this.encrypted,
required this.other, required this.other,
this.originId,
this.stanzaIds,
this.error, this.error,
this.type, this.type,
this.oob, this.oob,
@ -107,7 +108,8 @@ class MessageEvent extends XmppEvent {
final JID toJid; final JID toJid;
final String sid; final String sid;
final String? type; final String? type;
final StableStanzaId stanzaId; final String? originId;
final List<StanzaId>? stanzaIds;
final bool isCarbon; final bool isCarbon;
final bool deliveryReceiptRequested; final bool deliveryReceiptRequested;
final bool isMarkable; final bool isMarkable;

View File

@ -34,7 +34,12 @@ class StanzaHandlerData with _$StanzaHandlerData {
StatelessMediaSharingData? sims, StatelessMediaSharingData? sims,
StatelessFileSharingData? sfs, StatelessFileSharingData? sfs,
OOBData? oob, OOBData? oob,
StableStanzaId? stableId,
// XEP-0359 <origin-id />'s id attribute, if available.
String? originId,
// XEP-0359 <stanza-id /> elements, if available.
List<StanzaId>? stanzaIds,
ReplyData? reply, ReplyData? reply,
ChatState? chatState, ChatState? chatState,
@Default(false) bool isCarbon, @Default(false) bool isCarbon,

View File

@ -1,7 +1,7 @@
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'data.dart'; part of 'data.dart';
@ -32,8 +32,11 @@ mixin _$StanzaHandlerData {
bool get retransmitted => throw _privateConstructorUsedError; bool get retransmitted => throw _privateConstructorUsedError;
StatelessMediaSharingData? get sims => throw _privateConstructorUsedError; StatelessMediaSharingData? get sims => throw _privateConstructorUsedError;
StatelessFileSharingData? get sfs => throw _privateConstructorUsedError; StatelessFileSharingData? get sfs => throw _privateConstructorUsedError;
OOBData? get oob => throw _privateConstructorUsedError; OOBData? get oob =>
StableStanzaId? get stableId => throw _privateConstructorUsedError; throw _privateConstructorUsedError; // XEP-0359 <origin-id />'s id attribute, if available.
String? get originId =>
throw _privateConstructorUsedError; // XEP-0359 <stanza-id /> elements, if available.
List<StanzaId>? get stanzaIds => throw _privateConstructorUsedError;
ReplyData? get reply => throw _privateConstructorUsedError; ReplyData? get reply => throw _privateConstructorUsedError;
ChatState? get chatState => throw _privateConstructorUsedError; ChatState? get chatState => throw _privateConstructorUsedError;
bool get isCarbon => throw _privateConstructorUsedError; bool get isCarbon => throw _privateConstructorUsedError;
@ -79,7 +82,8 @@ mixin _$StanzaHandlerData {
abstract class $StanzaHandlerDataCopyWith<$Res> { abstract class $StanzaHandlerDataCopyWith<$Res> {
factory $StanzaHandlerDataCopyWith( factory $StanzaHandlerDataCopyWith(
StanzaHandlerData value, $Res Function(StanzaHandlerData) then) = StanzaHandlerData value, $Res Function(StanzaHandlerData) then) =
_$StanzaHandlerDataCopyWithImpl<$Res>; _$StanzaHandlerDataCopyWithImpl<$Res, StanzaHandlerData>;
@useResult
$Res call( $Res call(
{bool done, {bool done,
bool cancel, bool cancel,
@ -89,7 +93,8 @@ abstract class $StanzaHandlerDataCopyWith<$Res> {
StatelessMediaSharingData? sims, StatelessMediaSharingData? sims,
StatelessFileSharingData? sfs, StatelessFileSharingData? sfs,
OOBData? oob, OOBData? oob,
StableStanzaId? stableId, String? originId,
List<StanzaId>? stanzaIds,
ReplyData? reply, ReplyData? reply,
ChatState? chatState, ChatState? chatState,
bool isCarbon, bool isCarbon,
@ -110,149 +115,156 @@ abstract class $StanzaHandlerDataCopyWith<$Res> {
} }
/// @nodoc /// @nodoc
class _$StanzaHandlerDataCopyWithImpl<$Res> class _$StanzaHandlerDataCopyWithImpl<$Res, $Val extends StanzaHandlerData>
implements $StanzaHandlerDataCopyWith<$Res> { implements $StanzaHandlerDataCopyWith<$Res> {
_$StanzaHandlerDataCopyWithImpl(this._value, this._then); _$StanzaHandlerDataCopyWithImpl(this._value, this._then);
final StanzaHandlerData _value;
// ignore: unused_field // ignore: unused_field
final $Res Function(StanzaHandlerData) _then; final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? done = freezed, Object? done = null,
Object? cancel = freezed, Object? cancel = null,
Object? cancelReason = freezed, Object? cancelReason = freezed,
Object? stanza = freezed, Object? stanza = null,
Object? retransmitted = freezed, Object? retransmitted = null,
Object? sims = freezed, Object? sims = freezed,
Object? sfs = freezed, Object? sfs = freezed,
Object? oob = freezed, Object? oob = freezed,
Object? stableId = freezed, Object? originId = freezed,
Object? stanzaIds = freezed,
Object? reply = freezed, Object? reply = freezed,
Object? chatState = freezed, Object? chatState = freezed,
Object? isCarbon = freezed, Object? isCarbon = null,
Object? deliveryReceiptRequested = freezed, Object? deliveryReceiptRequested = null,
Object? isMarkable = freezed, Object? isMarkable = null,
Object? fun = freezed, Object? fun = freezed,
Object? funReplacement = freezed, Object? funReplacement = freezed,
Object? funCancellation = freezed, Object? funCancellation = freezed,
Object? encrypted = freezed, Object? encrypted = null,
Object? forceEncryption = freezed, Object? forceEncryption = null,
Object? encryptionType = freezed, Object? encryptionType = freezed,
Object? delayedDelivery = freezed, Object? delayedDelivery = freezed,
Object? other = freezed, Object? other = null,
Object? messageRetraction = freezed, Object? messageRetraction = freezed,
Object? lastMessageCorrectionSid = freezed, Object? lastMessageCorrectionSid = freezed,
Object? messageReactions = freezed, Object? messageReactions = freezed,
Object? stickerPackId = freezed, Object? stickerPackId = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
done: done == freezed done: null == done
? _value.done ? _value.done
: done // ignore: cast_nullable_to_non_nullable : done // ignore: cast_nullable_to_non_nullable
as bool, as bool,
cancel: cancel == freezed cancel: null == cancel
? _value.cancel ? _value.cancel
: cancel // ignore: cast_nullable_to_non_nullable : cancel // ignore: cast_nullable_to_non_nullable
as bool, as bool,
cancelReason: cancelReason == freezed cancelReason: freezed == cancelReason
? _value.cancelReason ? _value.cancelReason
: cancelReason // ignore: cast_nullable_to_non_nullable : cancelReason // ignore: cast_nullable_to_non_nullable
as dynamic, as dynamic,
stanza: stanza == freezed stanza: null == stanza
? _value.stanza ? _value.stanza
: stanza // ignore: cast_nullable_to_non_nullable : stanza // ignore: cast_nullable_to_non_nullable
as Stanza, as Stanza,
retransmitted: retransmitted == freezed retransmitted: null == retransmitted
? _value.retransmitted ? _value.retransmitted
: retransmitted // ignore: cast_nullable_to_non_nullable : retransmitted // ignore: cast_nullable_to_non_nullable
as bool, as bool,
sims: sims == freezed sims: freezed == sims
? _value.sims ? _value.sims
: sims // ignore: cast_nullable_to_non_nullable : sims // ignore: cast_nullable_to_non_nullable
as StatelessMediaSharingData?, as StatelessMediaSharingData?,
sfs: sfs == freezed sfs: freezed == sfs
? _value.sfs ? _value.sfs
: sfs // ignore: cast_nullable_to_non_nullable : sfs // ignore: cast_nullable_to_non_nullable
as StatelessFileSharingData?, as StatelessFileSharingData?,
oob: oob == freezed oob: freezed == oob
? _value.oob ? _value.oob
: oob // ignore: cast_nullable_to_non_nullable : oob // ignore: cast_nullable_to_non_nullable
as OOBData?, as OOBData?,
stableId: stableId == freezed originId: freezed == originId
? _value.stableId ? _value.originId
: stableId // ignore: cast_nullable_to_non_nullable : originId // ignore: cast_nullable_to_non_nullable
as StableStanzaId?, as String?,
reply: reply == freezed stanzaIds: freezed == stanzaIds
? _value.stanzaIds
: stanzaIds // ignore: cast_nullable_to_non_nullable
as List<StanzaId>?,
reply: freezed == reply
? _value.reply ? _value.reply
: reply // ignore: cast_nullable_to_non_nullable : reply // ignore: cast_nullable_to_non_nullable
as ReplyData?, as ReplyData?,
chatState: chatState == freezed chatState: freezed == chatState
? _value.chatState ? _value.chatState
: chatState // ignore: cast_nullable_to_non_nullable : chatState // ignore: cast_nullable_to_non_nullable
as ChatState?, as ChatState?,
isCarbon: isCarbon == freezed isCarbon: null == isCarbon
? _value.isCarbon ? _value.isCarbon
: isCarbon // ignore: cast_nullable_to_non_nullable : isCarbon // ignore: cast_nullable_to_non_nullable
as bool, as bool,
deliveryReceiptRequested: deliveryReceiptRequested == freezed deliveryReceiptRequested: null == deliveryReceiptRequested
? _value.deliveryReceiptRequested ? _value.deliveryReceiptRequested
: deliveryReceiptRequested // ignore: cast_nullable_to_non_nullable : deliveryReceiptRequested // ignore: cast_nullable_to_non_nullable
as bool, as bool,
isMarkable: isMarkable == freezed isMarkable: null == isMarkable
? _value.isMarkable ? _value.isMarkable
: isMarkable // ignore: cast_nullable_to_non_nullable : isMarkable // ignore: cast_nullable_to_non_nullable
as bool, as bool,
fun: fun == freezed fun: freezed == fun
? _value.fun ? _value.fun
: fun // ignore: cast_nullable_to_non_nullable : fun // ignore: cast_nullable_to_non_nullable
as FileMetadataData?, as FileMetadataData?,
funReplacement: funReplacement == freezed funReplacement: freezed == funReplacement
? _value.funReplacement ? _value.funReplacement
: funReplacement // ignore: cast_nullable_to_non_nullable : funReplacement // ignore: cast_nullable_to_non_nullable
as String?, as String?,
funCancellation: funCancellation == freezed funCancellation: freezed == funCancellation
? _value.funCancellation ? _value.funCancellation
: funCancellation // ignore: cast_nullable_to_non_nullable : funCancellation // ignore: cast_nullable_to_non_nullable
as String?, as String?,
encrypted: encrypted == freezed encrypted: null == encrypted
? _value.encrypted ? _value.encrypted
: encrypted // ignore: cast_nullable_to_non_nullable : encrypted // ignore: cast_nullable_to_non_nullable
as bool, as bool,
forceEncryption: forceEncryption == freezed forceEncryption: null == forceEncryption
? _value.forceEncryption ? _value.forceEncryption
: forceEncryption // ignore: cast_nullable_to_non_nullable : forceEncryption // ignore: cast_nullable_to_non_nullable
as bool, as bool,
encryptionType: encryptionType == freezed encryptionType: freezed == encryptionType
? _value.encryptionType ? _value.encryptionType
: encryptionType // ignore: cast_nullable_to_non_nullable : encryptionType // ignore: cast_nullable_to_non_nullable
as ExplicitEncryptionType?, as ExplicitEncryptionType?,
delayedDelivery: delayedDelivery == freezed delayedDelivery: freezed == delayedDelivery
? _value.delayedDelivery ? _value.delayedDelivery
: delayedDelivery // ignore: cast_nullable_to_non_nullable : delayedDelivery // ignore: cast_nullable_to_non_nullable
as DelayedDelivery?, as DelayedDelivery?,
other: other == freezed other: null == other
? _value.other ? _value.other
: other // ignore: cast_nullable_to_non_nullable : other // ignore: cast_nullable_to_non_nullable
as Map<String, dynamic>, as Map<String, dynamic>,
messageRetraction: messageRetraction == freezed messageRetraction: freezed == messageRetraction
? _value.messageRetraction ? _value.messageRetraction
: messageRetraction // ignore: cast_nullable_to_non_nullable : messageRetraction // ignore: cast_nullable_to_non_nullable
as MessageRetractionData?, as MessageRetractionData?,
lastMessageCorrectionSid: lastMessageCorrectionSid == freezed lastMessageCorrectionSid: freezed == lastMessageCorrectionSid
? _value.lastMessageCorrectionSid ? _value.lastMessageCorrectionSid
: lastMessageCorrectionSid // ignore: cast_nullable_to_non_nullable : lastMessageCorrectionSid // ignore: cast_nullable_to_non_nullable
as String?, as String?,
messageReactions: messageReactions == freezed messageReactions: freezed == messageReactions
? _value.messageReactions ? _value.messageReactions
: messageReactions // ignore: cast_nullable_to_non_nullable : messageReactions // ignore: cast_nullable_to_non_nullable
as MessageReactions?, as MessageReactions?,
stickerPackId: stickerPackId == freezed stickerPackId: freezed == stickerPackId
? _value.stickerPackId ? _value.stickerPackId
: stickerPackId // ignore: cast_nullable_to_non_nullable : stickerPackId // ignore: cast_nullable_to_non_nullable
as String?, as String?,
)); ) as $Val);
} }
} }
@ -263,6 +275,7 @@ abstract class _$$_StanzaHandlerDataCopyWith<$Res>
$Res Function(_$_StanzaHandlerData) then) = $Res Function(_$_StanzaHandlerData) then) =
__$$_StanzaHandlerDataCopyWithImpl<$Res>; __$$_StanzaHandlerDataCopyWithImpl<$Res>;
@override @override
@useResult
$Res call( $Res call(
{bool done, {bool done,
bool cancel, bool cancel,
@ -272,7 +285,8 @@ abstract class _$$_StanzaHandlerDataCopyWith<$Res>
StatelessMediaSharingData? sims, StatelessMediaSharingData? sims,
StatelessFileSharingData? sfs, StatelessFileSharingData? sfs,
OOBData? oob, OOBData? oob,
StableStanzaId? stableId, String? originId,
List<StanzaId>? stanzaIds,
ReplyData? reply, ReplyData? reply,
ChatState? chatState, ChatState? chatState,
bool isCarbon, bool isCarbon,
@ -294,146 +308,149 @@ abstract class _$$_StanzaHandlerDataCopyWith<$Res>
/// @nodoc /// @nodoc
class __$$_StanzaHandlerDataCopyWithImpl<$Res> class __$$_StanzaHandlerDataCopyWithImpl<$Res>
extends _$StanzaHandlerDataCopyWithImpl<$Res> extends _$StanzaHandlerDataCopyWithImpl<$Res, _$_StanzaHandlerData>
implements _$$_StanzaHandlerDataCopyWith<$Res> { implements _$$_StanzaHandlerDataCopyWith<$Res> {
__$$_StanzaHandlerDataCopyWithImpl( __$$_StanzaHandlerDataCopyWithImpl(
_$_StanzaHandlerData _value, $Res Function(_$_StanzaHandlerData) _then) _$_StanzaHandlerData _value, $Res Function(_$_StanzaHandlerData) _then)
: super(_value, (v) => _then(v as _$_StanzaHandlerData)); : super(_value, _then);
@override
_$_StanzaHandlerData get _value => super._value as _$_StanzaHandlerData;
@pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? done = freezed, Object? done = null,
Object? cancel = freezed, Object? cancel = null,
Object? cancelReason = freezed, Object? cancelReason = freezed,
Object? stanza = freezed, Object? stanza = null,
Object? retransmitted = freezed, Object? retransmitted = null,
Object? sims = freezed, Object? sims = freezed,
Object? sfs = freezed, Object? sfs = freezed,
Object? oob = freezed, Object? oob = freezed,
Object? stableId = freezed, Object? originId = freezed,
Object? stanzaIds = freezed,
Object? reply = freezed, Object? reply = freezed,
Object? chatState = freezed, Object? chatState = freezed,
Object? isCarbon = freezed, Object? isCarbon = null,
Object? deliveryReceiptRequested = freezed, Object? deliveryReceiptRequested = null,
Object? isMarkable = freezed, Object? isMarkable = null,
Object? fun = freezed, Object? fun = freezed,
Object? funReplacement = freezed, Object? funReplacement = freezed,
Object? funCancellation = freezed, Object? funCancellation = freezed,
Object? encrypted = freezed, Object? encrypted = null,
Object? forceEncryption = freezed, Object? forceEncryption = null,
Object? encryptionType = freezed, Object? encryptionType = freezed,
Object? delayedDelivery = freezed, Object? delayedDelivery = freezed,
Object? other = freezed, Object? other = null,
Object? messageRetraction = freezed, Object? messageRetraction = freezed,
Object? lastMessageCorrectionSid = freezed, Object? lastMessageCorrectionSid = freezed,
Object? messageReactions = freezed, Object? messageReactions = freezed,
Object? stickerPackId = freezed, Object? stickerPackId = freezed,
}) { }) {
return _then(_$_StanzaHandlerData( return _then(_$_StanzaHandlerData(
done == freezed null == done
? _value.done ? _value.done
: done // ignore: cast_nullable_to_non_nullable : done // ignore: cast_nullable_to_non_nullable
as bool, as bool,
cancel == freezed null == cancel
? _value.cancel ? _value.cancel
: cancel // ignore: cast_nullable_to_non_nullable : cancel // ignore: cast_nullable_to_non_nullable
as bool, as bool,
cancelReason == freezed freezed == cancelReason
? _value.cancelReason ? _value.cancelReason
: cancelReason // ignore: cast_nullable_to_non_nullable : cancelReason // ignore: cast_nullable_to_non_nullable
as dynamic, as dynamic,
stanza == freezed null == stanza
? _value.stanza ? _value.stanza
: stanza // ignore: cast_nullable_to_non_nullable : stanza // ignore: cast_nullable_to_non_nullable
as Stanza, as Stanza,
retransmitted: retransmitted == freezed retransmitted: null == retransmitted
? _value.retransmitted ? _value.retransmitted
: retransmitted // ignore: cast_nullable_to_non_nullable : retransmitted // ignore: cast_nullable_to_non_nullable
as bool, as bool,
sims: sims == freezed sims: freezed == sims
? _value.sims ? _value.sims
: sims // ignore: cast_nullable_to_non_nullable : sims // ignore: cast_nullable_to_non_nullable
as StatelessMediaSharingData?, as StatelessMediaSharingData?,
sfs: sfs == freezed sfs: freezed == sfs
? _value.sfs ? _value.sfs
: sfs // ignore: cast_nullable_to_non_nullable : sfs // ignore: cast_nullable_to_non_nullable
as StatelessFileSharingData?, as StatelessFileSharingData?,
oob: oob == freezed oob: freezed == oob
? _value.oob ? _value.oob
: oob // ignore: cast_nullable_to_non_nullable : oob // ignore: cast_nullable_to_non_nullable
as OOBData?, as OOBData?,
stableId: stableId == freezed originId: freezed == originId
? _value.stableId ? _value.originId
: stableId // ignore: cast_nullable_to_non_nullable : originId // ignore: cast_nullable_to_non_nullable
as StableStanzaId?, as String?,
reply: reply == freezed stanzaIds: freezed == stanzaIds
? _value._stanzaIds
: stanzaIds // ignore: cast_nullable_to_non_nullable
as List<StanzaId>?,
reply: freezed == reply
? _value.reply ? _value.reply
: reply // ignore: cast_nullable_to_non_nullable : reply // ignore: cast_nullable_to_non_nullable
as ReplyData?, as ReplyData?,
chatState: chatState == freezed chatState: freezed == chatState
? _value.chatState ? _value.chatState
: chatState // ignore: cast_nullable_to_non_nullable : chatState // ignore: cast_nullable_to_non_nullable
as ChatState?, as ChatState?,
isCarbon: isCarbon == freezed isCarbon: null == isCarbon
? _value.isCarbon ? _value.isCarbon
: isCarbon // ignore: cast_nullable_to_non_nullable : isCarbon // ignore: cast_nullable_to_non_nullable
as bool, as bool,
deliveryReceiptRequested: deliveryReceiptRequested == freezed deliveryReceiptRequested: null == deliveryReceiptRequested
? _value.deliveryReceiptRequested ? _value.deliveryReceiptRequested
: deliveryReceiptRequested // ignore: cast_nullable_to_non_nullable : deliveryReceiptRequested // ignore: cast_nullable_to_non_nullable
as bool, as bool,
isMarkable: isMarkable == freezed isMarkable: null == isMarkable
? _value.isMarkable ? _value.isMarkable
: isMarkable // ignore: cast_nullable_to_non_nullable : isMarkable // ignore: cast_nullable_to_non_nullable
as bool, as bool,
fun: fun == freezed fun: freezed == fun
? _value.fun ? _value.fun
: fun // ignore: cast_nullable_to_non_nullable : fun // ignore: cast_nullable_to_non_nullable
as FileMetadataData?, as FileMetadataData?,
funReplacement: funReplacement == freezed funReplacement: freezed == funReplacement
? _value.funReplacement ? _value.funReplacement
: funReplacement // ignore: cast_nullable_to_non_nullable : funReplacement // ignore: cast_nullable_to_non_nullable
as String?, as String?,
funCancellation: funCancellation == freezed funCancellation: freezed == funCancellation
? _value.funCancellation ? _value.funCancellation
: funCancellation // ignore: cast_nullable_to_non_nullable : funCancellation // ignore: cast_nullable_to_non_nullable
as String?, as String?,
encrypted: encrypted == freezed encrypted: null == encrypted
? _value.encrypted ? _value.encrypted
: encrypted // ignore: cast_nullable_to_non_nullable : encrypted // ignore: cast_nullable_to_non_nullable
as bool, as bool,
forceEncryption: forceEncryption == freezed forceEncryption: null == forceEncryption
? _value.forceEncryption ? _value.forceEncryption
: forceEncryption // ignore: cast_nullable_to_non_nullable : forceEncryption // ignore: cast_nullable_to_non_nullable
as bool, as bool,
encryptionType: encryptionType == freezed encryptionType: freezed == encryptionType
? _value.encryptionType ? _value.encryptionType
: encryptionType // ignore: cast_nullable_to_non_nullable : encryptionType // ignore: cast_nullable_to_non_nullable
as ExplicitEncryptionType?, as ExplicitEncryptionType?,
delayedDelivery: delayedDelivery == freezed delayedDelivery: freezed == delayedDelivery
? _value.delayedDelivery ? _value.delayedDelivery
: delayedDelivery // ignore: cast_nullable_to_non_nullable : delayedDelivery // ignore: cast_nullable_to_non_nullable
as DelayedDelivery?, as DelayedDelivery?,
other: other == freezed other: null == other
? _value._other ? _value._other
: other // ignore: cast_nullable_to_non_nullable : other // ignore: cast_nullable_to_non_nullable
as Map<String, dynamic>, as Map<String, dynamic>,
messageRetraction: messageRetraction == freezed messageRetraction: freezed == messageRetraction
? _value.messageRetraction ? _value.messageRetraction
: messageRetraction // ignore: cast_nullable_to_non_nullable : messageRetraction // ignore: cast_nullable_to_non_nullable
as MessageRetractionData?, as MessageRetractionData?,
lastMessageCorrectionSid: lastMessageCorrectionSid == freezed lastMessageCorrectionSid: freezed == lastMessageCorrectionSid
? _value.lastMessageCorrectionSid ? _value.lastMessageCorrectionSid
: lastMessageCorrectionSid // ignore: cast_nullable_to_non_nullable : lastMessageCorrectionSid // ignore: cast_nullable_to_non_nullable
as String?, as String?,
messageReactions: messageReactions == freezed messageReactions: freezed == messageReactions
? _value.messageReactions ? _value.messageReactions
: messageReactions // ignore: cast_nullable_to_non_nullable : messageReactions // ignore: cast_nullable_to_non_nullable
as MessageReactions?, as MessageReactions?,
stickerPackId: stickerPackId == freezed stickerPackId: freezed == stickerPackId
? _value.stickerPackId ? _value.stickerPackId
: stickerPackId // ignore: cast_nullable_to_non_nullable : stickerPackId // ignore: cast_nullable_to_non_nullable
as String?, as String?,
@ -449,7 +466,8 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
this.sims, this.sims,
this.sfs, this.sfs,
this.oob, this.oob,
this.stableId, this.originId,
final List<StanzaId>? stanzaIds,
this.reply, this.reply,
this.chatState, this.chatState,
this.isCarbon = false, this.isCarbon = false,
@ -467,7 +485,8 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
this.lastMessageCorrectionSid, this.lastMessageCorrectionSid,
this.messageReactions, this.messageReactions,
this.stickerPackId}) this.stickerPackId})
: _other = other; : _stanzaIds = stanzaIds,
_other = other;
// Indicates to the runner that processing is now done. This means that all // Indicates to the runner that processing is now done. This means that all
// pre-processing is done and no other handlers should be consulted. // pre-processing is done and no other handlers should be consulted.
@ -495,8 +514,21 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
final StatelessFileSharingData? sfs; final StatelessFileSharingData? sfs;
@override @override
final OOBData? oob; final OOBData? oob;
// XEP-0359 <origin-id />'s id attribute, if available.
@override @override
final StableStanzaId? stableId; final String? originId;
// XEP-0359 <stanza-id /> elements, if available.
final List<StanzaId>? _stanzaIds;
// XEP-0359 <stanza-id /> elements, if available.
@override
List<StanzaId>? get stanzaIds {
final value = _stanzaIds;
if (value == null) return null;
if (_stanzaIds is EqualUnmodifiableListView) return _stanzaIds;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
@override @override
final ReplyData? reply; final ReplyData? reply;
@override @override
@ -545,6 +577,7 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
@override @override
@JsonKey() @JsonKey()
Map<String, dynamic> get other { Map<String, dynamic> get other {
if (_other is EqualUnmodifiableMapView) return _other;
// ignore: implicit_dynamic_type // ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_other); return EqualUnmodifiableMapView(_other);
} }
@ -565,7 +598,7 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
@override @override
String toString() { String toString() {
return 'StanzaHandlerData(done: $done, cancel: $cancel, cancelReason: $cancelReason, stanza: $stanza, retransmitted: $retransmitted, sims: $sims, sfs: $sfs, oob: $oob, stableId: $stableId, reply: $reply, chatState: $chatState, isCarbon: $isCarbon, deliveryReceiptRequested: $deliveryReceiptRequested, isMarkable: $isMarkable, fun: $fun, funReplacement: $funReplacement, funCancellation: $funCancellation, encrypted: $encrypted, forceEncryption: $forceEncryption, encryptionType: $encryptionType, delayedDelivery: $delayedDelivery, other: $other, messageRetraction: $messageRetraction, lastMessageCorrectionSid: $lastMessageCorrectionSid, messageReactions: $messageReactions, stickerPackId: $stickerPackId)'; return 'StanzaHandlerData(done: $done, cancel: $cancel, cancelReason: $cancelReason, stanza: $stanza, retransmitted: $retransmitted, sims: $sims, sfs: $sfs, oob: $oob, originId: $originId, stanzaIds: $stanzaIds, reply: $reply, chatState: $chatState, isCarbon: $isCarbon, deliveryReceiptRequested: $deliveryReceiptRequested, isMarkable: $isMarkable, fun: $fun, funReplacement: $funReplacement, funCancellation: $funCancellation, encrypted: $encrypted, forceEncryption: $forceEncryption, encryptionType: $encryptionType, delayedDelivery: $delayedDelivery, other: $other, messageRetraction: $messageRetraction, lastMessageCorrectionSid: $lastMessageCorrectionSid, messageReactions: $messageReactions, stickerPackId: $stickerPackId)';
} }
@override @override
@ -573,80 +606,90 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$_StanzaHandlerData && other is _$_StanzaHandlerData &&
const DeepCollectionEquality().equals(other.done, done) && (identical(other.done, done) || other.done == done) &&
const DeepCollectionEquality().equals(other.cancel, cancel) && (identical(other.cancel, cancel) || other.cancel == cancel) &&
const DeepCollectionEquality() const DeepCollectionEquality()
.equals(other.cancelReason, cancelReason) && .equals(other.cancelReason, cancelReason) &&
const DeepCollectionEquality().equals(other.stanza, stanza) && (identical(other.stanza, stanza) || other.stanza == stanza) &&
(identical(other.retransmitted, retransmitted) ||
other.retransmitted == retransmitted) &&
(identical(other.sims, sims) || other.sims == sims) &&
(identical(other.sfs, sfs) || other.sfs == sfs) &&
(identical(other.oob, oob) || other.oob == oob) &&
(identical(other.originId, originId) ||
other.originId == originId) &&
const DeepCollectionEquality() const DeepCollectionEquality()
.equals(other.retransmitted, retransmitted) && .equals(other._stanzaIds, _stanzaIds) &&
const DeepCollectionEquality().equals(other.sims, sims) && (identical(other.reply, reply) || other.reply == reply) &&
const DeepCollectionEquality().equals(other.sfs, sfs) && (identical(other.chatState, chatState) ||
const DeepCollectionEquality().equals(other.oob, oob) && other.chatState == chatState) &&
const DeepCollectionEquality().equals(other.stableId, stableId) && (identical(other.isCarbon, isCarbon) ||
const DeepCollectionEquality().equals(other.reply, reply) && other.isCarbon == isCarbon) &&
const DeepCollectionEquality().equals(other.chatState, chatState) && (identical(
const DeepCollectionEquality().equals(other.isCarbon, isCarbon) && other.deliveryReceiptRequested, deliveryReceiptRequested) ||
const DeepCollectionEquality().equals( other.deliveryReceiptRequested == deliveryReceiptRequested) &&
other.deliveryReceiptRequested, deliveryReceiptRequested) && (identical(other.isMarkable, isMarkable) ||
const DeepCollectionEquality() other.isMarkable == isMarkable) &&
.equals(other.isMarkable, isMarkable) && (identical(other.fun, fun) || other.fun == fun) &&
const DeepCollectionEquality().equals(other.fun, fun) && (identical(other.funReplacement, funReplacement) ||
const DeepCollectionEquality() other.funReplacement == funReplacement) &&
.equals(other.funReplacement, funReplacement) && (identical(other.funCancellation, funCancellation) ||
const DeepCollectionEquality() other.funCancellation == funCancellation) &&
.equals(other.funCancellation, funCancellation) && (identical(other.encrypted, encrypted) ||
const DeepCollectionEquality().equals(other.encrypted, encrypted) && other.encrypted == encrypted) &&
const DeepCollectionEquality() (identical(other.forceEncryption, forceEncryption) ||
.equals(other.forceEncryption, forceEncryption) && other.forceEncryption == forceEncryption) &&
const DeepCollectionEquality() (identical(other.encryptionType, encryptionType) ||
.equals(other.encryptionType, encryptionType) && other.encryptionType == encryptionType) &&
const DeepCollectionEquality() (identical(other.delayedDelivery, delayedDelivery) ||
.equals(other.delayedDelivery, delayedDelivery) && other.delayedDelivery == delayedDelivery) &&
const DeepCollectionEquality().equals(other._other, this._other) && const DeepCollectionEquality().equals(other._other, this._other) &&
const DeepCollectionEquality() (identical(other.messageRetraction, messageRetraction) ||
.equals(other.messageRetraction, messageRetraction) && other.messageRetraction == messageRetraction) &&
const DeepCollectionEquality().equals( (identical(
other.lastMessageCorrectionSid, lastMessageCorrectionSid) && other.lastMessageCorrectionSid, lastMessageCorrectionSid) ||
const DeepCollectionEquality() other.lastMessageCorrectionSid == lastMessageCorrectionSid) &&
.equals(other.messageReactions, messageReactions) && (identical(other.messageReactions, messageReactions) ||
const DeepCollectionEquality() other.messageReactions == messageReactions) &&
.equals(other.stickerPackId, stickerPackId)); (identical(other.stickerPackId, stickerPackId) ||
other.stickerPackId == stickerPackId));
} }
@override @override
int get hashCode => Object.hashAll([ int get hashCode => Object.hashAll([
runtimeType, runtimeType,
const DeepCollectionEquality().hash(done), done,
const DeepCollectionEquality().hash(cancel), cancel,
const DeepCollectionEquality().hash(cancelReason), const DeepCollectionEquality().hash(cancelReason),
const DeepCollectionEquality().hash(stanza), stanza,
const DeepCollectionEquality().hash(retransmitted), retransmitted,
const DeepCollectionEquality().hash(sims), sims,
const DeepCollectionEquality().hash(sfs), sfs,
const DeepCollectionEquality().hash(oob), oob,
const DeepCollectionEquality().hash(stableId), originId,
const DeepCollectionEquality().hash(reply), const DeepCollectionEquality().hash(_stanzaIds),
const DeepCollectionEquality().hash(chatState), reply,
const DeepCollectionEquality().hash(isCarbon), chatState,
const DeepCollectionEquality().hash(deliveryReceiptRequested), isCarbon,
const DeepCollectionEquality().hash(isMarkable), deliveryReceiptRequested,
const DeepCollectionEquality().hash(fun), isMarkable,
const DeepCollectionEquality().hash(funReplacement), fun,
const DeepCollectionEquality().hash(funCancellation), funReplacement,
const DeepCollectionEquality().hash(encrypted), funCancellation,
const DeepCollectionEquality().hash(forceEncryption), encrypted,
const DeepCollectionEquality().hash(encryptionType), forceEncryption,
const DeepCollectionEquality().hash(delayedDelivery), encryptionType,
delayedDelivery,
const DeepCollectionEquality().hash(_other), const DeepCollectionEquality().hash(_other),
const DeepCollectionEquality().hash(messageRetraction), messageRetraction,
const DeepCollectionEquality().hash(lastMessageCorrectionSid), lastMessageCorrectionSid,
const DeepCollectionEquality().hash(messageReactions), messageReactions,
const DeepCollectionEquality().hash(stickerPackId) stickerPackId
]); ]);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@pragma('vm:prefer-inline')
_$$_StanzaHandlerDataCopyWith<_$_StanzaHandlerData> get copyWith => _$$_StanzaHandlerDataCopyWith<_$_StanzaHandlerData> get copyWith =>
__$$_StanzaHandlerDataCopyWithImpl<_$_StanzaHandlerData>( __$$_StanzaHandlerDataCopyWithImpl<_$_StanzaHandlerData>(
this, _$identity); this, _$identity);
@ -659,7 +702,8 @@ abstract class _StanzaHandlerData implements StanzaHandlerData {
final StatelessMediaSharingData? sims, final StatelessMediaSharingData? sims,
final StatelessFileSharingData? sfs, final StatelessFileSharingData? sfs,
final OOBData? oob, final OOBData? oob,
final StableStanzaId? stableId, final String? originId,
final List<StanzaId>? stanzaIds,
final ReplyData? reply, final ReplyData? reply,
final ChatState? chatState, final ChatState? chatState,
final bool isCarbon, final bool isCarbon,
@ -698,8 +742,10 @@ abstract class _StanzaHandlerData implements StanzaHandlerData {
StatelessFileSharingData? get sfs; StatelessFileSharingData? get sfs;
@override @override
OOBData? get oob; OOBData? get oob;
@override @override // XEP-0359 <origin-id />'s id attribute, if available.
StableStanzaId? get stableId; String? get originId;
@override // XEP-0359 <stanza-id /> elements, if available.
List<StanzaId>? get stanzaIds;
@override @override
ReplyData? get reply; ReplyData? get reply;
@override @override

View File

@ -109,7 +109,8 @@ class MessageManager extends XmppManagerBase {
fromJid: JID.fromString(message.attributes['from']! as String), fromJid: JID.fromString(message.attributes['from']! as String),
toJid: JID.fromString(message.attributes['to']! as String), toJid: JID.fromString(message.attributes['to']! as String),
sid: message.attributes['id']! as String, sid: message.attributes['id']! as String,
stanzaId: state.stableId ?? const StableStanzaId(), originId: state.originId,
stanzaIds: state.stanzaIds,
isCarbon: state.isCarbon, isCarbon: state.isCarbon,
deliveryReceiptRequested: state.deliveryReceiptRequested, deliveryReceiptRequested: state.deliveryReceiptRequested,
isMarkable: state.isMarkable, isMarkable: state.isMarkable,

View File

@ -1,7 +1,7 @@
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'state.dart'; part of 'state.dart';
@ -36,7 +36,8 @@ mixin _$StreamManagementState {
abstract class $StreamManagementStateCopyWith<$Res> { abstract class $StreamManagementStateCopyWith<$Res> {
factory $StreamManagementStateCopyWith(StreamManagementState value, factory $StreamManagementStateCopyWith(StreamManagementState value,
$Res Function(StreamManagementState) then) = $Res Function(StreamManagementState) then) =
_$StreamManagementStateCopyWithImpl<$Res>; _$StreamManagementStateCopyWithImpl<$Res, StreamManagementState>;
@useResult
$Res call( $Res call(
{int c2s, {int c2s,
int s2c, int s2c,
@ -45,39 +46,42 @@ abstract class $StreamManagementStateCopyWith<$Res> {
} }
/// @nodoc /// @nodoc
class _$StreamManagementStateCopyWithImpl<$Res> class _$StreamManagementStateCopyWithImpl<$Res,
$Val extends StreamManagementState>
implements $StreamManagementStateCopyWith<$Res> { implements $StreamManagementStateCopyWith<$Res> {
_$StreamManagementStateCopyWithImpl(this._value, this._then); _$StreamManagementStateCopyWithImpl(this._value, this._then);
final StreamManagementState _value;
// ignore: unused_field // ignore: unused_field
final $Res Function(StreamManagementState) _then; final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? c2s = freezed, Object? c2s = null,
Object? s2c = freezed, Object? s2c = null,
Object? streamResumptionLocation = freezed, Object? streamResumptionLocation = freezed,
Object? streamResumptionId = freezed, Object? streamResumptionId = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
c2s: c2s == freezed c2s: null == c2s
? _value.c2s ? _value.c2s
: c2s // ignore: cast_nullable_to_non_nullable : c2s // ignore: cast_nullable_to_non_nullable
as int, as int,
s2c: s2c == freezed s2c: null == s2c
? _value.s2c ? _value.s2c
: s2c // ignore: cast_nullable_to_non_nullable : s2c // ignore: cast_nullable_to_non_nullable
as int, as int,
streamResumptionLocation: streamResumptionLocation == freezed streamResumptionLocation: freezed == streamResumptionLocation
? _value.streamResumptionLocation ? _value.streamResumptionLocation
: streamResumptionLocation // ignore: cast_nullable_to_non_nullable : streamResumptionLocation // ignore: cast_nullable_to_non_nullable
as String?, as String?,
streamResumptionId: streamResumptionId == freezed streamResumptionId: freezed == streamResumptionId
? _value.streamResumptionId ? _value.streamResumptionId
: streamResumptionId // ignore: cast_nullable_to_non_nullable : streamResumptionId // ignore: cast_nullable_to_non_nullable
as String?, as String?,
)); ) as $Val);
} }
} }
@ -88,6 +92,7 @@ abstract class _$$_StreamManagementStateCopyWith<$Res>
$Res Function(_$_StreamManagementState) then) = $Res Function(_$_StreamManagementState) then) =
__$$_StreamManagementStateCopyWithImpl<$Res>; __$$_StreamManagementStateCopyWithImpl<$Res>;
@override @override
@useResult
$Res call( $Res call(
{int c2s, {int c2s,
int s2c, int s2c,
@ -97,37 +102,34 @@ abstract class _$$_StreamManagementStateCopyWith<$Res>
/// @nodoc /// @nodoc
class __$$_StreamManagementStateCopyWithImpl<$Res> class __$$_StreamManagementStateCopyWithImpl<$Res>
extends _$StreamManagementStateCopyWithImpl<$Res> extends _$StreamManagementStateCopyWithImpl<$Res, _$_StreamManagementState>
implements _$$_StreamManagementStateCopyWith<$Res> { implements _$$_StreamManagementStateCopyWith<$Res> {
__$$_StreamManagementStateCopyWithImpl(_$_StreamManagementState _value, __$$_StreamManagementStateCopyWithImpl(_$_StreamManagementState _value,
$Res Function(_$_StreamManagementState) _then) $Res Function(_$_StreamManagementState) _then)
: super(_value, (v) => _then(v as _$_StreamManagementState)); : super(_value, _then);
@override
_$_StreamManagementState get _value =>
super._value as _$_StreamManagementState;
@pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? c2s = freezed, Object? c2s = null,
Object? s2c = freezed, Object? s2c = null,
Object? streamResumptionLocation = freezed, Object? streamResumptionLocation = freezed,
Object? streamResumptionId = freezed, Object? streamResumptionId = freezed,
}) { }) {
return _then(_$_StreamManagementState( return _then(_$_StreamManagementState(
c2s == freezed null == c2s
? _value.c2s ? _value.c2s
: c2s // ignore: cast_nullable_to_non_nullable : c2s // ignore: cast_nullable_to_non_nullable
as int, as int,
s2c == freezed null == s2c
? _value.s2c ? _value.s2c
: s2c // ignore: cast_nullable_to_non_nullable : s2c // ignore: cast_nullable_to_non_nullable
as int, as int,
streamResumptionLocation: streamResumptionLocation == freezed streamResumptionLocation: freezed == streamResumptionLocation
? _value.streamResumptionLocation ? _value.streamResumptionLocation
: streamResumptionLocation // ignore: cast_nullable_to_non_nullable : streamResumptionLocation // ignore: cast_nullable_to_non_nullable
as String?, as String?,
streamResumptionId: streamResumptionId == freezed streamResumptionId: freezed == streamResumptionId
? _value.streamResumptionId ? _value.streamResumptionId
: streamResumptionId // ignore: cast_nullable_to_non_nullable : streamResumptionId // ignore: cast_nullable_to_non_nullable
as String?, as String?,
@ -163,25 +165,23 @@ class _$_StreamManagementState implements _StreamManagementState {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$_StreamManagementState && other is _$_StreamManagementState &&
const DeepCollectionEquality().equals(other.c2s, c2s) && (identical(other.c2s, c2s) || other.c2s == c2s) &&
const DeepCollectionEquality().equals(other.s2c, s2c) && (identical(other.s2c, s2c) || other.s2c == s2c) &&
const DeepCollectionEquality().equals( (identical(
other.streamResumptionLocation, streamResumptionLocation) && other.streamResumptionLocation, streamResumptionLocation) ||
const DeepCollectionEquality() other.streamResumptionLocation == streamResumptionLocation) &&
.equals(other.streamResumptionId, streamResumptionId)); (identical(other.streamResumptionId, streamResumptionId) ||
other.streamResumptionId == streamResumptionId));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => Object.hash( int get hashCode => Object.hash(
runtimeType, runtimeType, c2s, s2c, streamResumptionLocation, streamResumptionId);
const DeepCollectionEquality().hash(c2s),
const DeepCollectionEquality().hash(s2c),
const DeepCollectionEquality().hash(streamResumptionLocation),
const DeepCollectionEquality().hash(streamResumptionId));
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@pragma('vm:prefer-inline')
_$$_StreamManagementStateCopyWith<_$_StreamManagementState> get copyWith => _$$_StreamManagementStateCopyWith<_$_StreamManagementState> get copyWith =>
__$$_StreamManagementStateCopyWithImpl<_$_StreamManagementState>( __$$_StreamManagementStateCopyWithImpl<_$_StreamManagementState>(
this, _$identity); this, _$identity);

View File

@ -6,17 +6,30 @@ import 'package:moxxmpp/src/managers/namespaces.dart';
import 'package:moxxmpp/src/namespaces.dart'; import 'package:moxxmpp/src/namespaces.dart';
import 'package:moxxmpp/src/stanza.dart'; import 'package:moxxmpp/src/stanza.dart';
import 'package:moxxmpp/src/stringxml.dart'; import 'package:moxxmpp/src/stringxml.dart';
import 'package:moxxmpp/src/xeps/xep_0030/types.dart';
import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart';
/// Represents data provided by XEP-0359. /// Representation of a <stanza-id /> element.
/// NOTE: [StableStanzaId.stanzaId] must not be confused with the actual id attribute of class StanzaId {
/// the message stanza. const StanzaId(
class StableStanzaId { this.id,
const StableStanzaId({this.originId, this.stanzaId, this.stanzaIdBy}); this.by,
final String? originId; );
final String? stanzaId;
final String? stanzaIdBy; /// The unique stanza id.
final String id;
/// The JID the id was generated by.
final JID by;
XMLNode toXml() {
return XMLNode.xmlns(
tag: 'stanza-id',
xmlns: stableIdXmlns,
attributes: {
'id': id,
'by': by.toString(),
},
);
}
} }
XMLNode makeOriginIdElement(String id) { XMLNode makeOriginIdElement(String id) {
@ -50,50 +63,32 @@ class StableIdManager extends XmppManagerBase {
Stanza message, Stanza message,
StanzaHandlerData state, StanzaHandlerData state,
) async { ) async {
final from = JID.fromString(message.attributes['from']! as String);
String? originId; String? originId;
String? stanzaId; List<StanzaId>? stanzaIds;
String? stanzaIdBy; final originIdElement = message.firstTag('origin-id', xmlns: stableIdXmlns);
final originIdTag = message.firstTag('origin-id', xmlns: stableIdXmlns); final stanzaIdElements =
final stanzaIdTag = message.firstTag('stanza-id', xmlns: stableIdXmlns); message.findTags('stanza-id', xmlns: stableIdXmlns);
// Process the origin id // Process the origin id
if (originIdTag != null) { if (originIdElement != null) {
logger.finest('Found origin Id tag'); originId = originIdElement.attributes['id']! as String;
originId = originIdTag.attributes['id']! as String;
} }
// Process the stanza id tag // Process the stanza id tag
if (stanzaIdTag != null) { if (stanzaIdElements.isNotEmpty) {
logger.finest('Found stanza Id tag'); stanzaIds = stanzaIdElements
final attrs = getAttributes(); .map(
final disco = attrs.getManagerById<DiscoManager>(discoManager)!; (element) => StanzaId(
final result = await disco.discoInfoQuery(from); element.attributes['id']! as String,
if (result.isType<DiscoInfo>()) { JID.fromString(element.attributes['by']! as String),
final info = result.get<DiscoInfo>(); ),
logger.finest('Got info for ${from.toString()}'); )
if (info.features.contains(stableIdXmlns)) { .toList();
logger.finest('${from.toString()} supports $stableIdXmlns.');
stanzaId = stanzaIdTag.attributes['id']! as String;
stanzaIdBy = stanzaIdTag.attributes['by']! as String;
} else {
logger.finest(
'${from.toString()} does not support $stableIdXmlns. Ignoring stanza id... ',
);
}
} else {
logger.finest(
'Failed to find out if ${from.toString()} supports $stableIdXmlns. Ignoring... ',
);
}
} }
return state.copyWith( return state.copyWith(
stableId: StableStanzaId(
originId: originId, originId: originId,
stanzaId: stanzaId, stanzaIds: stanzaIds,
stanzaIdBy: stanzaIdBy,
),
); );
} }
} }