add stanza_debug to client example when STANZA_DEBUG is in the env

This commit is contained in:
Emmanuel Gil Peyrot 2017-05-30 22:13:47 +01:00
parent 264e58b1bf
commit 313e7a1770

View file

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