From: Vincent Pit Date: Sat, 10 Mar 2012 11:16:49 +0000 (+0100) Subject: Restyle Xchat::XPI::Utils X-Git-Url: http://git.vpit.fr/?p=perl%2Fscripts%2Fxchat.git;a=commitdiff_plain;h=690f861ecaaacb8fd32387e49693def478a0e931 Restyle Xchat::XPI::Utils --- diff --git a/Xchat/XPI/Utils.pm b/Xchat/XPI/Utils.pm index d5a3fc3..1333adc 100644 --- a/Xchat/XPI/Utils.pm +++ b/Xchat/XPI/Utils.pm @@ -7,14 +7,20 @@ use Xchat qw<:all>; our $VERSION = '0.02'; +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;