plugins/messaging: Body, Thread, Subject are now structs

This commit is contained in:
Maxime “pep” Buquet 2017-12-26 20:55:19 +00:00
parent 5508f5b388
commit 1a8ea2e383

View file

@ -7,7 +7,7 @@ use error::Error;
use jid::Jid;
use plugins::stanza::Message;
use xmpp_parsers::message::{MessagePayload, MessageType};
use xmpp_parsers::message::{MessagePayload, MessageType, Body};
use xmpp_parsers::chatstates::ChatState;
use xmpp_parsers::receipts::{Request, Received};
use xmpp_parsers::stanza_id::StanzaId;
@ -70,7 +70,7 @@ impl MessagingPlugin {
id: Some(self.proxy.gen_id()),
bodies: {
let mut bodies = BTreeMap::new();
bodies.insert(String::new(), String::from(body));
bodies.insert(String::new(), Body(body.to_owned()));
bodies
},
subjects: BTreeMap::new(),
@ -118,9 +118,9 @@ impl MessagingPlugin {
if message.bodies.contains_key("") {
self.proxy.dispatch(MessageEvent {
from: from,
body: message.bodies[""].clone(),
subject: if message.subjects.contains_key("") { Some(message.subjects[""].clone()) } else { None },
thread: message.thread.clone(),
body: message.bodies[""].clone().0,
subject: if message.subjects.contains_key("") { Some(message.subjects[""].clone().0) } else { None },
thread: match message.thread.clone() { Some(thread) => Some(thread.0), None => None },
});
}
Propagation::Stop