an unmodified IRC message) and returns a text string. Returns the string stripped of all IRC formatting codes. Takes one parameter, a string of IRC text. Returns the string stripped of all IRC color codes.
Returns true if it contains any IRC formatting codes, false otherwise. Useful if you want your bot to kick users for (ab)using colors. Returns true if it contains any IRC color codes, false otherwise.
#Irc utilities code
'RPL_WELCOME') as an argument, and returns the corresponding numerical code (e.g. '001') as an argument, and returns the corresponding name (e.g. Takes an IRC server numerical reply code (e.g. Returns true or false if the nickname is valid or not. Takes one argument, a nickname to validate. You can supply a second argument, an array of characters of allowed channel prefixes. Returns true or false if the channel name is valid or not. Takes one argument, a channel name to validate. In a list context it returns a list consisting of the nick, user and hostname, respectively. Takes one parameter, a string representing a user in the form In a scalar context it returns just the nickname. $mode_change is now '-acd+fmZ' parse_user my $mode_change = gen_mode_change('abcde', 'befmZ') Returns a string representing what changed. Takes two arguments, strings representing a set of IRC user modes before and after a change. $mode_line is now '+ooo-v+v' gen_mode_change my $mode_line = unparse_mode_line('+o+o+o-v+v')
Returns a condensed version of the changes. Takes one argument, a string representing a number of mode changes. Optionally, one may pass the casemapping (see uc_irc), as this function uses uc_irc internally. Otherwise, the keys will be the masks matched, each value being an arrayref of the strings that matched it. Returns an empty hashref if there are no matches. Takes two array references, the first being a list of strings representing IRC masks, the second a list of somethings to test against the masks. Returns a true value if they match, a false value otherwise. Takes two parameters, a string representing an IRC mask and something to match against the IRC mask, such as a string.
#Irc utilities full
Returns a normalised full mask.Įxample: $fullbanmask = normalize_mask( 'stalin*' ) Takes one parameter, a string representing an IRC mask. 'args', an arrayref of applicable arguments to the modes Įxample: my $hashref = parse_mode_line( 'ov+b-i', 'Bob', 'sue', ) 'modes', an arrayref of normalised modes On success the following keys will be available in the hashref: If the modeline couldn't be parsed the hashref will be empty. Optionally you can also supply an arrayref and a hashref to specify valid channel modes (default: ) and status modes (default: ), respectively. Takes a list representing an IRC mode line. Returns true if the two strings are equivalent, false otherwise # long version A third, optional parameter specifies the casemapping. Takes two mandatory parameters, IRC strings (channels or nicknames) to compare. Returns the IRC lowercase equivalent of the passed string. Takes one mandatory parameter, a string to convert to IRC lowercase, and one optional parameter, the casemapping of the ircd (which can be 'rfc1459', 'strict-rfc1459' or 'ascii'. Returns the IRC uppercase equivalent of the passed string. Takes one mandatory parameter, a string to convert to IRC uppercase, and one optional parameter, the casemapping of the ircd (which can be 'rfc1459', 'strict-rfc1459' or 'ascii'. Mode lines, ban masks, message encoding and formatting, etc.
The functions in this module take care of many of the tasks you are faced with when working with IRC. My $results_hashref = $nick = ($nick, $user, $host) = DESCRIPTION My $decoded = irc_decode($raw_irc_message) My $full_banmask = normalize_mask($banmask) My $mode_line = 'ov+b-i Bob sue $hashref = parse_mode_line($mode_line) Print "They're equivalent\n" if eq_irc($uppercase_nick, $lowercase_nick) IRC::Utils - Common utilities for IRC-related tasks SYNOPSIS use strict