From 1f00b773bb45e7c7a0c4acf3905aa2770e2f4470 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 9 Sep 2014 19:14:35 -0400 Subject: add callbacks for on_command and on_reply --- src/client.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/client.rs b/src/client.rs index 901070a..3903fb7 100644 --- a/src/client.rs +++ b/src/client.rs @@ -195,6 +195,13 @@ pub trait ClientCallbacks { let err = client.run_loop(|client, m| { try!(self.on_any_message(client, m)); + if m.is_reply() { + try!(self.on_reply(client, m)); + } + else { + try!(self.on_command(client, m)); + } + let from = m.from().as_ref().map(|s| s.as_slice()); let p = m.params().as_slice(); match *m.message_type() { @@ -833,6 +840,9 @@ pub trait ClientCallbacks { #[allow(unused_variable)] fn on_invalid_message (&mut self, client: &mut Client, m: &Message) -> io::IoResult<()> { Ok(()) } #[allow(unused_variable)] fn on_unknown_message (&mut self, client: &mut Client, m: &Message) -> io::IoResult<()> { Ok(()) } + #[allow(unused_variable)] fn on_command (&mut self, client: &mut Client, m: &Message) -> io::IoResult<()> { Ok(()) } + #[allow(unused_variable)] fn on_reply (&mut self, client: &mut Client, m: &Message) -> io::IoResult<()> { Ok(()) } + #[allow(unused_variable)] fn on_pass (&mut self, client: &mut Client, from: Option<&str>, pass: &str) -> io::IoResult<()> { Ok(()) } #[allow(unused_variable)] fn on_nick (&mut self, client: &mut Client, from: Option<&str>, nick: &str, hopcount: Option) -> io::IoResult<()> { Ok(()) } #[allow(unused_variable)] fn on_user (&mut self, client: &mut Client, from: Option<&str>, username: &str, hostname: &str, servername: &str, realname: &str) -> io::IoResult<()> { Ok(()) } -- cgit v1.2.3