xmpp-parsers: Integrate sasl2 and sasl_cb into stream:features

Emmanuel Gil Peyrot created

Change summary

parsers/src/stream_features.rs | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

Detailed changes

parsers/src/stream_features.rs 🔗

@@ -9,6 +9,8 @@ use xso::{AsXml, FromXml};
 
 use crate::bind::BindFeature;
 use crate::ns;
+use crate::sasl2::Authentication;
+use crate::sasl_cb::SaslChannelBinding;
 use crate::stream_limits::Limits;
 
 /// Wraps `<stream:features/>`, usually the very first nonza of a
@@ -32,6 +34,14 @@ pub struct StreamFeatures {
     #[xml(child(default))]
     pub limits: Option<Limits>,
 
+    /// Extensible SASL Profile, a newer authentication method than the one from the RFC.
+    #[xml(child(default))]
+    pub sasl2: Option<Authentication>,
+
+    /// SASL Channel-Binding Type Capability.
+    #[xml(child(default))]
+    pub sasl_cb: Option<SaslChannelBinding>,
+
     /// Other stream features advertised
     ///
     /// If some features you use end up here, you may want to contribute
@@ -86,7 +96,7 @@ mod tests {
         assert_size!(SaslMechanisms, 12);
         assert_size!(RequiredStartTls, 0);
         assert_size!(StartTls, 1);
-        assert_size!(StreamFeatures, 40);
+        assert_size!(StreamFeatures, 92);
     }
 
     #[cfg(target_pointer_width = "64")]
@@ -95,7 +105,7 @@ mod tests {
         assert_size!(SaslMechanisms, 24);
         assert_size!(RequiredStartTls, 0);
         assert_size!(StartTls, 1);
-        assert_size!(StreamFeatures, 64);
+        assert_size!(StreamFeatures, 168);
     }
 
     #[test]