Revert "xmpp-parsers: Remove optional child from sm element"

This reverts commit 0a1b291574 once again.

This is currently required to connect to Prosody, otherwise the parser
will choke on the extra undocumented child.

I still wonder if required (4e0cd5d96b)
would be useful to support then, as it might also be found in the wild.
This commit is contained in:
Link Mauve 2025-09-08 11:29:57 +02:00
commit 9d91b02dfd
3 changed files with 12 additions and 4 deletions

View file

@ -136,7 +136,13 @@ pub struct Resumed {
/// Represents availability of Stream Management in `<stream:features/>`.
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::SM, name = "sm")]
pub struct StreamManagement;
pub struct StreamManagement {
/// Undocumented `<optional/>` flag.
// TODO: Remove this flag once servers in the wild have been updated to not send it, as it is
// completely undocumented in XEP-0198, only appearing in the XML Schema before 1.6.3.
#[xml(flag)]
pub optional: bool,
}
/// Application-specific error condition to use when the peer acknowledges
/// more stanzas than the local side has sent.
@ -215,7 +221,7 @@ mod tests {
assert_size!(R, 0);
assert_size!(Resume, 16);
assert_size!(Resumed, 16);
assert_size!(StreamManagement, 0);
assert_size!(StreamManagement, 1);
assert_size!(HandledCountTooHigh, 8);
}
@ -230,7 +236,7 @@ mod tests {
assert_size!(R, 0);
assert_size!(Resume, 32);
assert_size!(Resumed, 32);
assert_size!(StreamManagement, 0);
assert_size!(StreamManagement, 1);
assert_size!(HandledCountTooHigh, 8);
}