summaryrefslogtreecommitdiffstats
path: root/examples/client.rs
blob: 90a6b32d93d1cb4d7ebcb112b718bd82bdcbd93f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
extern crate irc;

use irc::constants::{CommandMessage, Nick, User};

fn main () {
    let mut client = irc::Client::new("doytest", "chat.freenode.net", 6667);
    client.connect();

    client.write(
        irc::Message::new(
            None,
            CommandMessage(Nick),
            vec!["doytest".to_string()],
        )
    );
    client.write(
        irc::Message::new(
            None,
            CommandMessage(User),
            vec![
                "doytest".to_string(),
                "localhost".to_string(),
                "localhost".to_string(),
                "doytest".to_string(),
            ],
        )
    );

    loop {
        let res = client.read();
        println!("{}", res);
    }
}