# RPL_BOUNCE=005
# # "Try server <server name>, port <port number>"
RPL_ISUPPORT=005
# "005 nick PREFIX=(ov)@+ CHANTYPES=#& :are supported by this server"
# RPL_BOUNCE=005
# # "Try server <server name>, port <port number>"
RPL_ISUPPORT=005
# "005 nick PREFIX=(ov)@+ CHANTYPES=#& :are supported by this server"
# - Sent by the server to a user to suggest an alternative
# server. This is often used when the connection is
# refused because the server is already full.
# - Sent by the server to a user to suggest an alternative
# server. This is often used when the connection is
# refused because the server is already full.
# - Reply format used by USERHOST to list replies to
# the query list. The reply string is composed as
# follows:
# - 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.
# 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.
RPL_AWAY=301
# "<nick> :<away message>"
RPL_UNAWAY=305
# ":You are no longer marked as being away"
RPL_NOWAWAY=306
# ":You have been marked as being away"
RPL_AWAY=301
# "<nick> :<away message>"
RPL_UNAWAY=305
# ":You are no longer marked as being away"
RPL_NOWAWAY=306
# ":You have been marked as being away"
# - 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.
# - 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.
# - Replies 311 - 313, 317 - 319 are all replies
# generated in response to a WHOIS message. Given that
# there are enough parameters present, the answering
# - Replies 311 - 313, 317 - 319 are all replies
# generated in response to a WHOIS message. Given that
# there are enough parameters present, the answering
# 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.
# 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.
# - 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).
# - 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).
# - Replies RPL_LIST, RPL_LISTEND mark the 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 end reply MUST be sent.
# - Replies RPL_LIST, RPL_LISTEND mark the 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 end reply MUST be sent.
# - 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.
# - 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.
# - Returned by the server to indicate that the
# attempted INVITE message was successful and is
# being passed onto the end client.
# - Returned by the server to indicate that the
# attempted INVITE message was successful and is
# being passed onto the end client.
# - When listing the 'invitations masks' for a given channel,
# a server is required to send the list back using the
# RPL_INVITELIST and RPL_ENDOFINVITELIST messages. A
# separate RPL_INVITELIST is sent for each active mask.
# After the masks have been listed (or if none present) a
# RPL_ENDOFINVITELIST MUST be sent.
# - When listing the 'invitations masks' for a given channel,
# a server is required to send the list back using the
# RPL_INVITELIST and RPL_ENDOFINVITELIST messages. A
# separate RPL_INVITELIST is sent for each active mask.
# After the masks have been listed (or if none present) a
# RPL_ENDOFINVITELIST MUST be sent.
# - When listing the 'exception masks' for a given channel,
# a server is required to send the list back using the
# RPL_EXCEPTLIST and RPL_ENDOFEXCEPTLIST messages. A
# separate RPL_EXCEPTLIST is sent for each active mask.
# After the masks have been listed (or if none present)
# a RPL_ENDOFEXCEPTLIST MUST be sent.
# - When listing the 'exception masks' for a given channel,
# a server is required to send the list back using the
# RPL_EXCEPTLIST and RPL_ENDOFEXCEPTLIST messages. A
# separate RPL_EXCEPTLIST is sent for each active mask.
# After the masks have been listed (or if none present)
# a RPL_ENDOFEXCEPTLIST MUST be sent.
# - Reply by the server showing its version details.
# The <version> is the version of the software being
# used (including any patchlevel revisions) and the
# <debuglevel> is used to indicate if the server is
# running in "debug mode".
# - Reply by the server showing its version details.
# The <version> is the version of the software being
# used (including any patchlevel revisions) and the
# <debuglevel> is used to indicate if the server is
# running in "debug mode".
RPL_WHOREPLY=352
# "<channel> <user> <host> <server> <nick>
# ( "H" / "G" > ["*"] [ ( "@" / "+" ) ]
# :<hopcount> <real name>"
RPL_WHOREPLY=352
# "<channel> <user> <host> <server> <nick>
# ( "H" / "G" > ["*"] [ ( "@" / "+" ) ]
# :<hopcount> <real name>"
# - 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
# - 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
# with a WHO message, a RPL_ENDOFWHO MUST be sent
# after processing each list item with <name> being
# the item.
# with a WHO message, a RPL_ENDOFWHO MUST be sent
# after processing each list item with <name> being
# the item.
RPL_NAMREPLY=353
# "( "=" / "*" / "@" ) <channel>
# :[ "@" / "+" ] <nick> *( " " [ "@" / "+" ] <nick> )
# - "@" is used for secret channels, "*" for private
# channels, and "=" for others (public channels).
RPL_NAMREPLY=353
# "( "=" / "*" / "@" ) <channel>
# :[ "@" / "+" ] <nick> *( " " [ "@" / "+" ] <nick> )
# - "@" is used for secret channels, "*" for private
# channels, and "=" for others (public channels).
# - 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
# - 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
# channels and contents are sent back in a series of
# RPL_NAMEREPLY messages with a RPL_ENDOFNAMES to mark
# the end.
# channels and contents are sent back in a series of
# RPL_NAMEREPLY messages with a RPL_ENDOFNAMES to mark
# the end.
# - In replying to the LINKS message, a server MUST send
# replies back using the RPL_LINKS numeric and mark the
# end of the list using an RPL_ENDOFLINKS reply.
# - In replying to the LINKS message, a server MUST send
# replies back using the RPL_LINKS numeric and mark the
# end of the list using an RPL_ENDOFLINKS reply.
# - 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 banmask. After the
# banmasks have been listed (or if none present) a
# RPL_ENDOFBANLIST MUST be sent.
# - 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 banmask. After the
# banmasks have been listed (or if none present) a
# RPL_ENDOFBANLIST MUST be sent.
# - 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.
# - 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.
# - 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 MUST be surrounded
# by a RPL_MOTDSTART (before the RPL_MOTDs) and an
# RPL_ENDOFMOTD (after).
# - 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 MUST be surrounded
# by a RPL_MOTDSTART (before the RPL_MOTDs) and an
# RPL_ENDOFMOTD (after).
# - RPL_YOUREOPER is sent back to a client which has
# just successfully issued an OPER message and gained
# operator status.
# - RPL_YOUREOPER is sent back to a client which has
# just successfully issued an OPER message and gained
# operator status.
# - If the REHASH option is used and an operator sends
# a REHASH message, an RPL_REHASHING is sent back to
# the operator.
# - If the REHASH option is used and an operator sends
# a REHASH message, an RPL_REHASHING is sent back to
# the operator.
# - 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.
# - 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.
# - 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.
# - 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.
# - The RPL_TRACE* are all returned by the server in
# response to the TRACE message. How many are
# returned is dependent on the TRACE message and
# - The RPL_TRACE* are all returned by the server in
# response to the TRACE message. How many are
# returned is dependent on the TRACE message and
# response to a TRACE command traversing the IRC
# network should reflect the actual connectivity of
# the servers themselves along that path.
# response to a TRACE command traversing the IRC
# network should reflect the actual connectivity of
# the servers themselves along that path.
# RPL_TRACENEWTYPE is to be used for any connection
# which does not fit in the other categories but is
# being displayed anyway.
# RPL_TRACEEND is sent to indicate the end of the list.
# RPL_TRACENEWTYPE is to be used for any connection
# which does not fit in the other categories but is
# being displayed anyway.
# RPL_TRACEEND is sent to indicate the end of the list.
# "<linkname> <sendq> <sent messages>
# <sent Kbytes> <received messages>
# <received Kbytes> <time open>"
# "<linkname> <sendq> <sent messages>
# <sent Kbytes> <received messages>
# <received Kbytes> <time open>"
# - reports statistics on a connection. <linkname>
# identifies the particular connection, <sendq> is
# the amount of data that is queued and waiting to be
# - reports statistics on a connection. <linkname>
# identifies the particular connection, <sendq> is
# the amount of data that is queued and waiting to be
# Kbytes> for received data, respectively. <time
# open> indicates how long ago the connection was
# opened, in seconds.
# Kbytes> for received data, respectively. <time
# open> indicates how long ago the connection was
# opened, in seconds.
# - To answer a query about a client's own mode,
# RPL_UMODEIS is sent back.
# - To answer a query about a client's own mode,
# RPL_UMODEIS is sent back.
# - When listing services in reply to a SERVLIST message,
# a server is required to send the list back using the
# RPL_SERVLIST and RPL_SERVLISTEND messages. A separate
# RPL_SERVLIST is sent for each service. After the
# services have been listed (or if none present) a
# RPL_SERVLISTEND MUST be sent.
# - When listing services in reply to a SERVLIST message,
# a server is required to send the list back using the
# RPL_SERVLIST and RPL_SERVLISTEND messages. A separate
# RPL_SERVLIST is sent for each service. After the
# services have been listed (or if none present) a
# RPL_SERVLISTEND MUST be sent.
# - In processing an LUSERS message, the server
# sends a set of replies from RPL_LUSERCLIENT,
# RPL_LUSEROP, RPL_USERUNKNOWN,
# - In processing an LUSERS message, the server
# sends a set of replies from RPL_LUSERCLIENT,
# RPL_LUSEROP, RPL_USERUNKNOWN,
# - When replying to an ADMIN message, a server
# is expected to use replies RPL_ADMINME
# through to RPL_ADMINEMAIL and provide a text
# - When replying to an ADMIN message, a server
# is expected to use replies RPL_ADMINME
# through to RPL_ADMINEMAIL and provide a text
# - When a server drops a command without processing it,
# it MUST use the reply RPL_TRYAGAIN to inform the
# originating client.
# - When a server drops a command without processing it,
# it MUST use the reply RPL_TRYAGAIN to inform the
# originating client.
# - 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 or where the user is
# banned and is trying to send a PRIVMSG message to
# that channel.
# - 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 or where the user is
# banned and is trying to send a PRIVMSG message to
# that channel.
# - Sent to a user when they have joined the maximum
# number of allowed channels and they try to join
# another channel.
# - Sent to a user when they have joined the maximum
# number of allowed channels and they try to join
# another channel.
# - Returned to a client which is attempting to send a
# PRIVMSG/NOTICE using the user@host destination format
# and for a user@host which has several occurrences.
# - Returned to a client which is attempting to send a
# PRIVMSG/NOTICE using the user@host destination format
# and for a user@host which has several occurrences.
# - Returned to a client which is attempting to JOIN a safe
# channel using the shortname when there are more than one
# such channel.
# - Returned to a client which is attempting to JOIN a safe
# channel using the shortname when there are more than one
# such channel.
# - 412 - 415 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 $<server>" or "PRIVMSG #<host>" is attempted.
# - 412 - 415 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 $<server>" or "PRIVMSG #<host>" is attempted.
# - Returned by a server in response to an ADMIN message
# when there is an error in finding the appropriate
# information.
# - Returned by a server in response to an ADMIN message
# when there is an error in finding the appropriate
# information.
# - Generic error message used to report a failed file
# operation during the processing of a message.
# - Generic error message used to report a failed file
# operation during the processing of a message.
# - Returned after receiving a NICK message which contains
# characters which do not fall in the defined set. See
# section 2.3.1 for details on valid nicknames.
# - Returned after receiving a NICK message which contains
# characters which do not fall in the defined set. See
# section 2.3.1 for details on valid nicknames.
# - Returned when a NICK message is processed that results
# in an attempt to change to a currently existing
# nickname.
# - Returned when a NICK message is processed that results
# in an attempt to change to a currently existing
# nickname.
# - Returned by a server to a client when it detects a
# nickname collision (registered of a NICK that
# already exists by another server).
# - Returned by a server to a client when it detects a
# nickname collision (registered of a NICK that
# already exists by another server).
# - Returned by a server to a user trying to join a channel
# currently blocked by the channel delay mechanism.
# - Returned by a server to a user trying to join a channel
# currently blocked by the channel delay mechanism.
# - Returned by a server to a user trying to change nickname
# when the desired nickname is blocked by the nick delay
# mechanism.
# - Returned by a server to a user trying to change nickname
# when the desired nickname is blocked by the nick delay
# mechanism.
# - Returned by the server to indicate that the target
# user of the command is not on the given channel.
# - Returned by the server to indicate that the target
# user of the command is not on the given channel.
# - Returned by the server whenever a client tries to
# perform a channel affecting command for which the
# client isn't a member.
# - Returned by the server whenever a client tries to
# perform a channel affecting command for which the
# client isn't a member.
# - Returned by the summon after a SUMMON command for a
# user was unable to be performed since they were not
# logged in.
# - Returned by the summon after a SUMMON command for a
# user was unable to be performed since they were not
# logged in.
# - Returned as a response to the SUMMON command. MUST be
# returned by any server which doesn't implement it.
# - Returned as a response to the SUMMON command. MUST be
# returned by any server which doesn't implement it.
# - Returned as a response to the USERS command. MUST be
# returned by any server which does not implement it.
# - Returned as a response to the USERS command. MUST be
# returned by any server which does not implement it.
# - Returned by the server to indicate that the client
# MUST be registered before the server will allow it
# to be parsed in detail.
# - Returned by the server to indicate that the client
# MUST be registered before the server will allow it
# to be parsed in detail.
# - Returned by the server by numerous commands to
# indicate to the client that it didn't supply enough
# parameters.
# - Returned by the server by numerous commands to
# indicate to the client that it didn't supply enough
# parameters.
# - 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).
# - 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).
# - 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.
# - 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.
# - Returned to indicate a failed attempt at registering
# a connection for which a password was required and
# was either not given or incorrect.
# - Returned to indicate a failed attempt at registering
# a connection for which a password was required and
# was either not given or incorrect.
# - Returned after an attempt to connect and register
# yourself with a server which has been setup to
# explicitly deny connections to you.
# - Returned after an attempt to connect and register
# yourself with a server which has been setup to
# explicitly deny connections to you.
# - Any command requiring operator privileges to operate
# MUST return this error to indicate the attempt was
# unsuccessful.
# - Any command requiring operator privileges to operate
# MUST return this error to indicate the attempt was
# unsuccessful.
# - 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.
# - 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.
# - Any attempts to use the KILL command on a server
# are to be refused and this error returned directly
# to the client.
# - Any attempts to use the KILL command on a server
# are to be refused and this error returned directly
# to the client.
# - Sent by the server to a user upon connection to indicate
# the restricted nature of the connection (user mode "+r").
# - Sent by the server to a user upon connection to indicate
# the restricted nature of the connection (user mode "+r").
# - Any MODE requiring "channel creator" privileges MUST
# return this error if the client making the attempt is not
# a chanop on the specified channel.
# - Any MODE requiring "channel creator" privileges MUST
# return this error if the client making the attempt is not
# a chanop on the specified channel.
# - 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.
# - 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.
# - 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.
# - 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.
# - Error sent to any user trying to view or change the
# user mode for a user other than themselves.
# - Error sent to any user trying to view or change the
# user mode for a user other than themselves.
# implements RFC 2812 and prior IRC RFCs.
# clients register handler proc{}s for different server events and IrcClient
# handles dispatch
# implements RFC 2812 and prior IRC RFCs.
# clients register handler proc{}s for different server events and IrcClient
# handles dispatch
# key:: server event to handle
# value:: proc object called when event occurs
# set a handler for a server event
# key:: server event to handle
# value:: proc object called when event occurs
# set a handler for a server event
# takes a server string, checks for PING, PRIVMSG, NOTIFY, etc, and parses
# numeric server replies, calling the appropriate handler for each, and
# sending it a hash containing the data from the server
def process(serverstring)
data = Hash.new
data[:serverstring] = serverstring
# takes a server string, checks for PING, PRIVMSG, NOTIFY, etc, and parses
# numeric server replies, calling the appropriate handler for each, and
# sending it a hash containing the data from the server
def process(serverstring)
data = Hash.new
data[:serverstring] = serverstring
prefix, command, params = $2, $3, $5
prefix, command, params = $2, $3, $5
# TOPICLEN=450 KICKLEN=450 CHANNELLEN=30 KEYLEN=23 CHANTYPES=#
# PREFIX=(ov)@+ CASEMAPPING=ascii CAPAB IRCD=dancer :are available
# on this server"
# TOPICLEN=450 KICKLEN=450 CHANNELLEN=30 KEYLEN=23 CHANTYPES=#
# PREFIX=(ov)@+ CASEMAPPING=ascii CAPAB IRCD=dancer :are available
# on this server"
# key:: server event name
# data:: hash containing data about the event, passed to the proc
# call client's proc for an event, if they set one as a handler
# key:: server event name
# data:: hash containing data about the event, passed to the proc
# call client's proc for an event, if they set one as a handler