Add log as a dependency, for tracing XML and stuff.

This commit is contained in:
Emmanuel Gil Peyrot 2019-09-29 04:08:56 +02:00
parent 598bbdd523
commit 76619178a2
3 changed files with 7 additions and 1 deletions

View file

@ -18,3 +18,4 @@ tokio-xmpp = "1.0.1"
xmpp-parsers = "0.15"
futures = "0.1"
tokio = "0.1"
log = "0.4"

View file

@ -34,6 +34,8 @@ use xmpp_parsers::{
stanza_error::{StanzaError, ErrorType, DefinedCondition},
Jid, BareJid, FullJid, JidParseError,
};
#[macro_use]
extern crate log;
mod pubsub;

View file

@ -26,7 +26,9 @@ pub(crate) mod avatar;
pub(crate) fn handle_event(from: &Jid, elem: Element, mut tx: &mut mpsc::UnboundedSender<Packet>) -> impl IntoIterator<Item = Event> {
let mut events = Vec::new();
match PubSubEvent::try_from(elem) {
let event = PubSubEvent::try_from(elem);
trace!("PubSub event: {:#?}", event);
match event {
Ok(PubSubEvent::PublishedItems { node, items }) => {
match node.0 {
#[cfg(feature = "avatars")]
@ -83,6 +85,7 @@ pub(crate) fn handle_event(from: &Jid, elem: Element, mut tx: &mut mpsc::Unbound
pub(crate) fn handle_iq_result(from: &Jid, elem: Element) -> impl IntoIterator<Item = Event> {
let mut events = Vec::new();
let pubsub = PubSub::try_from(elem).unwrap();
trace!("PubSub: {:#?}", pubsub);
if let PubSub::Items(items) = pubsub {
match items.node.0.clone() {
#[cfg(feature = "avatars")]