From d0ec8739d5a31adf77f3522bff3ff67212f23a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 7 Jun 2023 16:46:43 +0200 Subject: [PATCH] parsers: impl MessagePayload for MucUser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- parsers/src/muc/user.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/parsers/src/muc/user.rs b/parsers/src/muc/user.rs index b559923..e355c3d 100644 --- a/parsers/src/muc/user.rs +++ b/parsers/src/muc/user.rs @@ -5,6 +5,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +use crate::message::MessagePayload; use crate::ns; use crate::presence::PresencePayload; use crate::util::error::Error; @@ -270,12 +271,15 @@ generate_element!( ] ); +impl MessagePayload for MucUser {} impl PresencePayload for MucUser {} #[cfg(test)] mod tests { use super::*; + use crate::message::Message; use crate::presence::{Presence, Type as PresenceType}; + use crate::{BareJid, Jid}; #[test] fn test_simple() { @@ -714,4 +718,14 @@ mod tests { let presence = Presence::new(PresenceType::None).with_payloads(vec![elem]); assert_eq!(presence.payloads.len(), 1); } + + #[test] + fn message_payload() { + let jid: Jid = Jid::Bare(BareJid::new("louise", "example.com")); + let elem: Element = "" + .parse() + .unwrap(); + let message = Message::new(jid).with_payloads(vec![elem]); + assert_eq!(message.payloads.len(), 1); + } }