stanza_debug.rs

 1use plugin::PluginProxy;
 2use event::{SendElement, ReceiveElement, Propagation, Priority};
 3
 4pub struct StanzaDebugPlugin {
 5    proxy: PluginProxy,
 6}
 7
 8impl StanzaDebugPlugin {
 9    pub fn new() -> StanzaDebugPlugin {
10        StanzaDebugPlugin {
11            proxy: PluginProxy::new(),
12        }
13    }
14
15    fn handle_send_element(&self, evt: &SendElement) -> Propagation {
16        println!("SEND: {:?}", evt.0);
17        Propagation::Continue
18    }
19
20    fn handle_receive_element(&self, evt: &ReceiveElement) -> Propagation {
21        println!("RECV: {:?}", evt.0);
22        Propagation::Continue
23    }
24}
25
26impl_plugin!(StanzaDebugPlugin, proxy, [
27    (SendElement, Priority::Min) => handle_send_element,
28    (ReceiveElement, Priority::Max) => handle_receive_element,
29]);