aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Hoeppner2015-06-28 21:50:00 +0200
committerTill Hoeppner2015-06-28 21:50:04 +0200
commit9dbe41f60d411ed28ac360b4585b473100d306de (patch)
tree03a9574005a808af0d3ce8e438cf73a6a8c87298
parentb46d18d07a1dc1768516e8b6a845a20aede320ff (diff)
downloadirsc-9dbe41f60d411ed28ac360b4585b473100d306de.tar.gz
irsc-9dbe41f60d411ed28ac360b4585b473100d306de.tar.xz
irsc-9dbe41f60d411ed28ac360b4585b473100d306de.zip
Make openssl a required dependency
-rw-r--r--Cargo.toml6
-rw-r--r--src/client.rs8
-rw-r--r--src/lib.rs4
3 files changed, 1 insertions, 17 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d7f2c09..b23c4b9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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))
});
diff --git a/src/lib.rs b/src/lib.rs
index 32f153d..d624445 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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) }
}