2014-11-29 09:19:14 +01:00
|
|
|
extern crate irc;
|
|
|
|
|
2014-12-05 03:04:22 +01:00
|
|
|
use std::default::Default;
|
2015-02-21 16:18:53 +01:00
|
|
|
use std::thread::spawn;
|
2015-02-23 03:22:33 +01:00
|
|
|
use irc::client::prelude::*;
|
2014-11-29 09:19:14 +01:00
|
|
|
|
|
|
|
fn main() {
|
2014-12-05 03:04:22 +01:00
|
|
|
let config = Config {
|
|
|
|
nickname: Some(format!("pickles")),
|
|
|
|
server: Some(format!("irc.fyrechat.net")),
|
|
|
|
channels: Some(vec![format!("#vana")]),
|
|
|
|
.. Default::default()
|
|
|
|
};
|
2016-01-03 11:39:44 +01:00
|
|
|
let server = IrcServer::from_config(config).unwrap();
|
2014-11-29 09:19:14 +01:00
|
|
|
server.identify().unwrap();
|
2015-02-24 16:14:44 +01:00
|
|
|
let server = server.clone();
|
2015-06-22 18:03:57 +02:00
|
|
|
let _ = spawn(move || {
|
2014-11-29 09:19:14 +01:00
|
|
|
for msg in server.iter() {
|
2016-03-18 02:39:58 +01:00
|
|
|
print!("{}", msg.unwrap());
|
2014-11-29 09:19:14 +01:00
|
|
|
}
|
2014-12-23 19:00:07 +01:00
|
|
|
}).join(); // You might not want to join here for actual multi-threading.
|
2014-11-29 09:19:14 +01:00
|
|
|
}
|