mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
component: Fix handshake content, it’s hex, not base64!
This commit is contained in:
parent
011308b4b4
commit
0a057cdfef
1 changed files with 5 additions and 5 deletions
|
@ -8,11 +8,11 @@ use try_from::TryFrom;
|
||||||
|
|
||||||
use minidom::Element;
|
use minidom::Element;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use helpers::Base64;
|
use helpers::PlainText;
|
||||||
use ns;
|
use ns;
|
||||||
|
|
||||||
generate_element_with_text!(Handshake, "handshake", ns::COMPONENT,
|
generate_element_with_text!(Handshake, "handshake", ns::COMPONENT,
|
||||||
data: Base64<Vec<u8>>
|
data: PlainText<Option<String>>
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -23,10 +23,10 @@ mod tests {
|
||||||
fn test_simple() {
|
fn test_simple() {
|
||||||
let elem: Element = "<handshake xmlns='jabber:component:accept'/>".parse().unwrap();
|
let elem: Element = "<handshake xmlns='jabber:component:accept'/>".parse().unwrap();
|
||||||
let handshake = Handshake::try_from(elem).unwrap();
|
let handshake = Handshake::try_from(elem).unwrap();
|
||||||
assert!(handshake.data.is_empty());
|
assert_eq!(handshake.data, None);
|
||||||
|
|
||||||
let elem: Element = "<handshake xmlns='jabber:component:accept'>AAAA</handshake>".parse().unwrap();
|
let elem: Element = "<handshake xmlns='jabber:component:accept'>Coucou</handshake>".parse().unwrap();
|
||||||
let handshake = Handshake::try_from(elem).unwrap();
|
let handshake = Handshake::try_from(elem).unwrap();
|
||||||
assert_eq!(handshake.data, b"\0\0\0");
|
assert_eq!(handshake.data, Some(String::from("Coucou")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue