From 36b0bead49d9fe5a180fd61e1ac378d27183677e Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 18 May 2017 23:09:30 +0100 Subject: [PATCH] message: Add stanza-id as a direct payload. --- src/message.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/message.rs b/src/message.rs index bb8e8b4..136f558 100644 --- a/src/message.rs +++ b/src/message.rs @@ -23,6 +23,7 @@ use delay::Delay; use attention::Attention; use message_correct::Replace; use eme::ExplicitMessageEncryption; +use stanza_id::StanzaId; /// Lists every known payload of a ``. #[derive(Debug, Clone)] @@ -34,6 +35,7 @@ pub enum MessagePayload { Attention(Attention), MessageCorrect(Replace), ExplicitMessageEncryption(ExplicitMessageEncryption), + StanzaId(StanzaId), } #[derive(Debug, Clone, PartialEq)] @@ -163,6 +165,8 @@ impl<'a> TryFrom<&'a Element> for Message { Some(MessagePayload::MessageCorrect(replace)) } else if let Ok(eme) = ExplicitMessageEncryption::try_from(elem) { Some(MessagePayload::ExplicitMessageEncryption(eme)) + } else if let Ok(stanza_id) = StanzaId::try_from(elem) { + Some(MessagePayload::StanzaId(stanza_id)) } else { None }; @@ -195,6 +199,7 @@ impl<'a> Into for &'a MessagePayload { MessagePayload::Delay(ref delay) => delay.into(), MessagePayload::MessageCorrect(ref replace) => replace.into(), MessagePayload::ExplicitMessageEncryption(ref eme) => eme.into(), + MessagePayload::StanzaId(ref stanza_id) => stanza_id.into(), } } }