xmpp-parsers: Remove optional child from sm element

When the required child was added and subsequently reverted, it was
noted that optional and required were never defined, and only appeared
in old XEP-0198 examples.  The XEP has been fixed already[1].

This basically reverts 0f0759b207.

[1] https://github.com/xsf/xeps/pull/1447
This commit is contained in:
Link Mauve 2025-07-28 15:21:43 +02:00
commit 0a1b291574
3 changed files with 4 additions and 10 deletions

View file

@ -108,7 +108,6 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
- Push Notifications (XEP-0357) (!543) - Push Notifications (XEP-0357) (!543)
- JSON Containers (XEP-0335) (!546) - JSON Containers (XEP-0335) (!546)
* Improvements: * Improvements:
- Add support for `<optional/> in XEP-0198 feature advertisment
- Add support application-specific error conditions in XEP-0198 - Add support application-specific error conditions in XEP-0198
- Keep unsupported vCard elements as `minidom::Element`, so that they - Keep unsupported vCard elements as `minidom::Element`, so that they
get serialized back instead of being dropped. We now also test for get serialized back instead of being dropped. We now also test for

View file

@ -269,7 +269,7 @@ mod tests {
let inline = auth.inline.unwrap(); let inline = auth.inline.unwrap();
assert_eq!(inline.bind2.unwrap().inline_features.len(), 0); assert_eq!(inline.bind2.unwrap().inline_features.len(), 0);
assert_eq!(inline.sm.unwrap(), StreamManagement { optional: false }); assert_eq!(inline.sm.unwrap(), StreamManagement);
assert_eq!(inline.payloads.len(), 0); assert_eq!(inline.payloads.len(), 0);
} }

View file

@ -133,15 +133,10 @@ pub struct Resumed {
pub previd: StreamId, pub previd: StreamId,
} }
// TODO: add support for optional and required.
/// Represents availability of Stream Management in `<stream:features/>`. /// Represents availability of Stream Management in `<stream:features/>`.
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)] #[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::SM, name = "sm")] #[xml(namespace = ns::SM, name = "sm")]
pub struct StreamManagement { pub struct StreamManagement;
/// `<optional/>` flag.
#[xml(flag)]
pub optional: bool,
}
/// Application-specific error condition to use when the peer acknowledges /// Application-specific error condition to use when the peer acknowledges
/// more stanzas than the local side has sent. /// more stanzas than the local side has sent.
@ -220,7 +215,7 @@ mod tests {
assert_size!(R, 0); assert_size!(R, 0);
assert_size!(Resume, 16); assert_size!(Resume, 16);
assert_size!(Resumed, 16); assert_size!(Resumed, 16);
assert_size!(StreamManagement, 1); assert_size!(StreamManagement, 0);
assert_size!(HandledCountTooHigh, 8); assert_size!(HandledCountTooHigh, 8);
} }
@ -235,7 +230,7 @@ mod tests {
assert_size!(R, 0); assert_size!(R, 0);
assert_size!(Resume, 32); assert_size!(Resume, 32);
assert_size!(Resumed, 32); assert_size!(Resumed, 32);
assert_size!(StreamManagement, 1); assert_size!(StreamManagement, 0);
assert_size!(HandledCountTooHigh, 8); assert_size!(HandledCountTooHigh, 8);
} }