AnyEvent-IRC
view release on metacpan or search on metacpan
lib/AnyEvent/IRC/Client.pm view on Meta::CPAN
with the C<ctcp_auto_reply> method, or you can generate the replies yourself.
=head2 A NOTE TO CASE MANAGEMENT
The case insensitivity of channel names and nicknames can lead to headaches
when dealing with IRC in an automated client which tracks channels and nicknames.
I tried to preserve the case in all channel and nicknames
AnyEvent::IRC::Client passes to his user. But in the internal
structures I'm using lower case for the channel names.
The returned hash from C<channel_list> for example has the lower case of the
joined channels as keys.
But I tried to preserve the case in all events that are emitted.
Please keep this in mind when handling the events.
For example a user might joins #TeSt and parts #test later.
=head1 EVENTS
The following events are emitted by L<AnyEvent::IRC::Client>.
Use C<reg_cb> as described in L<Object::Event> to register to such an event.
=over 4
=item registered
Emitted when the connection got successfully registered and the end of the MOTD
(IRC command 376 or 422 (No MOTD file found)) was seen, so you can start sending
commands and all ISUPPORT/PROTOCTL handshaking has been done.
=item channel_add => $msg, $channel, @nicks
Emitted when C<@nicks> are added to the channel C<$channel>,
this happens for example when someone JOINs a channel or when you
get a RPL_NAMREPLY (see RFC1459).
C<$msg> is the IRC message hash that as returned by C<parse_irc_msg>.
=item channel_remove => $msg, $channel, @nicks
Emitted when C<@nicks> are removed from the channel C<$channel>,
happens for example when they PART, QUIT or get KICKed.
C<$msg> is the IRC message hash that as returned by C<parse_irc_msg>
or undef if the reason for the removal was a disconnect on our end.
=item channel_change => $msg, $channel, $old_nick, $new_nick, $is_myself
Emitted when a nickname on a channel changes. This is emitted when a NICK
change occurs from C<$old_nick> to C<$new_nick> give the application a chance
to quickly analyze what channels were affected. C<$is_myself> is true when
yourself was the one who changed the nick.
=item channel_nickmode_update => $channel, $dest
This event is emitted when the (user) mode (eg. op status) of an occupant of
a channel changes. C<$dest> is the nickname on the C<$channel> who's mode was
updated.
=item channel_topic => $channel, $topic, $who
This is emitted when the topic for a channel is discovered. C<$channel>
is the channel for which C<$topic> is the current topic now.
Which is set by C<$who>. C<$who> might be undefined when it's not known
who set the channel topic.
=item ident_change => $nick, $ident
Whenever the user and host of C<$nick> has been determined or a change
happened this event is emitted.
=item join => $nick, $channel, $is_myself
Emitted when C<$nick> enters the channel C<$channel> by JOINing.
C<$is_myself> is true if yourself are the one who JOINs.
=item part => $nick, $channel, $is_myself, $msg
Emitted when C<$nick> PARTs the channel C<$channel>.
C<$is_myself> is true if yourself are the one who PARTs.
C<$msg> is the PART message.
=item kick => $kicked_nick, $channel, $is_myself, $msg, $kicker_nick
Emitted when C<$kicked_nick> is KICKed from the channel C<$channel> by
C<$kicker_nick>. C<$is_myself> is true if yourself are the one who got KICKed.
C<$msg> is the KICK message.
=item nick_change => $old_nick, $new_nick, $is_myself
Emitted when C<$old_nick> is renamed to C<$new_nick>.
C<$is_myself> is true when yourself was the one who changed the nick.
=item away_status_change => $bool
Emitted whenever a presence/away status change for you was detected.
C<$bool> is true if you are now away, or false/undef if you are not
away anymore.
You can change your away status by emitting the C<AWAY> IRC command:
$cl->send_srv (AWAY => "I'm not here right now");
Or reset it:
$cl->send_srv ('AWAY');
=item ctcp => $src, $target, $tag, $msg, $type
Emitted when a CTCP message was found in either a NOTICE or PRIVMSG
message. C<$tag> is the CTCP message tag. (eg. "PING", "VERSION", ...).
C<$msg> is the CTCP message and C<$type> is either "NOTICE" or "PRIVMSG".
C<$src> is the source nick the message came from.
C<$target> is the target nickname (yours) or the channel the ctcp was sent
on.
=item "ctcp_$tag", => $src, $target, $msg, $type
( run in 2.475 seconds using v1.01-cache-2.11-cpan-d7f47b0818f )