X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Xchat%2FXPI%2FUtils.pm;h=1333adc91a229c8f78013a401c7de93b39d7a76f;hb=690f861ecaaacb8fd32387e49693def478a0e931;hp=1cb3ade86e60d37d849b49dfff77029b06c79ce5;hpb=263b6777b90548951a13bd56419fa911b010eb9b;p=perl%2Fscripts%2Fxchat.git diff --git a/Xchat/XPI/Utils.pm b/Xchat/XPI/Utils.pm index 1cb3ade..1333adc 100644 --- a/Xchat/XPI/Utils.pm +++ b/Xchat/XPI/Utils.pm @@ -3,37 +3,31 @@ package Xchat::XPI::Utils; use strict; use warnings; -use Xchat qw/:all/; +use Xchat qw<:all>; -use lib get_info 'xchatdir'; -use Xchat::XPI qw/register init/; - -our $VERSION = '0.01'; +our $VERSION = '0.02'; -my $ph; +my @rcolors; +BEGIN { + if (nickcmp(get_info('version'), '2.4.0') < 0) { + @rcolors = (3, 4, 6, 8, 9, 10, 11, 12, 13); + } else { + @rcolors = (19, 20, 22, 24, 25, 26, 27, 28, 29); + } +} sub dye_nick { - my ($nick, $col) = ($_[0], 0); - $col += ord for split //, $nick; - my @rcolors = (nickcmp(get_info('version'), '2.4.0') < 0) - ? (3, 4, 6, 8, 9, 10, 11, 12, 13) - : (19, 20, 22, 24, 25, 26, 27, 28, 29); - $col %= @rcolors; - return sprintf "\003%d%s", $rcolors[$col], $nick; + my $nick = $_[0]; + my $col = 0; + $col += ord for split //, $nick; + return sprintf "\003%d%s", $rcolors[$col % @rcolors], $nick; } -use base qw/Exporter/; +use base qw; our @EXPORT = (); -our %EXPORT_TAGS = ('funcs' => [ qw/dye_nick/ ]); +our %EXPORT_TAGS = ('funcs' => [ qw ]); our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; $EXPORT_TAGS{'all'} = [ @EXPORT_OK ]; -$ph = new Xchat::XPI name => 'Extended Xchat Perl Interface :: Utils', - tag => 'XPI::Utils', - desc => 'Utility functions', - author => 'Vincent Pit (VPIT)', - email => 'perl@profvince.com', - url => 'http://www.profvince.com'; - 1;