aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Hoeppner2014-11-21 11:31:55 +0100
committerTill Hoeppner2014-11-21 11:31:55 +0100
commit6ed12a0993d56330bb008adc86bfb5ebe4320583 (patch)
treec572f69b19c82ee298004948f7a13a2dbebd0076
parentd738bcd85bc9d7ea47d8995a57a594ead6bb0f73 (diff)
downloadirsc-6ed12a0993d56330bb008adc86bfb5ebe4320583.tar.gz
irsc-6ed12a0993d56330bb008adc86bfb5ebe4320583.tar.xz
irsc-6ed12a0993d56330bb008adc86bfb5ebe4320583.zip
Upload to crates.io plus fixes for changes in Rust
-rw-r--r--Cargo.toml4
-rw-r--r--examples/01.rs (renamed from src/main.rs)2
-rw-r--r--src/server.rs14
3 files changed, 12 insertions, 8 deletions
diff --git a/Cargo.toml b/Cargo.toml
index b15999b..2e6bbb9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,3 +3,7 @@
name = "irsc"
version = "0.0.1"
authors = ["Till Hoeppner <hoeppner.till@gmail.com>"]
+description = "A lightweight library for building IRC bots."
+repository = "https://github.com/hoeppnertill/irsc"
+keywords = ["irc", "internet", "protocol", "useless tags"]
+license = "No decision yet."
diff --git a/src/main.rs b/examples/01.rs
index 865234a..9756119 100644
--- a/src/main.rs
+++ b/examples/01.rs
@@ -29,7 +29,7 @@ fn main() {
s.user(NAME, "*", "*", DESC).unwrap();
s.join("#botzoo").unwrap();
- s.msg("flan3002", "Hey!").unwrap();
+ s.msg("flan3002", "Hey, I'm your example bot!").unwrap();
s.events.lock().register(&callback);
diff --git a/src/server.rs b/src/server.rs
index b783a25..343cdee 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -48,10 +48,10 @@ impl Server {
pub fn connect(&mut self, host: String, port: u16) -> Result<(), Failure> {
let mut s = self.stream.lock();
- match *s { Some(_) => return Err(AlreadyConnected), _ => () };
+ match *s { Some(_) => return Err(Failure::AlreadyConnected), _ => () };
*s = match TcpStream::connect((host.as_slice(), port)) {
Ok(tcp) => Some(tcp),
- Err(e) => return Err(Io(e))
+ Err(e) => return Err(Failure::Io(e))
};
Ok(())
@@ -67,15 +67,15 @@ impl Server {
Ok(_) => match { if newline { stream.write_str("\r\n") } else { Ok(()) } } {
Ok(_) => match stream.flush() {
Ok(_) => Ok(()),
- Err(e) => return Err(Io(e))
+ Err(e) => return Err(Failure::Io(e))
},
- Err(e) => return Err(Io(e))
+ Err(e) => return Err(Failure::Io(e))
},
- Err(e) => return Err(Io(e))
+ Err(e) => return Err(Failure::Io(e))
}
}).unwrap()
} else {
- Err(NotConnected)
+ Err(Failure::NotConnected)
}
}
@@ -104,7 +104,7 @@ impl Server {
let lock = self.stream.lock();
match *lock {
Some(ref s) => s.clone(),
- None => return Err(NotConnected)
+ None => return Err(Failure::NotConnected)
}
};