html/washnicks.pl
1 # washnicks.pl
2 #
3 # Removes annoying characters from nicks
4 #
5 # TODO:
6 # - Don't use the function if only the first letter is upper case
7 #
8
9 use strict;
10 use vars qw($VERSION %IRSSI);
11
12 use Irssi;
13
14 $VERSION = '1.01';
15 %IRSSI = (
16 authors => 'ulbkold',
17 contact => 'solaris@sundevil.de',
18 name => 'washnicks',
19 description => 'Removes annoying characters from nicks',
20 license => 'GPL',
21 url => 'n/a',
22 changed => '12 April 2002 14:44:11',
23 );
24
25 # Channel list
26 my @channels = ('#fof');
27
28 #main event handler
29 sub wash_nick {
30 my ($server, $data, $nick, $address, $target) = @_;
31 my ($channel, $msg) = split(/ :/, $data,2);
32
33 # if the current channel is in the list...
34 for (@channels) {
35 if ($_ eq $channel) {
36 # ... check the nick
37 # if the nick contains one of these characters or upper case letters
38 # enter the changing function
39 if ( $nick =~/[A-Z]|\||\\|\]|\[|\^|-|\`|3|0|1|4|_/ ) {
40 $nick =~ s/\|//;
41 $nick =~ s/\\//;
42 $nick =~ s/\]//;
43 $nick =~ s/\[//;
44 $nick =~ s/\^//;
45 $nick =~ s/-//;
46 $nick =~ s/-//;
47 $nick =~ s/\`//;
48 $nick =~ s/3/e/;
49 $nick =~ s/0/O/;
50 $nick =~ s/1/i/;
51 $nick =~ s/4/a/;
52 $nick = lc($nick);
53
54 # emit signal
55 Irssi::signal_emit("event privmsg", $server, $data,
56 $nick, $address, $target);
57
58 #and stop
59 Irssi::signal_stop();
60 }
61 }
62 }
63
64 }
65
66
67 Irssi::signal_add('event privmsg', 'wash_nick');