diff options
author | Till Höppner | 2014-12-26 15:07:47 +0100 |
---|---|---|
committer | Till Höppner | 2014-12-26 15:07:47 +0100 |
commit | d8c9a734419fdfb3ef54bba467f899e09533b3c6 (patch) | |
tree | ee18f2a6fa1def91fcaaae53ce708d60f2ad58ac | |
parent | 6ed12a0993d56330bb008adc86bfb5ebe4320583 (diff) | |
parent | 2ebcb68cd4c88891f42da1e5c1c29fefea947f23 (diff) | |
download | irsc-d8c9a734419fdfb3ef54bba467f899e09533b3c6.tar.gz irsc-d8c9a734419fdfb3ef54bba467f899e09533b3c6.tar.xz irsc-d8c9a734419fdfb3ef54bba467f899e09533b3c6.zip |
Merge pull request #1 from ravenscroftj/master
Fixed build for irsc
-rw-r--r-- | examples/01.rs | 2 | ||||
-rw-r--r-- | src/event.rs | 4 | ||||
-rw-r--r-- | src/ident.rs | 7 | ||||
-rw-r--r-- | src/server.rs | 10 |
4 files changed, 14 insertions, 9 deletions
diff --git a/examples/01.rs b/examples/01.rs index 9756119..0bf51f5 100644 --- a/examples/01.rs +++ b/examples/01.rs @@ -31,7 +31,7 @@ fn main() { s.msg("flan3002", "Hey, I'm your example bot!").unwrap(); - s.events.lock().register(&callback); + s.events.lock().register(&(callback as fn((Server,Event)))); // Dedicate this thread to listening and event processing s.listen().unwrap(); diff --git a/src/event.rs b/src/event.rs index aef34f9..b8e9743 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,5 +1,7 @@ use ident::Ident; +use std::borrow::ToOwned; + #[deriving(Clone)] pub struct Event { pub prefix: String, @@ -17,7 +19,7 @@ pub const PRIVMSG: &'static str = "PRIVMSG"; fn join(v: Vec<String>, from: uint) -> String { let mut msg = if v[from].chars().next().unwrap() == ':' { - v[from][][1..].into_string() + v[from][][1..].to_owned() } else { v[from].clone() }; for m in v.iter().skip(from + 1) { msg.push_str(" "); diff --git a/src/ident.rs b/src/ident.rs index 069e186..6a01d12 100644 --- a/src/ident.rs +++ b/src/ident.rs @@ -1,4 +1,5 @@ use regex::Regex; +use std::borrow::ToOwned; static PATTERN: Regex = regex!(":(.*)!(.*)@(.*)"); @@ -16,9 +17,9 @@ impl Ident { None => return None }; Some(Ident { - nickname: c.at(1).into_string(), - user: c.at(2).into_string(), - host: c.at(3).into_string() + nickname: c.at(1).unwrap().to_owned(), + user: c.at(2).unwrap().to_owned(), + host: c.at(3).unwrap().to_owned() }) } } diff --git a/src/server.rs b/src/server.rs index 343cdee..4c4479a 100644 --- a/src/server.rs +++ b/src/server.rs @@ -7,6 +7,8 @@ use std::io::{ use std::sync::Arc; use std::sync::Mutex; +use std::borrow::ToOwned; + use callback::Callback; use event; use event::Event; @@ -30,7 +32,7 @@ impl Server { stream: Arc::new(Mutex::new(None)), events: { let mut c = Callback::new(); - c.register(&Server::handle_event); + c.register(&(Server::handle_event as fn((Server,Event)))); Arc::new(Mutex::new(c)) } } @@ -126,9 +128,9 @@ impl Server { let cmd = parts.remove(0).unwrap(); let event = Event { - prefix: prefix.into_string(), - command: cmd.into_string(), - content: parts.iter().map(|p| p.into_string()).collect() + prefix: prefix.to_owned(), + command: cmd.to_owned(), + content: parts.into_iter().map(|s| s.to_owned()).collect() }; self.events.lock().fire(&(self.clone(), event)); |