Merge branch 'stanza-debug' into 'master'

Enable stanza_debug automatically when STANZA_DEBUG is set in the env

See merge request !21
This commit is contained in:
lumi 2017-06-11 14:49:21 +00:00
commit a5f87494c2

View file

@ -2,6 +2,7 @@ extern crate xmpp;
use xmpp::jid::Jid; use xmpp::jid::Jid;
use xmpp::client::ClientBuilder; use xmpp::client::ClientBuilder;
use xmpp::plugins::stanza_debug::StanzaDebugPlugin;
use xmpp::plugins::stanza::StanzaPlugin; use xmpp::plugins::stanza::StanzaPlugin;
use xmpp::plugins::unhandled_iq::UnhandledIqPlugin; use xmpp::plugins::unhandled_iq::UnhandledIqPlugin;
use xmpp::plugins::messaging::{MessagingPlugin, MessageEvent}; use xmpp::plugins::messaging::{MessagingPlugin, MessageEvent};
@ -20,6 +21,9 @@ fn main() {
.password(pass) .password(pass)
.connect() .connect()
.unwrap(); .unwrap();
if env::var("STANZA_DEBUG").is_ok() {
client.register_plugin(StanzaDebugPlugin::new());
}
client.register_plugin(StanzaPlugin::new()); client.register_plugin(StanzaPlugin::new());
client.register_plugin(UnhandledIqPlugin::new()); client.register_plugin(UnhandledIqPlugin::new());
client.register_plugin(MessagingPlugin::new()); client.register_plugin(MessagingPlugin::new());