From 944cb3964e88d07a140f65f360635ec39adb6494 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 23 Apr 2017 19:32:48 +0100 Subject: [PATCH] presence: Add status as a possible payload. --- src/presence.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/presence.rs b/src/presence.rs index bb3334ef..ea2da4a3 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -9,12 +9,14 @@ use error::Error; use ns; +use status; use delay; use ecaps2; /// Lists every known payload of a ``. #[derive(Debug, Clone)] pub enum PresencePayload { + Status(status::Status), Delay(delay::Delay), ECaps2(ecaps2::ECaps2), } @@ -104,7 +106,9 @@ pub fn parse_presence(root: &Element) -> Result { }; let mut payloads = vec!(); for elem in root.children() { - let payload = if let Ok(delay) = delay::parse_delay(elem) { + let payload = if let Ok(status) = status::parse_status(elem) { + Some(PresencePayload::Status(status)) + } else if let Ok(delay) = delay::parse_delay(elem) { Some(PresencePayload::Delay(delay)) } else if let Ok(ecaps2) = ecaps2::parse_ecaps2(elem) { Some(PresencePayload::ECaps2(ecaps2)) @@ -127,6 +131,7 @@ pub fn parse_presence(root: &Element) -> Result { pub fn serialise_payload(payload: &PresencePayload) -> Element { match *payload { + PresencePayload::Status(ref status) => status::serialise(status), PresencePayload::Delay(ref delay) => delay::serialise(delay), PresencePayload::ECaps2(ref ecaps2) => ecaps2::serialise(ecaps2), }