muc/user: impl PresencePayload for MucUser

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>


(cherry picked from commit 7e211619e3b51ab86ecf5cf0b746c5e16b790418)
This commit is contained in:
Maxime “pep” Buquet 2022-09-10 11:34:45 +02:00 committed by Link Mauve
parent 1613a1c667
commit a425a039ca

View file

@ -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 = "<x xmlns='http://jabber.org/protocol/muc#user'/>"
.parse()
.unwrap();
let presence = Presence::new(PresenceType::None)
.with_payloads(vec![elem]);
assert_eq!(presence.payloads.len(), 1);
}
}