diff options
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | src/client.rs | 8 | ||||
-rw-r--r-- | src/lib.rs | 4 |
3 files changed, 1 insertions, 17 deletions
@@ -13,15 +13,11 @@ license = "MIT" log = "*" regex = "*" regex_macros = "*" +openssl = "*" [features] -ssl = ["openssl"] lints = ["clippy"] -[dependencies.openssl] -version = "*" -optional = true - [dependencies.carboxyl] git = "https://github.com/tilpner/carboxyl" diff --git a/src/client.rs b/src/client.rs index 339415b..e09532f 100644 --- a/src/client.rs +++ b/src/client.rs @@ -20,13 +20,11 @@ use reply::Reply; use event::Event; use ::{ DEBUG, Result, IrscError }; -#[cfg(feature = "ssl")] use openssl::ssl::{ Ssl, SslContext, SslMethod, SslStream }; /// Yes, I don't like the name either, but it's private, so... enum StreamKind { Plain(TcpStream), - #[cfg(feature = "ssl")] Ssl(SslStream<TcpStream>) } @@ -34,7 +32,6 @@ impl Write for StreamKind { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { match *self { StreamKind::Plain(ref mut s) => s.write(buf), - #[cfg(feature = "ssl")] StreamKind::Ssl(ref mut s) => s.write(buf) } } @@ -42,7 +39,6 @@ impl Write for StreamKind { fn flush(&mut self) -> io::Result<()> { match *self { StreamKind::Plain(ref mut s) => s.flush(), - #[cfg(feature = "ssl")] StreamKind::Ssl(ref mut s) => s.flush() } } @@ -52,7 +48,6 @@ impl Read for StreamKind { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { match *self { StreamKind::Plain(ref mut s) => s.read(buf), - #[cfg(feature = "ssl")] StreamKind::Ssl(ref mut s) => s.read(buf) } } @@ -110,7 +105,6 @@ impl OwnedClient { Result(Ok(())) } - #[cfg(feature = "ssl")] pub fn connect_ssl(&mut self, host: &str, port: u16, ssl: Ssl) -> Result<()> { let s = &mut self.stream; if s.is_some() { return Result(Err(IrscError::AlreadyConnected)) }; @@ -152,7 +146,6 @@ impl OwnedClient { where F: Fn(&mut Client, &Message, Option<Event>) { let reader = BufReader::new(match self.stream { Some(StreamKind::Plain(ref s)) => StreamKind::Plain((*s).try_clone().unwrap()), - #[cfg(feature = "ssl")] Some(StreamKind::Ssl(ref s)) => StreamKind::Ssl((*s).try_clone().unwrap()), None => return Result(Err(IrscError::NotConnected)) }); @@ -183,7 +176,6 @@ impl OwnedClient { let mut s: &mut OwnedClient = unsafe { mem::transmute(self) }; let reader = BufReader::new(match self.stream { Some(StreamKind::Plain(ref s)) => StreamKind::Plain((*s).try_clone().unwrap()), - #[cfg(feature = "ssl")] Some(StreamKind::Ssl(ref s)) => StreamKind::Ssl((*s).try_clone().unwrap()), None => return Result(Err(IrscError::NotConnected)) }); @@ -8,7 +8,6 @@ extern crate regex; #[macro_use] extern crate log; -#[cfg(feature = "ssl")] extern crate openssl; extern crate carboxyl; @@ -25,7 +24,6 @@ use std::io; use std::result; use std::ops::{ Deref, DerefMut }; -#[cfg(feature = "ssl")] use openssl::ssl::error::SslError; pub use ident::Ident; @@ -41,11 +39,9 @@ pub enum IrscError { AlreadyConnected, NotConnected, NotFound, - #[cfg(feature = "ssl")] Ssl(SslError) } -#[cfg(feature = "ssl")] impl From<SslError> for IrscError { fn from(e: SslError) -> IrscError { IrscError::Ssl(e) } } |