mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
jingle_ft: Use jingle’s ContentId type to identify content names.
This commit is contained in:
parent
0200ced3e5
commit
db9ef3ef30
1 changed files with 5 additions and 5 deletions
|
@ -10,7 +10,7 @@ use std::collections::BTreeMap;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use hashes::Hash;
|
use hashes::Hash;
|
||||||
use jingle::Creator;
|
use jingle::{Creator, ContentId};
|
||||||
|
|
||||||
use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter};
|
use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter};
|
||||||
use chrono::{DateTime, FixedOffset};
|
use chrono::{DateTime, FixedOffset};
|
||||||
|
@ -61,14 +61,14 @@ pub struct Description {
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Checksum {
|
pub struct Checksum {
|
||||||
pub name: String,
|
pub name: ContentId,
|
||||||
pub creator: Creator,
|
pub creator: Creator,
|
||||||
pub file: File,
|
pub file: File,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Received {
|
pub struct Received {
|
||||||
pub name: String,
|
pub name: ContentId,
|
||||||
pub creator: Creator,
|
pub creator: Creator,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,11 +337,11 @@ mod tests {
|
||||||
fn test_received() {
|
fn test_received() {
|
||||||
let elem: Element = "<received xmlns='urn:xmpp:jingle:apps:file-transfer:5' name='coucou' creator='initiator'/>".parse().unwrap();
|
let elem: Element = "<received xmlns='urn:xmpp:jingle:apps:file-transfer:5' name='coucou' creator='initiator'/>".parse().unwrap();
|
||||||
let received = Received::try_from(elem).unwrap();
|
let received = Received::try_from(elem).unwrap();
|
||||||
assert_eq!(received.name, String::from("coucou"));
|
assert_eq!(received.name, ContentId(String::from("coucou")));
|
||||||
assert_eq!(received.creator, Creator::Initiator);
|
assert_eq!(received.creator, Creator::Initiator);
|
||||||
let elem2 = Element::from(received.clone());
|
let elem2 = Element::from(received.clone());
|
||||||
let received2 = Received::try_from(elem2).unwrap();
|
let received2 = Received::try_from(elem2).unwrap();
|
||||||
assert_eq!(received2.name, String::from("coucou"));
|
assert_eq!(received2.name, ContentId(String::from("coucou")));
|
||||||
assert_eq!(received2.creator, Creator::Initiator);
|
assert_eq!(received2.creator, Creator::Initiator);
|
||||||
|
|
||||||
let elem: Element = "<received xmlns='urn:xmpp:jingle:apps:file-transfer:5' name='coucou' creator='initiator'><coucou/></received>".parse().unwrap();
|
let elem: Element = "<received xmlns='urn:xmpp:jingle:apps:file-transfer:5' name='coucou' creator='initiator'><coucou/></received>".parse().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue