summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-09-09 19:14:35 -0400
committerJesse Luehrs <doy@tozt.net>2014-09-09 19:14:35 -0400
commit1f00b773bb45e7c7a0c4acf3905aa2770e2f4470 (patch)
treea78aa8c40f7a428cd7d49279def3b6778b03a221 /src
parent01a7dcbd4ba33b63d8c03ec15dddbef0c422c1f5 (diff)
downloadrust-irc-1f00b773bb45e7c7a0c4acf3905aa2770e2f4470.tar.gz
rust-irc-1f00b773bb45e7c7a0c4acf3905aa2770e2f4470.zip
add callbacks for on_command and on_reply
Diffstat (limited to 'src')
-rw-r--r--src/client.rs10
1 files changed, 10 insertions, 0 deletions
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<u32>) -> 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(()) }