mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
parsers: impl MessagePayload for MucUser
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
6cd4addc1a
commit
d0ec8739d5
1 changed files with 14 additions and 0 deletions
|
@ -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 = "<x xmlns='http://jabber.org/protocol/muc#user'/>"
|
||||
.parse()
|
||||
.unwrap();
|
||||
let message = Message::new(jid).with_payloads(vec![elem]);
|
||||
assert_eq!(message.payloads.len(), 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue