Class Irc::Client
In: lib/rbot/rfc2812.rb
Parent: Object

Implements RFC 2812 and prior IRC RFCs.

Clients should register Proc{}s to handle the various server events, and the Client class will handle dispatch.

Methods

[]=   deletehandler   new   process   reset  

Attributes

server  [R]  the Server we‘re connected to
user  [R]  the User representing us on that server

Public Class methods

Create a new Client instance

Public Instance methods

key:server event to handle
value:proc object called when event occurs

set a handler for a server event

server events currently supported:

TODO handle errors ERR_CHANOPRIVSNEEDED, ERR_CANNOTSENDTOCHAN

welcome:server welcome message on connect
yourhost:your host details (on connection)
created:when the server was started
isupport:information about what this server supports
ping:server pings you (default handler returns a pong)
nicktaken:you tried to change nick to one that‘s in use
badnick:you tried to change nick to one that‘s invalid
topic:someone changed the topic of a channel
topicinfo:on joining a channel or asking for the topic, tells you who set it and when
names:server sends list of channel members when you join
motd:server message of the day
privmsg:privmsg, the core of IRC, a message to you from someone
public:optionally instead of getting privmsg you can hook to only the public ones…
msg:or only the private ones, or both
kick:someone got kicked from a channel
part:someone left a channel
quit:someone quit IRC
join:someone joined a channel
changetopic:the topic of a channel changed
invite:you are invited to a channel
nick:someone changed their nick
mode:a mode change
notice:someone sends you a notice
unknown:any other message not handled by the above
key:event name

remove 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

Clear the server and reset the user

[Validate]