diff --git a/src/message.rs b/src/message.rs index 609aa77..34dc49b 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1,7 +1,7 @@ use std::str::FromStr; -use minidom::Element; -use minidom::IntoAttributeValue; +use minidom::{Element, IntoElements, IntoAttributeValue}; +use minidom::convert::ElementEmitter; use jid::Jid; @@ -164,6 +164,13 @@ pub fn serialise(message: &Message) -> Element { stanza } +impl IntoElements for Message { + fn into_elements(self, emitter: &mut ElementEmitter) { + let elem = serialise(&self); + emitter.append_child(elem); + } +} + #[cfg(test)] mod tests { use std::str::FromStr;