Class Irc::IrcClient
In: rbot/rfc2812.rb
Parent: Object
Class: JoinMessage Class: PartMessage Class: Plugins Class: KickMessage Class: IrcAuth Class: IRCChannel Class: IrcSocket Class: BotConfig Class: Keywords Class: BotRegistryAccessor Class: IrcClient Class: DBHash Class: Language Class: TopicMessage Class: QuitMessage Class: PrivMessage Class: UserMessage Class: NoticeMessage Class: IrcBot Class: BasicUserMessage Class: NickMessage Class: Plugin Class: BotRegistry Class: Keyword Class: DBTree Module: Irc

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

[]=    deletehandler    handle    new    process   
Public Class methods

create a new IrcClient instance

Public Instance methods
[]=(key, value)
key:server event to handle
value:proc object called when event occurs

set a handler for a server event

server events currently supported:

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
handle(key, data)
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