From a425a039ca7f4f32b096a4bba99b30bf46d5c207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 10 Sep 2022 11:34:45 +0200 Subject: [PATCH] muc/user: impl PresencePayload for MucUser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet (cherry picked from commit 7e211619e3b51ab86ecf5cf0b746c5e16b790418) --- parsers/src/muc/user.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/parsers/src/muc/user.rs b/parsers/src/muc/user.rs index f405218..7bd5180 100644 --- a/parsers/src/muc/user.rs +++ b/parsers/src/muc/user.rs @@ -8,6 +8,8 @@ use crate::ns; use crate::util::error::Error; use crate::Element; +use crate::presence::PresencePayload; + use jid::FullJid; use std::convert::TryFrom; @@ -233,9 +235,12 @@ generate_element!( ] ); +impl PresencePayload for MucUser {} + #[cfg(test)] mod tests { use super::*; + use crate::presence::{Presence, Type as PresenceType}; #[test] fn test_simple() { @@ -665,4 +670,14 @@ mod tests { let serialized: Element = item.into(); assert_eq!(serialized, reference); } + + #[test] + fn presence_payload() { + let elem: Element = "" + .parse() + .unwrap(); + let presence = Presence::new(PresenceType::None) + .with_payloads(vec![elem]); + assert_eq!(presence.payloads.len(), 1); + } }