Use irc-stream.
This commit is contained in:
parent
eece7a1155
commit
e7abea7bfc
1 changed files with 8 additions and 5 deletions
13
src/main.rs
13
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<T: Read + Write> ReadWrite for T {}
|
||||
let mut stream: &dyn ReadWrite;
|
||||
trait IrcReadWrite: IrcRead + IrcWrite {}
|
||||
impl<T: IrcRead + IrcWrite> 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,
|
||||
|
|
Loading…
Reference in a new issue