diff options
author | Zachary Dremann <dremann@gmail.com> | 2014-06-25 09:14:42 -0400 |
---|---|---|
committer | Zachary Dremann <dremann@gmail.com> | 2014-06-25 09:14:42 -0400 |
commit | 4beb868e0ca2aa5ad9c29e4ba934c0fd8fc2501e (patch) | |
tree | f6dcc3385f737303e2876e1b5c1de63ad1dce59b /examples | |
parent | c140343437f4339ad88761bade9fd50038ae20ac (diff) | |
download | rusty-irc-4beb868e0ca2aa5ad9c29e4ba934c0fd8fc2501e.tar.gz rusty-irc-4beb868e0ca2aa5ad9c29e4ba934c0fd8fc2501e.zip |
Allow IrcClient to be cloned, and sent between tasks.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/client.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/examples/client.rs b/examples/client.rs index a48d2a6..9c5e15a 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -18,9 +18,15 @@ fn main() { let (tx, rx) = channel(); - let client = IrcClient::new("rusti-irc".to_string(), "dremann".to_string(), "Zachary Dremann".to_string()); - let connection = client.connect(host.as_slice(), port, tx).ok().unwrap(); - let sender = connection.sender().clone(); + let nicks = (vec!["rusti-irc".to_string()]).move_iter(); + let config = irc::ClientConfig { + nicks: nicks, + username: "dremann".to_string(), + real_name: "Zachary Dremann".to_string() + }; + + let client = IrcClient::new(config, host.as_slice(), port, tx).unwrap(); + let sender = client.sender().clone(); spawn(proc() { let mut stdin = stdio::stdin(); @@ -38,6 +44,8 @@ fn main() { }); for msg in rx.iter() { + let c = client.clone(); + println!("{}", c.nick()); println!("{} {}", msg.prefix, msg.command); } |