]> git.vpit.fr Git - perl/scripts/xchat.git/blob - Xchat/XPI/Utils.pm
d5a3fc34f39c915b470ee7cca07f0ac3860edf14
[perl/scripts/xchat.git] / Xchat / XPI / Utils.pm
1 package Xchat::XPI::Utils;
2
3 use strict;
4 use warnings;
5
6 use Xchat qw<:all>;
7
8 our $VERSION = '0.02';
9
10 sub dye_nick {
11  my ($nick, $col) = ($_[0], 0);
12  $col += ord for split //, $nick;
13  my @rcolors = (nickcmp(get_info('version'), '2.4.0') < 0)
14                ? (3, 4, 6, 8, 9, 10, 11, 12, 13)
15                : (19, 20, 22, 24, 25, 26, 27, 28, 29);
16  $col %= @rcolors;
17  return sprintf "\003%d%s", $rcolors[$col], $nick;
18 }
19
20 use base qw<Exporter>; 
21  
22 our @EXPORT         = ();
23 our %EXPORT_TAGS    = ('funcs' => [ qw<dye_nick> ]);
24 our @EXPORT_OK      = map { @$_ } values %EXPORT_TAGS;
25 $EXPORT_TAGS{'all'} = [ @EXPORT_OK ];
26  
27 1;