Revert "xmpp-parsers: Support required in SM feature"

This reverts commit 4e0cd5d96b.
This commit is contained in:
Maxime “pep” Buquet 2025-06-03 23:18:10 +02:00
commit dc2477eec3
3 changed files with 6 additions and 19 deletions

View file

@ -108,8 +108,7 @@ 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/>` and `<required/>` in XEP-0198 feature - Add support for `<optional/> in XEP-0198 feature advertisment
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,13 +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!( assert_eq!(inline.sm.unwrap(), StreamManagement { optional: false });
inline.sm.unwrap(),
StreamManagement {
optional: false,
required: false
}
);
assert_eq!(inline.payloads.len(), 0); assert_eq!(inline.payloads.len(), 0);
} }

View file

@ -133,7 +133,7 @@ pub struct Resumed {
pub previd: StreamId, pub previd: StreamId,
} }
// TODO: Only allow either optional or required, not both. // 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")]
@ -141,10 +141,6 @@ pub struct StreamManagement {
/// `<optional/>` flag. /// `<optional/>` flag.
#[xml(flag)] #[xml(flag)]
pub optional: bool, pub optional: bool,
/// `<required/>` flag.
#[xml(flag)]
pub required: bool,
} }
/// Application-specific error condition to use when the peer acknowledges /// Application-specific error condition to use when the peer acknowledges
@ -226,7 +222,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, 2); assert_size!(StreamManagement, 1);
assert_size!(HandledCountTooHigh, 8); assert_size!(HandledCountTooHigh, 8);
} }
@ -241,7 +237,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, 2); assert_size!(StreamManagement, 1);
assert_size!(HandledCountTooHigh, 8); assert_size!(HandledCountTooHigh, 8);
} }
@ -255,9 +251,7 @@ mod tests {
#[test] #[test]
fn stream_feature() { fn stream_feature() {
let elem: Element = "<sm xmlns='urn:xmpp:sm:3'/>".parse().unwrap(); let elem: Element = "<sm xmlns='urn:xmpp:sm:3'/>".parse().unwrap();
let sm = StreamManagement::try_from(elem).unwrap(); StreamManagement::try_from(elem).unwrap();
assert_eq!(sm.optional, false);
assert_eq!(sm.required, false);
} }
#[test] #[test]