summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-09-09 18:57:53 -0400
committerJesse Luehrs <doy@tozt.net>2014-09-09 18:57:53 -0400
commit1adaa2390928e87108208ec75e3748dd5a77fff3 (patch)
treec7d97cf63684ae224c60c6ac1498cb01fcfd95ad /src
parentf0bf003b94c723c27f9d2ece53cf8ef93bb56d28 (diff)
downloadrust-irc-1adaa2390928e87108208ec75e3748dd5a77fff3.tar.gz
rust-irc-1adaa2390928e87108208ec75e3748dd5a77fff3.zip
the default PING implementation should reply with PONG
Diffstat (limited to 'src')
-rw-r--r--src/client.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs
index c4b507f..901070a 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -867,7 +867,13 @@ pub trait ClientCallbacks {
#[allow(unused_variable)] fn on_whowas (&mut self, client: &mut Client, from: Option<&str>, nickname: &str, count: Option<u32>, server: Option<&str>) -> io::IoResult<()> { Ok(()) }
#[allow(unused_variable)] fn on_kill (&mut self, client: &mut Client, from: Option<&str>, nickname: &str, comment: &str) -> io::IoResult<()> { Ok(()) }
- #[allow(unused_variable)] fn on_ping (&mut self, client: &mut Client, from: Option<&str>, server1: &str, server2: Option<&str>) -> io::IoResult<()> { Ok(()) }
+ #[allow(unused_variable)] fn on_ping (&mut self, client: &mut Client, from: Option<&str>, server1: &str, server2: Option<&str>) -> io::IoResult<()> {
+ let params = match server2 {
+ Some(server2) => vec![server1.to_string(), server2.to_string()],
+ None => vec![server1.to_string()],
+ };
+ client.write(Message::new(None, Pong, params))
+ }
#[allow(unused_variable)] fn on_pong (&mut self, client: &mut Client, from: Option<&str>, daemon1: &str, daemon2: Option<&str>) -> io::IoResult<()> { Ok(()) }
#[allow(unused_variable)] fn on_error (&mut self, client: &mut Client, from: Option<&str>, message: &str) -> io::IoResult<()> { Ok(()) }