summaryrefslogtreecommitdiffstats
path: root/src/stanza/stream.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2023-07-12 21:11:20 +0100
committerLibravatar cel 🌸 <cel@blos.sm>2023-07-12 21:11:20 +0100
commit322b2a3b46348ec1c5acbc538de93310c9030b96 (patch)
treee447920e2414c4d3d99ce021785f0fe8103d378a /src/stanza/stream.rs
parentc9683935f1e94a701be3e6efe0634dbc63c861de (diff)
downloadluz-322b2a3b46348ec1c5acbc538de93310c9030b96.tar.gz
luz-322b2a3b46348ec1c5acbc538de93310c9030b96.tar.bz2
luz-322b2a3b46348ec1c5acbc538de93310c9030b96.zip
reimplement sasl (with SCRAM!)
Diffstat (limited to 'src/stanza/stream.rs')
-rw-r--r--src/stanza/stream.rs20
1 files changed, 10 insertions, 10 deletions
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<Element<'e>> 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<Element<'e>> for Vec<StreamFeature> {
fn try_from(features_element: Element) -> Result<Self> {
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()),