From 7fa79ea0692e958841032563d91ee98210ea18a0 Mon Sep 17 00:00:00 2001 From: Till Hoeppner Date: Mon, 29 Jun 2015 22:04:01 +0200 Subject: Use official carboxyl again --- src/client.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/client.rs') 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() -- cgit v1.2.3