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

implements RFC 2812 and prior IRC RFCs. clients register handler proc{}s for different server events and IrcClient handles dispatch

Methods

[]=   deletehandler   handle   new   process  

Public Class methods

create a new IrcClient 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:

created:when the server was started
yourhost:your host details (on connection)
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
welcome:server welcome message on connect
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

Private Instance methods

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

[Validate]