muc/user: impl PresencePayload for MucUser

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2022-09-10 11:34:45 +02:00
parent 1613a1c667
commit 7e211619e3
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

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);
}
}