diff options
-rw-r--r-- | examples/client.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/examples/client.rs b/examples/client.rs index ef0f7d2..16065f4 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -1,9 +1,17 @@ extern crate irc; +use irc::constants::{Ping, Pong}; + fn main () { let builder = irc::ClientBuilder::new("doytest", "chat.freenode.net"); let client = builder.connect(); - client.run_loop_with(|_client, m| { + client.run_loop_with(|client, m| { println!("{}", m); + match m.message_type() { + &Ping => { + client.write(irc::Message::new(None, Pong, m.params().clone())); + }, + _ => {}, + } }); } |