From 34ee6d52dc1eda6937f6dea7f5738926f258e83b Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 May 2017 20:30:42 +0100 Subject: [PATCH] presence: Wire up idle as a payload. --- src/presence.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/presence.rs b/src/presence.rs index d780d00..fd6547b 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -18,6 +18,7 @@ use ns; use stanza_error::StanzaError; use delay::Delay; +use idle::Idle; use ecaps2::ECaps2; #[derive(Debug, Clone, PartialEq)] @@ -50,6 +51,7 @@ pub type Priority = i8; pub enum PresencePayload { StanzaError(StanzaError), Delay(Delay), + Idle(Idle), ECaps2(ECaps2), Unknown(Element), @@ -65,6 +67,9 @@ impl<'a> TryFrom<&'a Element> for PresencePayload { // XEP-0203 ("delay", ns::DELAY) => PresencePayload::Delay(Delay::try_from(elem)?), + // XEP-0319 + ("idle", ns::IDLE) => PresencePayload::Idle(Idle::try_from(elem)?), + // XEP-0390 ("c", ns::ECAPS2) => PresencePayload::ECaps2(ECaps2::try_from(elem)?), @@ -78,6 +83,7 @@ impl<'a> Into for &'a PresencePayload { match *self { PresencePayload::StanzaError(ref stanza_error) => stanza_error.into(), PresencePayload::Delay(ref delay) => delay.into(), + PresencePayload::Idle(ref idle) => idle.into(), PresencePayload::ECaps2(ref ecaps2) => ecaps2.into(), PresencePayload::Unknown(ref elem) => elem.clone(),