Why not adopt me?
NAME
IRC::Toolkit::ISupport - IRC ISUPPORT parser
SYNOPSIS
use IRC::Toolkit::ISupport;
my $isupport = parse_isupport(@raw_lines);
## Get the MODES= value
my $maxmodes = $isupport->modes;
## Get the PREFIX= char for mode 'o'
my $prefix_for_o = $isupport->prefix('o');
## Find out if we have WHOX support
if ( $isupport->whox ) {
...
}
## ... etc ...
DESCRIPTION
An ISUPPORT (IRC numeric 005) parser that accepts either raw IRC lines or IRC::Message::Object instances and produces struct-like objects with some special magic for parsing known ISUPPORT types.
See http://www.irc.org/tech_docs/005.html
parse_isupport
Takes a list of raw IRC lines or IRC::Message::Object instances and produces ISupport objects.
Keys not listed here will return their raw value (or '0 but true' for boolean values).
The following known keys are parsed to provide a nicer interface:
chanlimit
If passed a channel prefix character, returns the CHANLIMIT= value for that prefix.
Without any arguments, returns a HASH mapping channel prefixes to their respective CHANLIMIT= value.
chanmodes
The four mode sets described by a compliant CHANMODES= declaration are list modes, modes that always take a parameter, modes that take a parameter only when they are set, and boolean-type 'flag' modes, respectively:
CHANMODES=LIST,ALWAYS,WHENSET,BOOL
You can retrieve List::Objects::WithUtils::Array ARRAY-type objects containing lists of modes belonging to each set:
my @listmodes = @{ $isupport->chanmodes->list };
my @always = $isupport->chanmodes->always->all;
my $whenset = $isupport->chanmodes->whenset;
my $boolean = $isupport->chanmodes->bool;
Or retrieve the full string representation via as_string:
my $chanmodes = $isupport->chanmodes->as_string;
chantypes
Without any arguments, returns a HASH whose keys are the allowable channel prefixes.
If given a channel prefix, returns boolean true if the channel prefix is allowed per CHANTYPES.
elist
Without any arguments, returns a HASH whose keys are the supported ELIST tokens.
With a token specified, returns boolean true if the token is enabled.
extban
Returns an object with the following methods:
prefix returns the extended ban prefix character.
flags returns the supported extended ban flags as an List::Objects::WithUtils::Array of flags:
if ($isupp->extban->flags->grep(sub { $_[0] eq 'a' })->has_any) {
...
}
as_string returns the string representation of the EXTBAN= declaration.
maxlist
Without any arguments, returns a HASH mapping list-type modes (see "chanmodes") to their respective numeric limit.
If given a list-type mode, returns the limit for that list.
prefix
Without any arguments, returns a HASH mapping status modes to their respective prefixes.
If given a status modes, returns the prefix belonging to that mode.
statusmsg
Without any arguments, returns a HASH whose keys are the valid message target status prefixes.
If given a status prefix, returns boolean true if the prefix is listed in STATUSMSG.
targmax
Given a target type (as of this writing charybdis specifies 'names', 'list', 'kick', 'whois', 'privmsg', 'notice', 'accept', 'monitor'), returns the TARGMAX definition for that type, if present.
Returns undef if the specified TARGMAX key is nonexistant or has no limit defined.
AUTHOR
Jon Portnoy <avenj@cobaltirc.org>