diff --git a/src/main.rs b/src/main.rs index efd072d..761ca37 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,6 +23,7 @@ use std::{ net::TcpStream, }; use irc_proto; +use irc_stream::{IrcStream, IrcRead, IrcWrite}; use toml::Value; use native_tls::{TlsConnector,TlsStream}; @@ -86,16 +87,18 @@ fn main() { // Weird workaround for multitrait dyn pointer // https://github.com/rust-lang/rfcs/issues/2035 // would be a charm... - trait ReadWrite: Read + Write {} - impl ReadWrite for T {} - let mut stream: &dyn ReadWrite; + trait IrcReadWrite: IrcRead + IrcWrite {} + impl IrcReadWrite for T {} + let mut stream: &dyn IrcReadWrite; if config["tls"].as_bool().unwrap() == true { - stream = &connect_irc_tls(&config).unwrap(); + stream = &IrcStream::new(connect_irc_tls(&config).unwrap()); } else { - stream = &connect_irc(&config).unwrap(); + stream = &IrcStream::new(connect_irc(&config).unwrap()); } + //let irc_stream = IrcStream::new(stream); + // TODO: Identify with irc server //stream.write(irc_proto.Message{ // tags: None,