From 322b2a3b46348ec1c5acbc538de93310c9030b96 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Wed, 12 Jul 2023 21:11:20 +0100 Subject: reimplement sasl (with SCRAM!) --- src/stanza/stream.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/stanza/stream.rs') diff --git a/src/stanza/stream.rs b/src/stanza/stream.rs index 32f449d..66741b8 100644 --- a/src/stanza/stream.rs +++ b/src/stanza/stream.rs @@ -58,7 +58,7 @@ impl Stream { } } - fn build(&self) -> BytesStart { + fn event(&self) -> Event<'static> { let mut start = BytesStart::new("stream:stream"); if let Some(from) = &self.from { start.push_attribute(("from", from.to_string().as_str())); @@ -80,15 +80,15 @@ impl Stream { XMLNS::Server => start.push_attribute(("xmlns", XMLNS::Server.into())), } start.push_attribute(("xmlns:stream", XMLNS_STREAM)); - start + Event::Start(start) } } impl<'e> Into> for Stream { fn into(self) -> Element<'e> { Element { - event: Event::Start(self.build().to_owned()), - content: None, + event: self.event(), + children: None, } } } @@ -153,17 +153,17 @@ impl<'e> TryFrom> for Vec { fn try_from(features_element: Element) -> Result { let mut features = Vec::new(); - if let Some(content) = features_element.content { - for feature_element in content { + if let Some(children) = features_element.children { + for feature_element in children { match feature_element.event { Event::Start(e) => match e.name() { QName(b"starttls") => features.push(StreamFeature::StartTls), QName(b"mechanisms") => { let mut mechanisms = Vec::new(); - if let Some(content) = feature_element.content { - for mechanism_element in content { - if let Some(content) = mechanism_element.content { - for mechanism_text in content { + if let Some(children) = feature_element.children { + for mechanism_element in children { + if let Some(children) = mechanism_element.children { + for mechanism_text in children { match mechanism_text.event { Event::Text(e) => mechanisms .push(str::from_utf8(e.as_ref())?.to_owned()), -- cgit