aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTill Hoeppner2015-06-29 22:04:01 +0200
committerTill Hoeppner2015-06-29 22:04:01 +0200
commit7fa79ea0692e958841032563d91ee98210ea18a0 (patch)
tree0707d67d4238e681f7a378297f48bc7135bdb8a6 /src
parentf0ee5be572168542774739cf713b7eeca2cbc598 (diff)
downloadirsc-7fa79ea0692e958841032563d91ee98210ea18a0.tar.gz
irsc-7fa79ea0692e958841032563d91ee98210ea18a0.tar.xz
irsc-7fa79ea0692e958841032563d91ee98210ea18a0.zip
Use official carboxyl again
Diffstat (limited to 'src')
-rw-r--r--src/client.rs22
-rw-r--r--src/event.rs4
2 files changed, 25 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs
index e09532f..a154fba 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -63,6 +63,28 @@ pub trait Client {
self.send_message(PRIVMSG(to.into(), message.into()).to_message())
}
+ fn msg_many(&mut self, to: &str, message: &[&str]) -> Result<()> {
+ for m in message {
+ self.msg(to, m);
+ }
+ Result(Ok(()))
+ }
+
+ fn msg_word_wrap(&mut self, to: &str, message: &str, limit: u16) -> Result<()> {
+ let mut line = String::new();
+ for word in message.split_whitespace() {
+ if line.len() + word.len() < limit as usize {
+ line.push_str(" ");
+ line.push_str(word);
+ } else {
+ debug!("Sending {}", line);
+ self.msg(to, &line);
+ line.clear();
+ }
+ }
+ self.msg(to, &line)
+ }
+
fn register(&mut self, nick: &str, user: &str, desc: &str, pass: Option<&str>) -> Result<()> {
Result(if let Some(pass) = pass {
self.send_message(PASS(pass.into()).to_message()).inner()
diff --git a/src/event.rs b/src/event.rs
index 3863b49..f9a0422 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -16,7 +16,9 @@ impl<'a> Event<'a> {
use Event::*;
match self {
&Command(ref c) => Command(c.to_static()),
- _ => unimplemented!()
+ &Reply(ref r) => Reply(r.to_static()),
+ &Connected => Connected,
+ &Disconnected => Disconnected
}
}
}