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:
parent
1613a1c667
commit
a425a039ca
1 changed files with 15 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue