From 6f6f8abb538c7a3aea428295e52205f417e597f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sun, 3 Mar 2024 14:44:39 +0100 Subject: [PATCH] Add fields for Result Set Management in disco#items Note that this is a breaking change, as it changes the struct definition and now requires additional fields when constructing the struct. --- parsers/src/disco.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/parsers/src/disco.rs b/parsers/src/disco.rs index 1d7a7ff0..99623a09 100644 --- a/parsers/src/disco.rs +++ b/parsers/src/disco.rs @@ -7,6 +7,7 @@ use crate::data_forms::{DataForm, DataFormType}; use crate::iq::{IqGetPayload, IqResultPayload}; use crate::ns; +use crate::rsm::{SetQuery, SetResult}; use crate::util::error::Error; use crate::Element; use jid::Jid; @@ -192,6 +193,10 @@ DiscoItemsQuery, "query", DISCO_ITEMS, attributes: [ /// Node on which we are doing the discovery. node: Option = "node", +], +children: [ + /// Optional paging via Result Set Management + rsm: Option = ("set", RSM) => SetQuery, ]); impl IqGetPayload for DiscoItemsQuery {} @@ -221,7 +226,10 @@ generate_element!( ], children: [ /// List of items pointed by this entity. - items: Vec = ("item", DISCO_ITEMS) => Item + items: Vec = ("item", DISCO_ITEMS) => Item, + + /// Optional paging via Result Set Management + rsm: Option = ("set", RSM) => SetResult, ] ); @@ -241,8 +249,8 @@ mod tests { assert_size!(DiscoInfoResult, 48); assert_size!(Item, 44); - assert_size!(DiscoItemsQuery, 12); - assert_size!(DiscoItemsResult, 24); + assert_size!(DiscoItemsQuery, 52); + assert_size!(DiscoItemsResult, 64); } #[cfg(target_pointer_width = "64")] @@ -254,8 +262,8 @@ mod tests { assert_size!(DiscoInfoResult, 96); assert_size!(Item, 88); - assert_size!(DiscoItemsQuery, 24); - assert_size!(DiscoItemsResult, 48); + assert_size!(DiscoItemsQuery, 104); + assert_size!(DiscoItemsResult, 128); } #[test]