xmpp-parsers: Implement XEP-0478: Stream Limits Advertisement

This allows servers to communicate their maximum stanza limit, as well
as idle time limit.
This commit is contained in:
Emmanuel Gil Peyrot 2024-08-03 13:21:52 +02:00
commit d8e08df464
6 changed files with 96 additions and 2 deletions

View file

@ -9,6 +9,7 @@ use xso::{AsXml, FromXml};
use crate::bind::BindFeature;
use crate::ns;
use crate::stream_limits::Limits;
/// Wraps `<stream:features/>`, usually the very first nonza of a
/// XMPP stream. Indicates which features are supported.
@ -27,6 +28,10 @@ pub struct StreamFeatures {
#[xml(child(default))]
pub sasl_mechanisms: SaslMechanisms,
/// Limits advertised by the server.
#[xml(child(default))]
pub limits: Option<Limits>,
/// Other stream features advertised
///
/// If some features you use end up here, you may want to contribute
@ -91,7 +96,7 @@ mod tests {
assert_size!(SaslMechanisms, 12);
assert_size!(RequiredStartTls, 0);
assert_size!(StartTls, 1);
assert_size!(StreamFeatures, 28);
assert_size!(StreamFeatures, 40);
}
#[cfg(target_pointer_width = "64")]
@ -101,7 +106,7 @@ mod tests {
assert_size!(SaslMechanisms, 24);
assert_size!(RequiredStartTls, 0);
assert_size!(StartTls, 1);
assert_size!(StreamFeatures, 56);
assert_size!(StreamFeatures, 64);
}
#[test]