diff --git a/src/plugins/mod.rs b/src/plugins/mod.rs index 355942eb10c8b425cea8879199a28dad6d4d42b0..c15ae5122d5c0e7a9fb1340fde90ca697c9bc630 100644 --- a/src/plugins/mod.rs +++ b/src/plugins/mod.rs @@ -2,3 +2,4 @@ pub mod messaging; pub mod presence; pub mod ping; pub mod stanza; +pub mod stanza_debug; diff --git a/src/plugins/ping.rs b/src/plugins/ping.rs index f409a1ee101a7534749e0656038d2e718c1f798f..e798bf0a5351597d80afd6e7953b40cbcccad4d6 100644 --- a/src/plugins/ping.rs +++ b/src/plugins/ping.rs @@ -51,7 +51,7 @@ impl PingPlugin { }); } } - Propagation::Continue + Propagation::Stop } fn reply_ping(&self, ping: &PingEvent) -> Propagation { diff --git a/src/plugins/stanza.rs b/src/plugins/stanza.rs index 02ef1259380948b25bf58c28a5524dfedb329e12..0924e5cf16988e33f05c01ea05c7fb395f7a9fc9 100644 --- a/src/plugins/stanza.rs +++ b/src/plugins/stanza.rs @@ -40,7 +40,7 @@ impl StanzaPlugin { self.proxy.dispatch(iq); } - Propagation::Continue + Propagation::Stop } } diff --git a/src/plugins/stanza_debug.rs b/src/plugins/stanza_debug.rs new file mode 100644 index 0000000000000000000000000000000000000000..c94679a5a67bd11767021bfda773ffe9c0d64d27 --- /dev/null +++ b/src/plugins/stanza_debug.rs @@ -0,0 +1,29 @@ +use plugin::PluginProxy; +use event::{SendElement, ReceiveElement, Propagation, Priority}; + +pub struct StanzaDebugPlugin { + proxy: PluginProxy, +} + +impl StanzaDebugPlugin { + pub fn new() -> StanzaDebugPlugin { + StanzaDebugPlugin { + proxy: PluginProxy::new(), + } + } + + fn handle_send_element(&self, evt: &SendElement) -> Propagation { + println!("SEND: {:?}", evt.0); + Propagation::Continue + } + + fn handle_receive_element(&self, evt: &ReceiveElement) -> Propagation { + println!("RECV: {:?}", evt.0); + Propagation::Continue + } +} + +impl_plugin!(StanzaDebugPlugin, proxy, [ + (SendElement, Priority::Min) => handle_send_element, + (ReceiveElement, Priority::Max) => handle_receive_element, +]);