mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
component: Fix attributes parsing; thanks Link Mauve
This commit is contained in:
parent
5f9d91140d
commit
2fb540f85b
1 changed files with 11 additions and 13 deletions
|
@ -138,24 +138,22 @@ impl Component {
|
||||||
let e = transport.read_event()?;
|
let e = transport.read_event()?;
|
||||||
match e {
|
match e {
|
||||||
XmlEvent::Start(ref e) => {
|
XmlEvent::Start(ref e) => {
|
||||||
let mut attributes = e.attributes()
|
for attr_result in e.attributes() {
|
||||||
.map(|o| {
|
match attr_result {
|
||||||
let o = o?;
|
Ok(attr) => {
|
||||||
let key = str::from_utf8(o.key)?;
|
let name = str::from_utf8(attr.key)?;
|
||||||
let value = str::from_utf8(&o.value)?;
|
let value = str::from_utf8(&attr.value)?;
|
||||||
Ok((key, value))
|
if name == "id" {
|
||||||
}
|
sid = value.to_owned();
|
||||||
)
|
}
|
||||||
.collect::<Result<Vec<(&str, &str)>, Error>>()?;
|
},
|
||||||
for &(name, value) in &attributes {
|
_ => panic!()
|
||||||
if name == "id" {
|
|
||||||
sid = value.to_owned();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
break
|
|
||||||
}
|
}
|
||||||
let concatenated = format!("{}{}", sid, secret);
|
let concatenated = format!("{}{}", sid, secret);
|
||||||
let mut hasher = Sha1::default();
|
let mut hasher = Sha1::default();
|
||||||
|
|
Loading…
Reference in a new issue