xmpp-parsers: Add 'approved' attribute to roster item

This commit is contained in:
O01eg 2026-06-10 21:24:24 +00:00 committed by Link Mauve
commit 24ae2ffd73
2 changed files with 8 additions and 0 deletions

View file

@ -33,6 +33,7 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
- jingle_rtp::Description gained a bandwidth child.
- Fix cargo test for the disable-validation and component features.
- Structs of the bind module now have accessible inner pieces (!675).
- Add 'approved' field to roster item (!683).
Version 0.22.0:
2025-10-28 pep <pep@bouah.net>

View file

@ -71,6 +71,10 @@ pub struct Item {
/// Groups this contact is part of.
#[xml(child(n = ..))]
pub groups: Vec<Group>,
/// Subscription pre-approval
#[xml(attribute(default))]
pub approved: Option<bool>,
}
/// The contact list of the user.
@ -158,6 +162,7 @@ mod tests {
<item jid='contact@example.org'
subscription='none'
ask='subscribe'
approved='true'
name='MyContact'>
<group>MyBuddies</group>
</item>
@ -175,6 +180,7 @@ mod tests {
assert_eq!(roster.items[0].name, Some(String::from("Romeo")));
assert_eq!(roster.items[0].subscription, Subscription::Both);
assert_eq!(roster.items[0].ask, Ask::None);
assert_eq!(roster.items[0].approved, None);
assert_eq!(
roster.items[0].groups,
vec!(Group::from_str("Friends").unwrap())
@ -187,6 +193,7 @@ mod tests {
assert_eq!(roster.items[3].name, Some(String::from("MyContact")));
assert_eq!(roster.items[3].subscription, Subscription::None);
assert_eq!(roster.items[3].ask, Ask::Subscribe);
assert_eq!(roster.items[3].approved, Some(true));
assert_eq!(
roster.items[3].groups,
vec!(Group::from_str("MyBuddies").unwrap())