Updated stability markers more.
This commit is contained in:
parent
8083817ac5
commit
2a8170b3ba
7 changed files with 215 additions and 3 deletions
|
@ -19,6 +19,7 @@ pub struct Connection<T: IrcReader, U: IrcWriter> {
|
|||
}
|
||||
|
||||
/// A Connection over a buffered NetStream.
|
||||
#[stable]
|
||||
pub type NetConnection = Connection<BufferedReader<NetStream>, BufferedWriter<NetStream>>;
|
||||
/// An internal type
|
||||
type NetReaderWriterPair = (BufferedReader<NetStream>, BufferedWriter<NetStream>);
|
||||
|
@ -209,10 +210,12 @@ fn ssl_to_io<T>(res: Result<T, SslError>) -> IoResult<T> {
|
|||
#[stable]
|
||||
pub enum NetStream {
|
||||
/// An unsecured TcpStream.
|
||||
#[stable]
|
||||
UnsecuredTcpStream(TcpStream),
|
||||
/// An SSL-secured TcpStream.
|
||||
/// This is only available when compiled with SSL support.
|
||||
#[cfg(feature = "ssl")]
|
||||
#[stable]
|
||||
SslTcpStream(SslStream<TcpStream>),
|
||||
}
|
||||
|
||||
|
|
|
@ -13,136 +13,192 @@ use client::data::message::{Message, ToMessage};
|
|||
pub enum Command<'a> {
|
||||
// 3.1 Connection Registration
|
||||
/// PASS :password
|
||||
#[stable]
|
||||
PASS(&'a str),
|
||||
/// NICK :nickname
|
||||
#[stable]
|
||||
NICK(&'a str),
|
||||
/// USER user mode * :realname
|
||||
#[stable]
|
||||
USER(&'a str, &'a str, &'a str),
|
||||
/// OPER name :password
|
||||
#[stable]
|
||||
OPER(&'a str, &'a str),
|
||||
/// MODE nickname modes
|
||||
/// MODE channel modes [modeparams]
|
||||
#[stable]
|
||||
MODE(&'a str, &'a str, Option<&'a str>),
|
||||
/// SERVICE nickname reserved distribution type reserved :info
|
||||
#[stable]
|
||||
SERVICE(&'a str, &'a str, &'a str, &'a str, &'a str, &'a str),
|
||||
/// QUIT :comment
|
||||
#[stable]
|
||||
QUIT(Option<&'a str>),
|
||||
/// SQUIT server :comment
|
||||
#[stable]
|
||||
SQUIT(&'a str, &'a str),
|
||||
|
||||
// 3.2 Channel operations
|
||||
/// JOIN chanlist [chankeys]
|
||||
#[stable]
|
||||
JOIN(&'a str, Option<&'a str>),
|
||||
/// PART chanlist :[comment]
|
||||
#[stable]
|
||||
PART(&'a str, Option<&'a str>),
|
||||
// MODE is already defined.
|
||||
// MODE(&'a str, &'a str, Option<&'a str>),
|
||||
/// TOPIC channel :[topic]
|
||||
#[stable]
|
||||
TOPIC(&'a str, Option<&'a str>),
|
||||
/// NAMES [chanlist :[target]]
|
||||
#[stable]
|
||||
NAMES(Option<&'a str>, Option<&'a str>),
|
||||
/// LIST [chanlist :[target]]
|
||||
#[stable]
|
||||
LIST(Option<&'a str>, Option<&'a str>),
|
||||
/// INVITE nickname channel
|
||||
#[stable]
|
||||
INVITE(&'a str, &'a str),
|
||||
/// KICK chanlist userlist :[comment]
|
||||
#[stable]
|
||||
KICK(&'a str, &'a str, Option<&'a str>),
|
||||
|
||||
// 3.3 Sending messages
|
||||
/// PRIVMSG msgtarget :message
|
||||
#[stable]
|
||||
PRIVMSG(&'a str, &'a str),
|
||||
/// NOTICE msgtarget :message
|
||||
#[stable]
|
||||
NOTICE(&'a str, &'a str),
|
||||
|
||||
// 3.4 Server queries and commands
|
||||
/// MOTD :[target]
|
||||
#[stable]
|
||||
MOTD(Option<&'a str>),
|
||||
/// LUSERS [mask :[target]]
|
||||
#[stable]
|
||||
LUSERS(Option<&'a str>, Option<&'a str>),
|
||||
/// VERSION :[target]
|
||||
#[stable]
|
||||
VERSION(Option<&'a str>),
|
||||
/// STATS [query :[target]]
|
||||
#[stable]
|
||||
STATS(Option<&'a str>, Option<&'a str>),
|
||||
/// LINKS [[remote server] server :mask]
|
||||
#[stable]
|
||||
LINKS(Option<&'a str>, Option<&'a str>),
|
||||
/// TIME :[target]
|
||||
#[stable]
|
||||
TIME(Option<&'a str>),
|
||||
/// CONNECT target server port :[remote server]
|
||||
#[stable]
|
||||
CONNECT(&'a str, &'a str, Option<&'a str>),
|
||||
/// TRACE :[target]
|
||||
#[stable]
|
||||
TRACE(Option<&'a str>),
|
||||
/// ADMIN :[target]
|
||||
#[stable]
|
||||
ADMIN(Option<&'a str>),
|
||||
/// INFO :[target]
|
||||
#[stable]
|
||||
INFO(Option<&'a str>),
|
||||
|
||||
// 3.5 Service Query and Commands
|
||||
/// SERVLIST [mask :[type]]
|
||||
#[stable]
|
||||
SERVLIST(Option<&'a str>, Option<&'a str>),
|
||||
/// SQUERY servicename text
|
||||
#[stable]
|
||||
SQUERY(&'a str, &'a str),
|
||||
|
||||
// 3.6 User based queries
|
||||
/// WHO [mask ["o"]]
|
||||
#[stable]
|
||||
WHO(Option<&'a str>, Option<bool>),
|
||||
/// WHOIS [target] masklist
|
||||
#[stable]
|
||||
WHOIS(Option<&'a str>, &'a str),
|
||||
/// WHOWAS nicklist [count :[target]]
|
||||
#[stable]
|
||||
WHOWAS(&'a str, Option<&'a str>, Option<&'a str>),
|
||||
|
||||
// 3.7 Miscellaneous messages
|
||||
/// KILL nickname :comment
|
||||
#[stable]
|
||||
KILL(&'a str, &'a str),
|
||||
/// PING server1 :[server2]
|
||||
#[stable]
|
||||
PING(&'a str, Option<&'a str>),
|
||||
/// PONG server :[server2]
|
||||
#[stable]
|
||||
PONG(&'a str, Option<&'a str>),
|
||||
/// ERROR :message
|
||||
#[stable]
|
||||
ERROR(&'a str),
|
||||
|
||||
|
||||
// 4 Optional Features
|
||||
/// AWAY :[message]
|
||||
#[stable]
|
||||
AWAY(Option<&'a str>),
|
||||
/// REHASH
|
||||
#[stable]
|
||||
REHASH,
|
||||
/// DIE
|
||||
#[stable]
|
||||
DIE,
|
||||
/// RESTART
|
||||
#[stable]
|
||||
RESTART,
|
||||
/// SUMMON user [target :[channel]]
|
||||
#[stable]
|
||||
SUMMON(&'a str, Option<&'a str>, Option<&'a str>),
|
||||
/// USERS :[target]
|
||||
#[stable]
|
||||
USERS(Option<&'a str>),
|
||||
/// WALLOPS :Text to be sent
|
||||
#[stable]
|
||||
WALLOPS(&'a str),
|
||||
/// USERHOST space-separated nicklist
|
||||
#[stable]
|
||||
USERHOST(Vec<&'a str>),
|
||||
/// ISON space-separated nicklist
|
||||
#[stable]
|
||||
ISON(Vec<&'a str>),
|
||||
|
||||
// Non-RFC commands from InspIRCd
|
||||
/// SAJOIN nickname channel
|
||||
#[stable]
|
||||
SAJOIN(&'a str, &'a str),
|
||||
/// SAMODE target modes [modeparams]
|
||||
#[stable]
|
||||
SAMODE(&'a str, &'a str, Option<&'a str>),
|
||||
/// SANICK old nickname new nickname
|
||||
#[stable]
|
||||
SANICK(&'a str, &'a str),
|
||||
/// SAPART nickname :comment
|
||||
#[stable]
|
||||
SAPART(&'a str, &'a str),
|
||||
/// SAQUIT nickname :comment
|
||||
#[stable]
|
||||
SAQUIT(&'a str, &'a str),
|
||||
/// NICKSERV message
|
||||
#[stable]
|
||||
NICKSERV(&'a str),
|
||||
/// CHANSERV message
|
||||
#[stable]
|
||||
CHANSERV(&'a str),
|
||||
/// OPERSERV message
|
||||
#[stable]
|
||||
OPERSERV(&'a str),
|
||||
/// BOTSERV message
|
||||
#[stable]
|
||||
BOTSERV(&'a str),
|
||||
/// HOSTSERV message
|
||||
#[stable]
|
||||
HOSTSERV(&'a str),
|
||||
/// MEMOSERV message
|
||||
#[stable]
|
||||
MEMOSERV(&'a str),
|
||||
|
||||
// Capabilities extension to IRCv3
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Messages to and from the server.
|
||||
#![experimental]
|
||||
#![unstable = "New features were added recently."]
|
||||
use std::borrow::ToOwned;
|
||||
use std::str::FromStr;
|
||||
|
||||
|
|
|
@ -13,283 +13,420 @@ use client::data::message::Message;
|
|||
pub enum Response {
|
||||
// Expected replies
|
||||
/// 001 Welcome to the Internet Relay Network <nick>!<user>@<host>
|
||||
#[stable]
|
||||
RPL_WELCOME = 001,
|
||||
/// 002 Your host is <servername>, running version <ver>
|
||||
#[stable]
|
||||
RPL_YOURHOST = 002,
|
||||
/// 003 This server was created <date>
|
||||
#[stable]
|
||||
RPL_CREATED = 003,
|
||||
/// 004 <servername> <version> <available user modes> available channel modes>
|
||||
#[stable]
|
||||
RPL_MYINFO = 004,
|
||||
/// 005 Try server <server name>, port <port number>
|
||||
#[stable]
|
||||
RPL_BOUNCE = 005,
|
||||
/// 302 :*1<reply> *( " " <reply> )
|
||||
#[stable]
|
||||
RPL_USERHOST = 302,
|
||||
/// 303 :*1<nick> *( " " <nick> )
|
||||
#[stable]
|
||||
RPL_ISON = 303,
|
||||
/// 301 <nick> :<away message>
|
||||
#[stable]
|
||||
RPL_AWAY = 301,
|
||||
/// 305 :You are no longer marked as being away
|
||||
#[stable]
|
||||
RPL_UNAWAY = 305,
|
||||
/// 306 :You have been marked as being away
|
||||
#[stable]
|
||||
RPL_NOWAWAY = 306,
|
||||
/// 311 <nick> <user> <host> * :<real name>
|
||||
#[stable]
|
||||
RPL_WHOISUSER = 311,
|
||||
/// 312 <nick> <server> :<server info>
|
||||
#[stable]
|
||||
RPL_WHOISSERVER = 312,
|
||||
/// 313 <nick> :is an IRC operator
|
||||
#[stable]
|
||||
RPL_WHOISOPERATOR = 313,
|
||||
/// 317 <nick> <integer> :seconds idle
|
||||
#[stable]
|
||||
RPL_WHOISIDLE = 317,
|
||||
/// 318 <nick> :End of WHOIS list
|
||||
#[stable]
|
||||
RPL_ENDOFWHOIS = 318,
|
||||
/// 319 <nick> :*( ( "@" / "+" ) <channel> " " )
|
||||
#[stable]
|
||||
RPL_WHOISCHANNELS = 319,
|
||||
/// 314 <nick> <user> <host> * :<real name>
|
||||
#[stable]
|
||||
RPL_WHOWASUSER = 314,
|
||||
/// 369 <nick> :End of WHOWAS
|
||||
#[stable]
|
||||
RPL_ENDOFWHOWAS = 369,
|
||||
/// Obsolete. Not used.
|
||||
#[stable]
|
||||
RPL_LISTSTART = 321,
|
||||
/// 322 <channel> <# visible> :<topic>
|
||||
#[stable]
|
||||
RPL_LIST = 322,
|
||||
/// 323 :End of LIST
|
||||
#[stable]
|
||||
RPL_LISTEND = 323,
|
||||
/// 325 <channel> <nickname>
|
||||
#[stable]
|
||||
RPL_UNIQOPIS = 325,
|
||||
/// 324 <channel> <mode> <mode params>
|
||||
#[stable]
|
||||
RPL_CHANNELMODEIS = 324,
|
||||
/// 331 <channel> :No topic is set
|
||||
#[stable]
|
||||
RPL_NOTOPIC = 331,
|
||||
/// 332 <channel> :<topic>
|
||||
#[stable]
|
||||
RPL_TOPIC = 332,
|
||||
/// 341 <channel> <nick>
|
||||
#[stable]
|
||||
RPL_INVITING = 341,
|
||||
/// 342 <user> :Summoning user to IRC
|
||||
#[stable]
|
||||
RPL_SUMMONING = 342,
|
||||
/// 346 <channel> <invitemask>
|
||||
#[stable]
|
||||
RPL_INVITELIST = 346,
|
||||
/// 347 <channel> :End of channel invite list
|
||||
#[stable]
|
||||
RPL_ENDOFINVITELIST = 347,
|
||||
/// 348 <channel> <exceptionmask>
|
||||
#[stable]
|
||||
RPL_EXCEPTLIST = 348,
|
||||
/// 349 <channel> :End of channel exception list
|
||||
#[stable]
|
||||
RPL_ENDOFEXECPTLIST = 349,
|
||||
/// 351 <version>.<debuglevel> <server> :<comments>
|
||||
#[stable]
|
||||
RPL_VERSION = 351,
|
||||
/// 352 <channel> <user> <host> <server> <nick> ( "H" / "G" > ["*"] [ ( "@" / "+" ) ]
|
||||
#[stable]
|
||||
/// :<hopcount> <real name>
|
||||
#[stable]
|
||||
RPL_WHOREPLY = 352,
|
||||
/// 315 <name> :End of WHO list
|
||||
#[stable]
|
||||
RPL_ENDOFWHO = 315,
|
||||
/// 353 ( "=" / "*" / "@" ) <channel> :[ "@" / "+" ] <nick> *( " " [ "@" / "+" ] <nick> )
|
||||
#[stable]
|
||||
RPL_NAMREPLY = 353,
|
||||
/// 366 <channel> :End of NAMES list
|
||||
#[stable]
|
||||
RPL_ENDOFNAMES = 366,
|
||||
/// 364 <mask> <server> :<hopcount> <server info>
|
||||
#[stable]
|
||||
RPL_LINKS = 364,
|
||||
/// 365 <mask> :End of LINKS list
|
||||
#[stable]
|
||||
RPL_ENDOFLINKS = 365,
|
||||
/// 367 <channel> <banmask>
|
||||
#[stable]
|
||||
RPL_BANLIST = 367,
|
||||
/// 368 <channel> :End of channel ban list
|
||||
#[stable]
|
||||
RPL_ENDOFBANLIST = 368,
|
||||
/// 371 :<string>
|
||||
#[stable]
|
||||
RPL_INFO = 371,
|
||||
/// 374 :End of INFO list
|
||||
#[stable]
|
||||
RPL_ENDOFINFO = 374,
|
||||
/// 375 :- <server> Message of the day -
|
||||
#[stable]
|
||||
RPL_MOTDSTART = 375,
|
||||
/// 372 :- <text>
|
||||
#[stable]
|
||||
RPL_MOTD = 372,
|
||||
/// 376 :End of MOTD command
|
||||
#[stable]
|
||||
RPL_ENDOFMOTD = 376,
|
||||
/// 381 :You are now an IRC operator
|
||||
#[stable]
|
||||
RPL_YOUREOPER = 381,
|
||||
/// 382 <config file> :Rehashing
|
||||
#[stable]
|
||||
RPL_REHASHING = 382,
|
||||
/// 383 You are service <servicename>
|
||||
#[stable]
|
||||
RPL_YOURESERVICE = 383,
|
||||
/// 391 <server> :<string showing server's local time>
|
||||
#[stable]
|
||||
RPL_TIME = 391,
|
||||
/// 392 :UserID Terminal Host
|
||||
#[stable]
|
||||
RPL_USERSSTART = 392,
|
||||
/// 393 :<username> <ttyline> <hostname>
|
||||
#[stable]
|
||||
RPL_USERS = 393,
|
||||
/// 394 :End of users
|
||||
#[stable]
|
||||
RPL_ENDOFUSERS = 394,
|
||||
/// 395 :Nobody logged in
|
||||
#[stable]
|
||||
RPL_NOUSERS = 395,
|
||||
/// 200 Link <version & debug level> <destination> <next server> V<protocol version>
|
||||
/// <link uptime in seconds> <backstream sendq> <upstream sendq>
|
||||
#[stable]
|
||||
RPL_TRACELINK = 200,
|
||||
/// 201 Try. <class> <server>
|
||||
#[stable]
|
||||
RPL_TRACECONNECTING = 201,
|
||||
/// 202 H.S. <class> <server>
|
||||
#[stable]
|
||||
RPL_TRACEHANDSHAKE = 202,
|
||||
/// 203 ???? <class> [<client IP address in dot form>]
|
||||
#[stable]
|
||||
RPL_TRACEUKNOWN = 203,
|
||||
/// 204 Oper <class> <nick>
|
||||
#[stable]
|
||||
RPL_TRACEOPERATOR = 204,
|
||||
/// 205 User <class> <nick>
|
||||
#[stable]
|
||||
RPL_TRACEUSER = 205,
|
||||
/// 206 Serv <class> <int>S <int>C <server> <nick!user|*!*>@<host|server> V<protocol version>
|
||||
#[stable]
|
||||
RPL_TRACESERVER = 206,
|
||||
/// 207 Service <class> <name> <type> <active type>
|
||||
#[stable]
|
||||
RPL_TRACESERVICE = 207,
|
||||
/// 208 <newtype> 0 <client name>
|
||||
#[stable]
|
||||
RPL_TRACENEWTYPE = 208,
|
||||
/// 209 Class <class> <count>
|
||||
#[stable]
|
||||
RPL_TRACECLASS = 209,
|
||||
/// Unused.
|
||||
RPL_TRACERECONNECT = 210,
|
||||
/// 261 File <logfile> <debug level>
|
||||
#[stable]
|
||||
RPL_TRACELOG = 261,
|
||||
/// 262 <server name> <version & debug level> :End of TRACE
|
||||
#[stable]
|
||||
RPL_TRACEEND = 262,
|
||||
/// 211 <linkname> <sendq> <sent messages> <sent Kbytes> <received messages> <received Kbytes>
|
||||
/// <time open>
|
||||
#[stable]
|
||||
RPL_STATSLINKINFO = 211,
|
||||
/// 212 <command> <count> <byte count> <remote count>
|
||||
#[stable]
|
||||
RPL_STATSCOMMANDS = 212,
|
||||
/// 219 <stats letter> :End of STATS report
|
||||
#[stable]
|
||||
RPL_ENDOFSTATS = 219,
|
||||
/// 242 :Server Up %d days %d:%02d:%02d
|
||||
#[stable]
|
||||
RPL_STATSUPTIME = 242,
|
||||
/// O <hostmask> * <name>
|
||||
#[stable]
|
||||
RPL_STATSOLINE = 243,
|
||||
/// 221 <user mode string>
|
||||
#[stable]
|
||||
RPL_UMODEIS = 221,
|
||||
/// 234 <name> <server> <mask> <type> <hopcount> <info>
|
||||
#[stable]
|
||||
RPL_SERVLIST = 234,
|
||||
/// 235 <mask> <type> :End of service listing
|
||||
#[stable]
|
||||
RPL_SERVLISTEND = 235,
|
||||
/// 251 :There are <integer> users and <integer> services on <integer> servers
|
||||
#[stable]
|
||||
RPL_LUSERCLIENT = 251,
|
||||
/// 252 <integer> :operator(s) online
|
||||
#[stable]
|
||||
RPL_LUSEROP = 252,
|
||||
/// 253 <integer> :unknown connection(s)
|
||||
#[stable]
|
||||
RPL_LUSERUNKNOWN = 253,
|
||||
/// 254 <integer> :channels formed
|
||||
#[stable]
|
||||
RPL_LUSERCHANNELS = 254,
|
||||
/// 255 :I have <integer> clients and <integer> servers
|
||||
#[stable]
|
||||
RPL_LUSERME = 255,
|
||||
/// 256 <server> :Administrative info
|
||||
#[stable]
|
||||
RPL_ADMINME = 256,
|
||||
/// 257 :<admin info>
|
||||
#[stable]
|
||||
RPL_ADMINLOC1 = 257,
|
||||
/// 258 :<admin info>
|
||||
#[stable]
|
||||
RPL_ADMINLOC2 = 258,
|
||||
/// 259 :<admin info>
|
||||
#[stable]
|
||||
RPL_ADMINEMAIL = 259,
|
||||
/// 263 <command> :Please wait a while and try again.
|
||||
#[stable]
|
||||
RPL_TRYAGAIN = 263,
|
||||
|
||||
// Error replies
|
||||
/// 401 <nickname> :No such nick/channel
|
||||
#[stable]
|
||||
ERR_NOSUCHNICK = 401,
|
||||
/// 402 <server name> :No such server
|
||||
#[stable]
|
||||
ERR_NOSUCHSERVER = 402,
|
||||
/// 403 <channel name> :No such channel
|
||||
#[stable]
|
||||
ERR_NOSUCHCHANNEL = 403,
|
||||
/// 404 <channel name> :Cannot send to channel
|
||||
#[stable]
|
||||
ERR_CANNOTSENDTOCHAN = 404,
|
||||
/// 405 <channel name> :You have joined too many channels
|
||||
#[stable]
|
||||
ERR_TOOMANYCHANNELS = 405,
|
||||
/// 406 <nickname> :There was no such nickname
|
||||
#[stable]
|
||||
ERR_WASNOSUCHNICK = 406,
|
||||
/// 407 <target> :<error code> recipients. <abort message>
|
||||
#[stable]
|
||||
ERR_TOOMANYTARGETS = 407,
|
||||
/// 408 <service name> :No such service
|
||||
#[stable]
|
||||
ERR_NOSUCHSERVICE = 408,
|
||||
/// 409 :No origin specified
|
||||
#[stable]
|
||||
ERR_NOORIGIN = 409,
|
||||
/// 411 :No recipient given (<command>)
|
||||
#[stable]
|
||||
ERR_NORECIPIENT = 411,
|
||||
/// 412 :No text to send
|
||||
#[stable]
|
||||
ERR_NOTEXTTOSEND = 412,
|
||||
/// 413 <mask> :No toplevel domain specified
|
||||
#[stable]
|
||||
ERR_NOTOPLEVEL = 413,
|
||||
/// 414 <mask> :Wildcard in toplevel domain
|
||||
#[stable]
|
||||
ERR_WILDTOPLEVEL = 414,
|
||||
/// 415 <mask> :Bad Server/host mask
|
||||
#[stable]
|
||||
ERR_BADMASK = 415,
|
||||
/// 421 <command> :Unknown command
|
||||
#[stable]
|
||||
ERR_UNKNOWNCOMMAND = 421,
|
||||
/// 422 :MOTD File is missing
|
||||
#[stable]
|
||||
ERR_NOMOTD = 422,
|
||||
/// 423 <server> :No administrative info available
|
||||
#[stable]
|
||||
ERR_NOADMININFO = 423,
|
||||
/// 424 :File error doing <file op> on <file>
|
||||
#[stable]
|
||||
ERR_FILEERROR = 424,
|
||||
/// 431 :No nickname given
|
||||
#[stable]
|
||||
ERR_NONICKNAMEGIVEN = 431,
|
||||
/// 432 <nick> :Erroneous nickname"
|
||||
#[stable]
|
||||
ERR_ERRONEOUSNICKNAME = 432,
|
||||
/// 433 <nick> :Nickname is already in use
|
||||
#[stable]
|
||||
ERR_NICKNAMEINUSE = 433,
|
||||
/// 436 <nick> :Nickname collision KILL from <user>@<host>
|
||||
#[stable]
|
||||
ERR_NICKCOLLISION = 436,
|
||||
/// 437 <nick/channel> :Nick/channel is temporarily unavailable
|
||||
#[stable]
|
||||
ERR_UNAVAILRESOURCE = 437,
|
||||
/// 441 <nick> <channel> :They aren't on that channel
|
||||
#[stable]
|
||||
ERR_USERNOTINCHANNEL = 441,
|
||||
/// 442 <channel> :You're not on that channel
|
||||
#[stable]
|
||||
ERR_NOTONCHANNEL = 442,
|
||||
/// 443 <user> <channel> :is already on channel
|
||||
#[stable]
|
||||
ERR_USERONCHANNEL = 443,
|
||||
/// 444 <user> :User not logged in
|
||||
#[stable]
|
||||
ERR_NOLOGIN = 444,
|
||||
/// 445 :SUMMON has been disabled
|
||||
#[stable]
|
||||
ERR_SUMMONDISABLED = 445,
|
||||
/// 446 :USERS has been disabled
|
||||
#[stable]
|
||||
ERR_USERSDISABLED = 446,
|
||||
/// 451 :You have not registered
|
||||
#[stable]
|
||||
ERR_NOTREGISTERED = 451,
|
||||
/// 461 <command> :Not enough parameters
|
||||
#[stable]
|
||||
ERR_NEEDMOREPARAMS = 461,
|
||||
/// 462 :Unauthorized command (already registered)
|
||||
#[stable]
|
||||
ERR_ALREADYREGISTRED = 462,
|
||||
/// 463 :Your host isn't among the privileged
|
||||
#[stable]
|
||||
ERR_NOPERMFORHOST = 463,
|
||||
/// 464 :Password incorrect
|
||||
#[stable]
|
||||
ERR_PASSWDMISMATCH = 464,
|
||||
/// 465 :You are banned from this server
|
||||
#[stable]
|
||||
ERR_YOUREBANNEDCREEP = 465,
|
||||
/// 466
|
||||
#[stable]
|
||||
ERR_YOUWILLBEBANNED = 466,
|
||||
/// 467 <channel> :Channel key already set
|
||||
#[stable]
|
||||
ERR_KEYSET = 467,
|
||||
/// 471 <channel> :Cannot join channel (+l)
|
||||
#[stable]
|
||||
ERR_CHANNELISFULL = 471,
|
||||
/// 472 <char> :is unknown mode char to me for <channel>
|
||||
#[stable]
|
||||
ERR_UNKNOWNMODE = 472,
|
||||
/// 473 <channel> :Cannot join channel (+i)
|
||||
#[stable]
|
||||
ERR_INVITEONLYCHAN = 473,
|
||||
/// 474 <channel> :Cannot join channel (+b)
|
||||
#[stable]
|
||||
ERR_BANNEDFROMCHAN = 474,
|
||||
/// 475 <channel> :Cannot join channel (+k)
|
||||
#[stable]
|
||||
ERR_BADCHANNELKEY = 475,
|
||||
/// 476 <channel> :Bad Channel Mask
|
||||
#[stable]
|
||||
ERR_BADCHANMASK = 476,
|
||||
/// 477 <channel> :Channel doesn't support modes
|
||||
#[stable]
|
||||
ERR_NOCHANMODES = 477,
|
||||
/// 478 <channel> <char> :Channel list is full
|
||||
#[stable]
|
||||
ERR_BANLISTFULL = 478,
|
||||
/// 481 :Permission Denied- You're not an IRC operator
|
||||
#[stable]
|
||||
ERR_NOPRIVILEGES = 481,
|
||||
/// 482 <channel> :You're not channel operator
|
||||
#[stable]
|
||||
ERR_CHANOPRIVSNEEDED = 482,
|
||||
/// 483 :You can't kill a server!
|
||||
#[stable]
|
||||
ERR_CANTKILLSERVER = 483,
|
||||
/// 484 :Your connection is restricted!
|
||||
#[stable]
|
||||
ERR_RESTRICTED = 484,
|
||||
/// 485 :You're not the original channel operator
|
||||
#[stable]
|
||||
ERR_UNIQOPPRIVSNEEDED = 485,
|
||||
/// 491 :No O-lines for your host
|
||||
#[stable]
|
||||
ERR_NOOPERHOST = 491,
|
||||
/// 501 :Unknown MODE flag
|
||||
#[stable]
|
||||
ERR_UMODEUNKNOWNFLAG = 501,
|
||||
/// 502 :Cannot change mode for other users
|
||||
#[stable]
|
||||
ERR_USERSDONTMATCH = 502,
|
||||
}
|
||||
|
||||
|
|
|
@ -115,16 +115,22 @@ impl PartialEq for User {
|
|||
#[derive(Copy, PartialEq, Clone, Show)]
|
||||
pub enum AccessLevel {
|
||||
/// The channel owner (~).
|
||||
#[stable]
|
||||
Owner,
|
||||
/// A channel administrator (&).
|
||||
#[stable]
|
||||
Admin,
|
||||
/// A channel operator (@),
|
||||
#[stable]
|
||||
Oper,
|
||||
/// A channel half-oper (%),
|
||||
#[stable]
|
||||
HalfOp,
|
||||
/// A user with voice (+),
|
||||
#[stable]
|
||||
Voice,
|
||||
/// A normal user,
|
||||
#[stable]
|
||||
Member,
|
||||
}
|
||||
|
||||
|
|
|
@ -16,12 +16,16 @@ pub mod utils;
|
|||
#[stable]
|
||||
pub trait Server<'a, T, U> {
|
||||
/// Gets the configuration being used with this Server.
|
||||
#[stable]
|
||||
fn config(&self) -> &Config;
|
||||
/// Sends a Command to this Server.
|
||||
#[stable]
|
||||
fn send(&self, _: Command) -> IoResult<()>;
|
||||
/// Gets an Iterator over Messages received by this Server.
|
||||
#[stable]
|
||||
fn iter(&'a self) -> ServerIterator<'a, T, U>;
|
||||
/// Gets a list of Users in the specified channel.
|
||||
#[stable]
|
||||
fn list_users(&self, _: &str) -> Option<Vec<User>>;
|
||||
}
|
||||
|
||||
|
@ -39,8 +43,10 @@ pub struct IrcServer<T: IrcReader, U: IrcWriter> {
|
|||
}
|
||||
|
||||
/// An IrcServer over a buffered NetStream.
|
||||
#[stable]
|
||||
pub type NetIrcServer = IrcServer<BufferedReader<NetStream>, BufferedWriter<NetStream>>;
|
||||
|
||||
#[stable]
|
||||
impl IrcServer<BufferedReader<NetStream>, BufferedWriter<NetStream>> {
|
||||
/// Creates a new IRC Server connection from the configuration at the specified path,
|
||||
/// connecting immediately.
|
||||
|
@ -93,6 +99,7 @@ impl<'a, T: IrcReader, U: IrcWriter> Server<'a, T, U> for IrcServer<T, U> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
impl<T: IrcReader, U: IrcWriter> IrcServer<T, U> {
|
||||
/// Creates an IRC server from the specified configuration, and any arbitrary Connection.
|
||||
#[stable]
|
||||
|
@ -239,9 +246,10 @@ pub struct ServerIterator<'a, T: IrcReader, U: IrcWriter> {
|
|||
server: &'a IrcServer<T, U>
|
||||
}
|
||||
|
||||
#[experimental = "Design is liable to change to accomodate new functionality."]
|
||||
impl<'a, T: IrcReader, U: IrcWriter> ServerIterator<'a, T, U> {
|
||||
/// Creates a new ServerIterator for the desired IrcServer.
|
||||
#[experimental = "Design will change to accomodate new behavior."]
|
||||
#[experimental = "Design is liable to change to accomodate new functionality."]
|
||||
pub fn new(server: &IrcServer<T, U>) -> ServerIterator<T, U> {
|
||||
ServerIterator { server: server }
|
||||
}
|
||||
|
@ -260,6 +268,7 @@ impl<'a, T: IrcReader, U: IrcWriter> ServerIterator<'a, T, U> {
|
|||
}
|
||||
|
||||
impl<'a, T: IrcReader, U: IrcWriter> Iterator for ServerIterator<'a, T, U> {
|
||||
#[unstable = "Design changed fairly recently."]
|
||||
type Item = IoResult<Message>;
|
||||
fn next(&mut self) -> Option<IoResult<Message>> {
|
||||
let res = self.get_next_line().and_then(|msg|
|
||||
|
|
|
@ -35,6 +35,7 @@ impl<'a, T: IrcReader, U: IrcWriter> Server<'a, T, U> for Wrapper<'a, T, U> {
|
|||
}
|
||||
}
|
||||
|
||||
#[unstable = "More functionality will be added."]
|
||||
impl<'a, T: IrcReader, U: IrcWriter> Wrapper<'a, T, U> {
|
||||
/// Creates a new Wrapper from the given Server.
|
||||
#[stable]
|
||||
|
@ -112,7 +113,7 @@ impl<'a, T: IrcReader, U: IrcWriter> Wrapper<'a, T, U> {
|
|||
|
||||
/// Kicks the listed nicknames from the listed channels with a comment.
|
||||
/// If `message` is an empty string, it won't be included in the message.
|
||||
#[experimental]
|
||||
#[unstable = "Design may change."]
|
||||
pub fn send_kick(&self, chanlist: &str, nicklist: &str, message: &str) -> IoResult<()> {
|
||||
self.server.send(KICK(chanlist, nicklist, if message.len() == 0 {
|
||||
None
|
||||
|
|
Loading…
Add table
Reference in a new issue