Module: IRC

Defined in:
lib/failirc/mask.rb,
lib/failirc.rb,
lib/failirc/modes.rb,
lib/failirc/client.rb,
lib/failirc/errors.rb,
lib/failirc/server.rb,
lib/failirc/sslutils.rb,
lib/failirc/responses.rb,
lib/failirc/client/user.rb,
lib/failirc/server/link.rb,
lib/failirc/server/user.rb,
lib/failirc/client/users.rb,
lib/failirc/server/links.rb,
lib/failirc/server/users.rb,
lib/failirc/client/client.rb,
lib/failirc/client/module.rb,
lib/failirc/client/server.rb,
lib/failirc/server/client.rb,
lib/failirc/server/module.rb,
lib/failirc/client/channel.rb,
lib/failirc/client/clients.rb,
lib/failirc/server/channel.rb,
lib/failirc/server/clients.rb,
lib/failirc/client/channels.rb,
lib/failirc/server/channels.rb,
lib/failirc/client/dispatcher.rb,
lib/failirc/server/dispatcher.rb,
lib/failirc/client/modules/Base.rb,
lib/failirc/server/modules/Base.rb,
lib/failirc/client/modules/Logger.rb,
lib/failirc/server/modules/Netlog.rb,
lib/failirc/server/modules/TinyURL.rb,
lib/failirc/client/dispatcher/event.rb,
lib/failirc/server/dispatcher/event.rb,
lib/failirc/server/modules/Cloaking.rb,
lib/failirc/server/modules/Firewall.rb,
lib/failirc/server/modules/Roulette.rb,
lib/failirc/server/modules/Translate.rb,
lib/failirc/server/modules/WordFilter.rb,
lib/failirc/client/dispatcher/eventdispatcher.rb,
lib/failirc/server/dispatcher/eventdispatcher.rb,
lib/failirc/client/dispatcher/connectiondispatcher.rb,
lib/failirc/server/dispatcher/connectiondispatcher.rb

Overview

failirc, a fail IRC library.

