From de93c32cb57bcf1560ad9c5d56beb92e655cfed2 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 28 Apr 2017 23:43:47 +0100 Subject: [PATCH] jingle_ft: Add a received parser. --- src/jingle_ft.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/jingle_ft.rs b/src/jingle_ft.rs index 4cd73b1..4d5a86a 100644 --- a/src/jingle_ft.rs +++ b/src/jingle_ft.rs @@ -62,6 +62,26 @@ pub struct Checksum { pub file: File, } +#[derive(Debug, Clone)] +pub struct Received { + pub name: String, + pub creator: Creator, +} + +impl IntoElements for Received { + fn into_elements(self, emitter: &mut ElementEmitter) { + let elem = Element::builder("received") + .ns(ns::JINGLE_FT) + .attr("name", self.name) + .attr("creator", match self.creator { + Creator::Initiator => "initiator", + Creator::Responder => "responder", + }) + .build(); + emitter.append_child(elem); + } +} + pub fn parse_jingle_ft(root: &Element) -> Result { if !root.is("description", ns::JINGLE_FT) { return Err(Error::ParseError("This is not a JingleFT description element."));