From 3dd0eb3a9b2adfc3afede97b273633d7513f6cae Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 1 May 2017 01:02:35 +0100 Subject: [PATCH] presence: Wire up stanza_error. --- src/presence.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/presence.rs b/src/presence.rs index fb26d94f..3b3c1faa 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -16,6 +16,7 @@ use error::Error; use ns; +use stanza_error; use delay; use ecaps2; @@ -50,6 +51,7 @@ pub enum PresencePayload { Show(Show), Status(Status), Priority(Priority), + StanzaError(stanza_error::StanzaError), Delay(delay::Delay), ECaps2(ecaps2::ECaps2), } @@ -177,7 +179,9 @@ pub fn parse_presence(root: &Element) -> Result { } priority = Some(Priority::from_str(elem.text().as_ref())?); } else { - let payload = if let Ok(delay) = delay::parse_delay(elem) { + let payload = if let Ok(stanza_error) = stanza_error::parse_stanza_error(elem) { + Some(PresencePayload::StanzaError(stanza_error)) + } 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)) @@ -222,6 +226,7 @@ pub fn serialise_payload(payload: &PresencePayload) -> Element { .append(format!("{}", priority)) .build() }, + PresencePayload::StanzaError(ref stanza_error) => stanza_error::serialise(stanza_error), PresencePayload::Delay(ref delay) => delay::serialise(delay), PresencePayload::ECaps2(ref ecaps2) => ecaps2::serialise(ecaps2), }