Added SAMODE with associated unit test.
This commit is contained in:
parent
56ca5379e1
commit
445cfb1405
2 changed files with 16 additions and 3 deletions
16
src/bot.rs
16
src/bot.rs
|
@ -42,8 +42,12 @@ impl<'a, T, U> Bot for IrcBot<'a, T, U> where T: IrcWriter, U: IrcReader {
|
|||
self.conn.send(Message::new(None, "JOIN", [chan]))
|
||||
}
|
||||
|
||||
fn send_mode(&self, chan: &str, mode: &str) -> IoResult<()> {
|
||||
self.conn.send(Message::new(None, "MODE", [chan, mode]))
|
||||
fn send_samode(&self, target: &str, mode: &str) -> IoResult<()> {
|
||||
self.conn.send(Message::new(None, "SAMODE", [target, mode]))
|
||||
}
|
||||
|
||||
fn send_mode(&self, target: &str, mode: &str) -> IoResult<()> {
|
||||
self.conn.send(Message::new(None, "MODE", [target, mode]))
|
||||
}
|
||||
|
||||
fn send_oper(&self, name: &str, password: &str) -> IoResult<()> {
|
||||
|
@ -215,6 +219,14 @@ mod test {
|
|||
assert_eq!(data(b.conn), format!("JOIN :#test\r\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn send_samode() {
|
||||
let c = Connection::new(MemWriter::new(), NullReader).unwrap();
|
||||
let b = IrcBot::from_connection(c, |_, _, _, _| { Ok(()) }).unwrap();
|
||||
b.send_samode("#test", "+i").unwrap();
|
||||
assert_eq!(data(b.conn), format!("SAMODE #test :+i\r\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn send_mode() {
|
||||
let c = Connection::new(MemWriter::new(), NullReader).unwrap();
|
||||
|
|
|
@ -17,7 +17,8 @@ pub trait Bot {
|
|||
fn send_nick(&self, nick: &str) -> IoResult<()>;
|
||||
fn send_user(&self, username: &str, real_name: &str) -> IoResult<()>;
|
||||
fn send_join(&self, chan: &str) -> IoResult<()>;
|
||||
fn send_mode(&self, chan: &str, mode: &str) -> IoResult<()>;
|
||||
fn send_samode(&self, target: &str, mode: &str) -> IoResult<()>;
|
||||
fn send_mode(&self, target: &str, mode: &str) -> IoResult<()>;
|
||||
fn send_oper(&self, name: &str, password: &str) -> IoResult<()>;
|
||||
fn send_topic(&self, chan: &str, topic: &str) -> IoResult<()>;
|
||||
fn send_invite(&self, person: &str, chan: &str) -> IoResult<()>;
|
||||
|
|
Loading…
Add table
Reference in a new issue