summaryrefslogtreecommitdiffstats
path: root/examples/client.rs
blob: c5f31a72635951770463ef1d5a45db78e509fff0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
extern crate irc;

use std::io;

pub struct ExampleClient;

impl irc::ClientCallbacks for ExampleClient {
    fn on_any_message (&mut self, _client: &mut irc::Client, m: &irc::Message) -> io::IoResult<()> {
        print!("{}", m.to_protocol_string());
        Ok(())
    }
}

fn main () {
    let builder = irc::ClientBuilder::new("doytest", "chat.freenode.net");
    let client = builder.connect();
    client.run_loop_with_callbacks(ExampleClient);
}