From 073e208f060697e423828a3a872dd27a2ba2032c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 28 May 2017 17:12:46 +0100 Subject: [PATCH] iq: Wire up Roster. --- src/iq.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/iq.rs b/src/iq.rs index 7ab3309..76a97b1 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -17,6 +17,7 @@ use error::Error; use ns; use stanza_error::StanzaError; +use roster::Roster; use disco::Disco; use ibb::IBB; use jingle::Jingle; @@ -26,6 +27,7 @@ use mam::{Query as MamQuery, Fin as MamFin, Prefs as MamPrefs}; /// Lists every known payload of a ``. #[derive(Debug, Clone)] pub enum IqPayload { + Roster(Roster), Disco(Disco), IBB(IBB), Jingle(Jingle), @@ -42,6 +44,9 @@ impl TryFrom for IqPayload { fn try_from(elem: Element) -> Result { Ok(match (elem.name().as_ref(), elem.ns().unwrap().as_ref()) { + // RFC-6121 + ("query", ns::ROSTER) => IqPayload::Roster(Roster::try_from(elem)?), + // XEP-0030 ("query", ns::DISCO_INFO) => IqPayload::Disco(Disco::try_from(elem)?), @@ -165,6 +170,7 @@ impl TryFrom for Iq { impl Into for IqPayload { fn into(self) -> Element { match self { + IqPayload::Roster(roster) => roster.into(), IqPayload::Disco(disco) => disco.into(), IqPayload::IBB(ibb) => ibb.into(), IqPayload::Jingle(jingle) => jingle.into(),