From f6b222f49ae482ff0ef0a4367d49cec463d50969 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 25 Jun 2017 22:15:18 +0100 Subject: [PATCH] =?UTF-8?q?jingle=5Fibb:=20Strengthen=20sid=E2=80=99s=20ty?= =?UTF-8?q?pe=20safety.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jingle_ibb.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/jingle_ibb.rs b/src/jingle_ibb.rs index 25dbaa37..72ebba55 100644 --- a/src/jingle_ibb.rs +++ b/src/jingle_ibb.rs @@ -5,8 +5,9 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. use std::convert::TryFrom; +use std::str::FromStr; -use minidom::Element; +use minidom::{Element, IntoAttributeValue}; use error::Error; @@ -14,10 +15,12 @@ use ns; use ibb::Stanza; +generate_id!(StreamId); + #[derive(Debug, Clone)] pub struct Transport { pub block_size: u16, - pub sid: String, + pub sid: StreamId, pub stanza: Stanza, } @@ -60,7 +63,7 @@ mod tests { let elem: Element = "".parse().unwrap(); let transport = Transport::try_from(elem).unwrap(); assert_eq!(transport.block_size, 3); - assert_eq!(transport.sid, "coucou"); + assert_eq!(transport.sid, StreamId(String::from("coucou"))); assert_eq!(transport.stanza, Stanza::Iq); }