From a4dcf4b1d4586055e949062a5f5be141007ef58c Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Tue, 10 Jun 2014 01:16:45 -0400 Subject: Updated --- examples/client.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'examples') diff --git a/examples/client.rs b/examples/client.rs index ba8c1de..c2dc89f 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -18,10 +18,26 @@ fn main() { drop(args); let mut connection = IrcClient::connect(host.as_slice(), port, "rusty-irc".to_string(), "dremann".to_string(), "Zachary Dremann".to_string()).unwrap(); + let sender = connection.sender(); let on_msg = |message: &Message| { println!("{}", *message); }; + + spawn(proc() { + let mut stdin = stdio::stdin(); + for line in stdin.lines() { + match line { + Ok(s) => { + match from_str(s.as_slice()) { + Some(msg) => sender.send(msg), + None => () + } + } + Err(_) => break, + } + } + }); connection.run_loop(on_msg); } -- cgit v1.2.3-54-g00ecf