Copyleft meh. [http://meh.doesntexist.org | [email protected]]

This file is part of failirc.

failirc is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

failirc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with failirc. If not, see http://www.gnu.org/licenses/.

Defined Under Namespace

Modules: SSLUtils Classes: Client, Mask, Modes, Server

Constant Summary collapse

VERSION =
'0.0.1'
ERR_NOSUCHNICK =

Used to indicate the nickname parameter supplied to a command is currently unused.

{
    :code => 401,
    :text => '"#{value} :No such nick/channel"'
}
ERR_NOSUCHSERVER =

Used to indicate the server name given currently doesn't exist.

{
    :code => 402,
    :text => '"#{value} :No such server"'
}
ERR_NOSUCHCHANNEL =

Used to indicate the given channel name is invalid.

{
    :code => 403,
    :text => '"#{value} :No such channel"'
}
ERR_CANNOTSENDTOCHAN =

Sent to a user who is either (a) not on a channel which is mode +n or (b) not a chanop (or mode +v) on a channel which has mode +m set and is trying to send a PRIVMSG message to that channel.

{
    :code => 404,
    :text => '"#{value[:channel]} :Cannot send to channel"'
}
ERR_YOUNEEDVOICE =
{
    :code => 404,
    :text => '"#{value} :You need voice (+v) (#{value})"'
}
ERR_NOEXTERNALMESSAGES =
{
    :code => 404,
    :text => '"#{value} :No external channel messages (#{value})"'
}
ERR_YOUAREBANNED =
{
    :code => 404,
    :text => '"#{value} :You are banned (#{value})"'
}
ERR_NOCTCPS =
{
    :code => 404,
    :text => '"#{value} :CTCPs are not permtted in this channel (#{value})"'
}
ERR_NOCOLORS =
{
    :code => 404,
    :text => '"#{value} :Color is not permitted in this channel (#{value})"'
}
ERR_TOOMANYCHANNELS =

Sent to a user when they have joined the maximum number of allowed channels and they try to join another channel.

{
    :code => 405,
    :text => '"#{value.name} :You have joined too many channels"'
}
ERR_WASNOSUCHNICK =

Sent to a user when they have joined the maximum number of allowed channels and they try to join another channel.

{
    :code => 406,
    :text => '"#{value} :There was no such nickname"'
}
ERR_TOOMANYTARGETS =

Returned to a client which is attempting to send PRIVMSG/NOTICE using the user@host destination format and for a user@host which has several occurrences.

{
    :code => 407,
    :text => '"#{value} :Duplicate recipients. No message delivered"'
}
ERR_NOORIGIN =

PING or PONG message missing the originator parameter which is required since these commands must work without valid prefixes.

{
    :code => 409,
    :text => '":No origin specified"'
}
ERR_NORECIPIENT =
{
    :code => 411,
    :text => '":No recipient given (#{value})"'
}
ERR_NOTEXTTOSEND =
{
    :code => 412,
    :text => '":No text to send"'
}
ERR_NOTOPLEVEL =
{
    :code => 413,
    :text => '"#{mask} :No toplevel domain specified"'
}
ERR_WILDTOPLEVEL =

412 - 414 are returned by PRIVMSG to indicate that the message wasn't delivered for some reason. ERR_NOTOPLEVEL and ERR_WILDTOPLEVEL are errors that are returned when an invalid use of "PRIVMSG $" or "PRIVMSG #" is attempted.

{
    :code => 414,
    :text => '"#{mask} :Wildcard in toplevel domain"'
}
ERR_UNKNOWNCOMMAND =

Returned to a registered client to indicate that the command sent is unknown by the server.

{
    :code => 421,
    :text => '"#{value} :Unknown command"'
}
ERR_NOMOTD =

Server's MOTD file could not be opened by the server.

{
    :code => 422,
    :text => '":MOTD File is missing"'
}
ERR_NOADMININFO =

Returned by a server in response to an ADMIN message when there is an error in finding the appropriate information.

{
    :code => 423,
    :text => '"#{server.name} :No administrative info available"'
}
ERR_FILEERROR =

Generic error message used to report a failed file operation during the processing of a message.

{
    :code => 424,
    :text => '":File error doing #{fileOperation} on #{file}"'
}
ERR_NONICKNAMEGIVEN =

Returned when a nickname parameter expected for a command and isn't found.

{
    :code => 431,
    :text => '":No nickname given"'
}
ERR_ERRONEUSNICKNAME =

Returned after receiving a NICK message which contains characters which do not fall in the defined set. See section x.x.x for details on valid nicknames.

{
    :code => 432,
    :text => '"#{value} :Erroneus nickname"'
}
ERR_NICKNAMEINUSE =

Returned when a NICK message is processed that results in an attempt to change to a currently existing nickname.

{
    :code => 433,
    :text => '"#{value} :Nickname is already in use"'
}
ERR_NICKCOLLISION =

Returned by a server to a client when it detects a nickname collision (registered of a NICK that already exists by another server).

{
    :code => 436,
    :text => '"#{value} :Nickname collision KILL"'
}
ERR_USERNOTINCHANNEL =

Returned by the server to indicate that the target user of the command is not on the given channel.

{
    :code => 441,
    :text => '"#{value[:nick]} #{value[:channel]} :They aren\'t on that channel"'
}
ERR_NOTONCHANNEL =

Returned by the server whenever a client tries to perform a channel effecting command for which the client isn't a member.

{
    :code => 442,
    :text => '"#{value} :You\'re not on that channel"'
}
ERR_USERONCHANNEL =

Returned when a client tries to invite a user to a channel they are already on.

{
    :code => 443,
    :text => '"#{value[:nick]} #{value[:channel]} :is already on channel"'
}
ERR_NOLOGIN =

Returned by the summon after a SUMMON command for a user was unable to be performed since they were not logged in.

{
    :code => 444,
    :text => '"#{user} :User not logged in"'
}
ERR_SUMMONDISABLED =

Returned as a response to the SUMMON command. Must be returned by any server which does not implement it.

{
    :code => 445,
    :text => '":SUMMON has been disabled"'
}
ERR_USERSDISABLED =

Returned as a response to the USERS command. Must be returned by any server which does not implement it.

{
    :code => 446,
    :text => '":USERS has been disabled"'
}
ERR_NOTREGISTERED =

Returned by the server to indicate that the client must be registered before the server will allow it to be parsed in detail.

{
    :code => 451,
    :text => '":You have not registered"'
}
ERR_NEEDMOREPARAMS =

Returned by the server by numerous commands to indicate to the client that it didn't supply enough parameters.

{
    :code => 461,
    :text => '"#{value} :Not enough parameters"'
}
ERR_ALREADYREGISTRED =

Returned by the server to any link which tries to change part of the registered details (such as password or user details from second USER message).

{
    :code => 462,
    :text => '":You may not reregister"'
}
ERR_NOPERMFORHOST =

Returned to a client which attempts to register with a server which does not been setup to allow connections from the host the attempted connection is tried.

{
    :code => 463,
    :text => '":Your host isn\'t among the privileged"'
}
ERR_PASSWDMISMATCH =

Returned to indicate a failed attempt at registering a connection for which a password was required and was either not given or incorrect.

{
    :code => 464,
    :text => '":Password incorrect"'
}
ERR_YOUREBANNEDCREEP =

Returned after an attempt to connect and register yourself with a server which has been setup to explicitly deny connections to you.

{
    :code => 465,
    :text => '":You are banned from this server"'
}
ERR_KEYSET =
{
    :code => 467,
    :text => '"#{value} :Channel key already set"'
}
ERR_CHANNELISFULL =
{
    :code => 471,
    :text => '"#{value} :Cannot join channel (+l)"'
}
ERR_UNKNOWNMODE =
{
    :code => 472,
    :text => '"#{value} :is unknown mode char to me"'
}
ERR_INVITEONLYCHAN =
{
    :code => 473,
    :text => '"#{value} :Cannot join channel (+i)"'
}
ERR_BANNEDFROMCHAN =
{
    :code => 474,
    :text => '"#{value} :Cannot join channel (+b)"'
}
ERR_BADCHANNELKEY =
{
    :code => 475,
    :text => '"#{value} :Cannot join channel (+k)"'
}
ERR_NOKNOCK =
{
    :code => 480,
    :text => '":Cannot knock on #{value[:channel]} (#{value[:reason]})"'
}
ERR_NOPRIVILEGES =

Any command requiring operator privileges to operate must return this error to indicate the attempt was unsuccessful.

{
    :code => 481,
    :text => '":Permission Denied- You\'re not an IRC operator"'
}
ERR_CHANOPRIVSNEEDED =

Any command requiring 'chanop' privileges (such as MODE messages) must return this error if the client making the attempt is not a chanop on the specified channel.

{
    :code => 482,
    :text => '"#{value} :You\'re not channel operator"'
}
ERR_CANTKILLSERVER =

Any attempts to use the KILL command on a server are to be refused and this error returned directly to the client.

{
    :code => 483,
    :text => '":You cant kill a server!"'
}
ERR_NOOPERHOST =

If a client sends an OPER message and the server has not been configured to allow connections from the client's host as an operator, this error must be returned.

{
    :code => 491,
    :text => '":No O-lines for your host"'
}
ERR_UMODEUNKNOWNFLAG =

Returned by the server to indicate that a MODE message was sent with a nickname parameter and that the a mode flag sent was not recognized.

{
    :code => 501,
    :text => '":Unknown MODE flag"'
}
ERR_USERSDONTMATCH =

Error sent to any user trying to view or change the user mode for a user other than themselves.

{
    :code => 502,
    :text => '":Cant change mode for other users"'
}
ERR_BADCHANMASK =

custom

{
    :code => 476,
    :text => '"#{value} :Bad channel name"'
}
ERR_ALLMUSTUSESSL =
{
    :code => 974,
    :text => '"z :all members must be connected via SSL"'
}
ERR_SSLREQUIRED =
{
    :code => 489,
    :text => '"#{value} :Cannot join channel (SSL is required)"'
}
ERR_NONICKCHANGE =
{
    :code => 447,
    :text => '"Can not change nickname while on #{value} (+N)"'
}
ERR_NOKICKS =
{
    :code => 972,
    :text => '"KICK :channel is +Q"'
}
ERR_NOINVITE =
{
    :code => 518,
    :text => '"Cannot invite (+V) at channel #{value}"'
}
RPL_NONE =

Dummy reply number. Not used.

{
    :code => 300,
    :text => '""'
}
RPL_USERHOST =

Reply format used by USERHOST to list replies to the query list. The reply string is composed as follows: ::= [''] '=' <'+'|'-'> The '' indicates whether the client has registered as an Operator. The '-' or '+' characters represent whether the client has set an AWAY message or not respectively.

{
    :code => 302,
    :text => '":#{(result) ? \\"#{value.nick}=#{(result.modes[:oper]) ? \'*\' : \'\'} = #{(!result.modes[:away]) ? \'+\' : \'-\'}#{value.user}@#{value.host}\\" : \'\'"'
}
RPL_ISON =

Reply format used by ISON to list replies to the query list.

{
    :code => 303,
    :text => '":#{result}"'
}
RPL_AWAY =
{
    :code => 301,
    :text => '"#{value.nick} :#{value.modes[:away]}"'
}
RPL_UNAWAY =
{
    :code => 305,
    :text => '":You are no longer marked as being away"'
}
RPL_NOWAWAY =

These replies are used with the AWAY command (if allowed). RPL_AWAY is sent to any client sending a PRIVMSG to a client which is away. RPL_AWAY is only sent by the server to which the client is connected. Replies RPL_UNAWAY and RPL_NOWAWAY are sent when the client removes and sets an AWAY message.

{
    :code => 306,
    :text => '":You have been marked as being away"'
}
RPL_WHOISUSER =
{
    :code => 311,
    :text => '"#{value.nick} #{value.user} #{value.host} * :#{value.realName}"'
}
RPL_WHOISSERVER =
{
    :code => 312,
    :text => '"#{value.nick} #{value.server.host} :#{value.server.name}"'
}
RPL_WHOISOPERATOR =
{
    :code => 313,
    :text => '"#{value.nick} :#{value.modes[:message]}"'
}
RPL_WHOISIDLE =
{
    :code => 317,
    :text => '"#{value.nick} #{Time.now.tv_sec - value.modes[:last_action].on.tv_sec} #{value.connectedOn.tv_sec} :seconds idle, signon time"'
}
RPL_ENDOFWHOIS =
{
    :code => 318,
    :text => '"#{value.nick} :End of /WHOIS list"'
}
RPL_WHOISCHANNELS =

Replies 311 - 313, 317 - 319 are all replies generated in response to a WHOIS message. Given that there are enough parameters present, the answering server must either formulate a reply out of the above numerics (if the query nick is found) or return an error reply. The '*' in RPL_WHOISUSER is there as the literal character and not as a wild card. For each reply set, only RPL_WHOISCHANNELS may appear more than once (for long lists of channel names). The '@' and '+' characters next to the channel name indicate whether a client is a channel operator or has been granted permission to speak on a moderated channel. The RPL_ENDOFWHOIS reply is used to mark the end of processing a WHOIS message.

{
    :code => 319,
    :text => '"#{value[:nick]} :#{value[:channels]}"'
}
RPL_WHOWASUSER =
{
    :code => 314,
    :text => '"#{value.nick} #{value.user} #{value.host} * :#{value.realName}"'
}
RPL_ENDOFWHOWAS =

When replying to a WHOWAS message, a server must use the replies RPL_WHOWASUSER, RPL_WHOISSERVER or ERR_WASNOSUCHNICK for each nickname in the presented list. At the end of all reply batches, there must be RPL_ENDOFWHOWAS (even if there was only one reply and it was an error).

{
    :code => 369,
    :text => '"#{value.nick} :End of WHOWAS"'
}
RPL_LISTSTART =
{
    :code => 321,
    :text => '"Channel :Users Name"'
}
RPL_LIST =
{
    :code => 322,
    :text => '"#{value.name} #{value.users.length} #{value.modes.to_s != "+" ? "[#{value.modes.to_s}]" : ""} :#{value.topic.text}"'
}
RPL_LISTEND =

Replies RPL_LISTSTART, RPL_LIST, RPL_LISTEND mark the start, actual replies with data and end of the server's response to a LIST command. If there are no channels available to return, only the start and end reply must be sent.

{
    :code => 323,
    :text => '":End of /LIST"'
}
RPL_CHANNELMODEIS =
{
    :code => 324,
    :text => '"#{value.name} #{value.modes}"'
}
RPL_NOTOPIC =
{
    :code => 331,
    :text => '"#{value.name} :No topic is set"'
}
RPL_TOPIC =

When sending a TOPIC message to determine the channel topic, one of two replies is sent. If the topic is set, RPL_TOPIC is sent back else RPL_NOTOPIC.

{
    :code => 332,
    :text => '"#{value.channel.name} :#{value}"'
}
RPL_INVITING =

Returned by the server to indicate that the attempted INVITE message was successful and is being passed onto the end client.

{
    :code => 341,
    :text => '"#{value[:nick]} #{value[:channel]}"'
}
RPL_SUMMONING =

Returned by a server answering a SUMMON message to indicate that it is summoning that user.

{
    :code => 342,
    :text => '"#{value.user} :Summoning user to IRC"'
}
RPL_VERSION =

Reply by the server showing its version details. The is the version of the software being used (including any patchlevel revisions) and the is used to indicate if the server is running in "debug mode". The "comments" field may contain any comments about the version or further version details.

{
    :code => 351,
    :text => '"failirc-#{server.version}. #{server.host} :#{value}"'
}
RPL_WHOREPLY =
{
    :code => 352,
    :text => '"#{value[:channel].name} #{value[:user].user} #{value[:user].host} #{value[:user].server.host} #{value[:user].nick} #{\'H\' || \'G\'}#{value[:user].modes[:level]} :#{value[:hops]} #{value[:user].realName}"'
}
RPL_ENDOFWHO =

The RPL_WHOREPLY and RPL_ENDOFWHO pair are used to answer a WHO message. The RPL_WHOREPLY is only sent if there is an appropriate match to the WHO query. If there is a list of parameters supplied with a WHO message, a RPL_ENDOFWHO must be sent after processing each list item with being the item.

{
    :code => 315,
    :text => '"#{value} :End of /WHO list"'
}
RPL_NAMREPLY =
{
    :code => 353,
    :text => '"= #{value[:channel]} :#{value[:users]}"'
}
RPL_ENDOFNAMES =

To reply to a NAMES message, a reply pair consisting of RPL_NAMREPLY and RPL_ENDOFNAMES is sent by the server back to the client. If there is no channel found as in the query, then only RPL_ENDOFNAMES is returned. The exception to this is when a NAMES message is sent with no parameters and all visible channels and contents are sent back in a series of RPL_NAMEREPLY messages with a RPL_ENDOFNAMES to mark the end.

{
    :code => 366,
    :text => '"#{value} :End of /NAMES list"'
}
{
    :code => 364,
    :text => '"#{value.mask} #{value.host} :#{message.hopcount} #{value.informations}"'
}
{
    :code => 365,
    :text => '"#{value.mask} :End of /LINKS list"'
}
RPL_BANLIST =
{
    :code => 367,
    :text => '"#{value}"'
}
RPL_ENDOFBANLIST =

When listing the active 'bans' for a given channel, a server is required to send the list back using the RPL_BANLIST and RPL_ENDOFBANLIST messages. A separate RPL_BANLIST is sent for each active banid. After the banids have been listed (or if none present) a RPL_ENDOFBANLIST must be sent.

{
    :code => 368,
    :text => '"#{value} :End of channel ban list"'
}
RPL_INFO =
{
    :code => 371,
    :text => '":#{value}"'
}
RPL_ENDOFINFO =

A server responding to an INFO message is required to send all its 'info' in a series of RPL_INFO messages with a RPL_ENDOFINFO reply to indicate the end of the replies.

{
    :code => 374,
    :text => '":End of /INFO list"'
}
RPL_MOTDSTART =
{
    :code => 375,
    :text => '":- #{server.host} Message of the day - "'
}
RPL_MOTD =
{
    :code => 372,
    :text => '":- #{value}"'
}
RPL_ENDOFMOTD =

When responding to the MOTD message and the MOTD file is found, the file is displayed line by line, with each line no longer than 80 characters, using RPL_MOTD format replies. These should be surrounded by a RPL_MOTDSTART (before the RPL_MOTDs) and an RPL_ENDOFMOTD (after).

{
    :code => 376,
    :text => '":End of /MOTD command"'
}
RPL_YOUREOPER =

RPL_YOUREOPER is sent back to a client which has just successfully issued an OPER message and gained operator status.

{
    :code => 381,
    :text => '":You are now an IRC operator"'
}
RPL_REHASHING =

If the REHASH option is used and an operator sends a REHASH message, an RPL_REHASHING is sent back to the operator.

{
    :code => 382,
    :text => '"#{value.path} :Rehashing"'
}
RPL_TIME =

When replying to the TIME message, a server must send the reply using the RPL_TIME format above. The string showing the time need only contain the correct day and time there. There is no further requirement for the time string.

{
    :code => 391,
    :text => '"#{value.host} :#{value.time}"'
}
RPL_USERSSTART =
{
    :code => 392,
    :text => '":UserID Terminal Host"'
}
RPL_USERS =
{
    :code => 393,
    :text => '":%-8s %-9s %-8s"'
}
RPL_ENDOFUSERS =
{
    :code => 394,
    :text => '":End of users"'
}
RPL_NOUSERS =

If the USERS message is handled by a server, the replies RPL_USERSTART, RPL_USERS, RPL_ENDOFUSERS and RPL_NOUSERS are used. RPL_USERSSTART must be sent first, following by either a sequence of RPL_USERS or a single RPL_NOUSER. Following this is RPL_ENDOFUSERS.

{
    :code => 395,
    :text => '":Nobody logged in"'
}
{
    :code => 200,
    :text => '"Link #{value.version} #{value.debugLevel} #{value.destination} #{value.next.host}"'
}
RPL_TRACECONNECTING =
{
    :code => 201,
    :text => '"Try. #{value.class} #{value.host}"'
}
RPL_TRACEHANDSHAKE =
{
    :code => 202,
    :text => '"H.S. #{value.class} #{value.host}"'
}
RPL_TRACEUNKNOWN =
{
    :code => 203,
    :text => '"???? #{value.class} #{value.ip}"'
}
RPL_TRACEOPERATOR =
{
    :code => 204,
    :text => '"Oper #{value.class} #{value.nick}"'
}
RPL_TRACEUSER =
{
    :code => 205,
    :text => '"User #{value.class} #{value.nick}"'
}
RPL_TRACESERVER =
{
    :code => 206,
    :text => '"Serv #{value.class} <int>S <int>C <server> <nick!user|*!*>@<host|server>"'
}
RPL_WELCOME =

custom

{
    :code => 1,
    :text => '":Welcome to the #{server.config.elements[\'config/server/name\'].text} #{value.mask}"'
}
RPL_HOSTEDBY =
{
    :code => 2,
    :text => '":Your host is #{server.host}[#{server.ip}/#{value.listen.attributes[\'port\']}], running version failirc-#{server.version}"'
}
RPL_SERVCREATEDON =
{
    :code => 3,
    :text => '":This server was created #{server.createdOn}"'
}
RPL_SERVINFO =
{
    :code => 4,
    :text => '"#{server.host} failirc-#{server.version} #{value[:user]} #{value[:channel]}"'
}
RPL_ISUPPORT =
{
    :code => 5,
    :text => '"#{value} :are supported by this server"'
}
RPL_CHANCREATEDON =
{
    :code => 329,
    :text => '"#{value.name} #{value.createdOn.tv_sec}"'
}
RPL_TOPICSETON =
{
    :code => 333,
    :text => '"#{value.channel.name} #{value.setBy} #{value.setOn.tv_sec}"'
}
RPL_USINGSSL =
{
    :code => 671,
    :text => '"#{value.nick} :is using a Secure Connection"'
}