]> git.vpit.fr Git - perl/scripts/xchat.git/blobdiff - Xchat/XPI/Utils.pm
Restyle Xchat::XPI::Utils
[perl/scripts/xchat.git] / Xchat / XPI / Utils.pm
index d5a3fc34f39c915b470ee7cca07f0ac3860edf14..1333adc91a229c8f78013a401c7de93b39d7a76f 100644 (file)
@@ -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<Exporter>;