rust-irc/examples/simple_ssl.rs

26 lines
715 B
Rust

extern crate irc;
use std::default::Default;
use irc::client::prelude::*;
fn main() {
let config = Config {
nickname: Some("pickles".to_owned()),
server: Some("irc.fyrechat.net".to_owned()),
channels: Some(vec!["#irc-crate".to_owned()]),
use_ssl: Some(true),
..Default::default()
};
let client = IrcClient::from_config(config).unwrap();
client.identify().unwrap();
client.for_each_incoming(|message| {
print!("{}", message);
if let Command::PRIVMSG(ref target, ref msg) = message.command {
if msg.contains("pickles") {
client.send_privmsg(target, "Hi!").unwrap();
}
}
}).unwrap();
}