Added send_part to ServerExt.
This commit is contained in:
parent
bd79f90d96
commit
d13a28ff98
1 changed files with 13 additions and 1 deletions
|
@ -3,7 +3,7 @@ use std::io::Result;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use client::data::{Capability, NegotiationVersion};
|
use client::data::{Capability, NegotiationVersion};
|
||||||
use client::data::Command::{AUTHENTICATE, CAP, INVITE, JOIN, KICK, KILL, MODE, NICK, NOTICE};
|
use client::data::Command::{AUTHENTICATE, CAP, INVITE, JOIN, KICK, KILL, MODE, NICK, NOTICE};
|
||||||
use client::data::Command::{OPER, PASS, PONG, PRIVMSG, QUIT, SAMODE, SANICK, TOPIC, USER};
|
use client::data::Command::{OPER, PART, PASS, PONG, PRIVMSG, QUIT, SAMODE, SANICK, TOPIC, USER};
|
||||||
use client::data::command::CapSubCommand::{END, LS, REQ};
|
use client::data::command::CapSubCommand::{END, LS, REQ};
|
||||||
#[cfg(feature = "ctcp")] use time::get_time;
|
#[cfg(feature = "ctcp")] use time::get_time;
|
||||||
use client::server::Server;
|
use client::server::Server;
|
||||||
|
@ -76,6 +76,11 @@ pub trait ServerExt: Server {
|
||||||
self.send(JOIN(chanlist.to_owned(), Some(keylist.to_owned()), None))
|
self.send(JOIN(chanlist.to_owned(), Some(keylist.to_owned()), None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Parts the specified channel or chanlist.
|
||||||
|
fn send_part(&self, chanlist: &str) -> Result<()> where Self: Sized {
|
||||||
|
self.send(PART(chanlist.to_owned(), None))
|
||||||
|
}
|
||||||
|
|
||||||
/// Attempts to oper up using the specified username and password.
|
/// Attempts to oper up using the specified username and password.
|
||||||
fn send_oper(&self, username: &str, password: &str) -> Result<()> where Self: Sized {
|
fn send_oper(&self, username: &str, password: &str) -> Result<()> where Self: Sized {
|
||||||
self.send(OPER(username.to_owned(), password.to_owned()))
|
self.send(OPER(username.to_owned(), password.to_owned()))
|
||||||
|
@ -268,6 +273,13 @@ mod test {
|
||||||
assert_eq!(&get_server_value(server)[..], "JOIN #test,#test2,#test3\r\n");
|
assert_eq!(&get_server_value(server)[..], "JOIN #test,#test2,#test3\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn send_part() {
|
||||||
|
let server = IrcServer::from_connection(test_config(), MockConnection::empty());
|
||||||
|
server.send_part("#test").unwrap();
|
||||||
|
assert_eq!(&get_server_value(server)[..], "PART #test\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn send_oper() {
|
fn send_oper() {
|
||||||
let server = IrcServer::from_connection(test_config(), MockConnection::empty());
|
let server = IrcServer::from_connection(test_config(), MockConnection::empty());
|
||||||
|
|
Loading…
Reference in a new issue