From 5e4ba2701bab08b148eccb9a0873ae8c062c43bc Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 28 Apr 2017 23:46:06 +0100 Subject: [PATCH] iq: Wire up the Jingle parser and serialiser. --- src/iq.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/iq.rs b/src/iq.rs index 9d7fd79..2edf6c8 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -8,12 +8,14 @@ use error::Error; use ns; use disco; +use jingle; use ping; /// Lists every known payload of a ``. #[derive(Debug, Clone)] pub enum IqPayload { Disco(disco::Disco), + Jingle(jingle::Jingle), Ping(ping::Ping), } @@ -79,6 +81,8 @@ pub fn parse_iq(root: &Element) -> Result { } else { let parsed_payload = if let Ok(disco) = disco::parse_disco(elem) { Some(IqPayload::Disco(disco)) + } else if let Ok(jingle) = jingle::parse_jingle(elem) { + Some(IqPayload::Jingle(jingle)) } else if let Ok(ping) = ping::parse_ping(elem) { Some(IqPayload::Ping(ping)) } else { @@ -131,6 +135,7 @@ pub fn parse_iq(root: &Element) -> Result { pub fn serialise_payload(payload: &IqPayload) -> Element { match *payload { IqPayload::Disco(ref disco) => disco::serialise_disco(disco), + IqPayload::Jingle(ref jingle) => jingle::serialise(jingle), IqPayload::Ping(_) => ping::serialise_ping(), } }