]> git.vpit.fr Git - perl/scripts/xchat.git/blob - Xchat/XPI/Utils.pm
Initial import
[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 use lib get_info 'xchatdir';
9 use Xchat::XPI qw/register init/;
10  
11 our $VERSION = '0.01';
12
13 my $ph;
14
15 sub dye_nick {
16  my ($nick, $col) = ($_[0], 0);
17  $col += ord for split //, $nick;
18  my @rcolors = (nickcmp(get_info('version'), '2.4.0') < 0)
19                ? (3, 4, 6, 8, 9, 10, 11, 12, 13)
20                : (19, 20, 22, 24, 25, 26, 27, 28, 29);
21  $col %= @rcolors;
22  return sprintf "\003%d%s", $rcolors[$col], $nick;
23 }
24
25 use base qw/Exporter/; 
26  
27 our @EXPORT         = ();
28 our %EXPORT_TAGS    = ('funcs' => [ qw/dye_nick/ ]);
29 our @EXPORT_OK      = map { @$_ } values %EXPORT_TAGS;
30 $EXPORT_TAGS{'all'} = [ @EXPORT_OK ];
31  
32 $ph = new Xchat::XPI name   => 'Extended Xchat Perl Interface :: Utils',
33                      tag    => 'XPI::Utils',
34                      desc   => 'Utility functions',
35                      author => 'Vincent Pit (VPIT)',
36                      email  => 'perl@profvince.com',
37                      url    => 'http://www.profvince.com';
38
39 1;