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 9use strict; 10use vars qw($VERSION %IRSSI); 11 12use Irssi; 13 14$VERSION = '1.02'; 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 => '2018-04-04', 23); 24 25# Channel list 26my @channels; 27 28#main event handler 29sub wash_nick { 30 my ($server, $data, $nick, $address, $target) = @_; 31 my ($channel, $msg) = split(/ :/, $data,2); 32 my $oldnick=$nick; 33 34 # if the current channel is in the list... 35 for (@channels) { 36 if ($_ eq $channel) { 37 # ... check the nick 38 # if the nick contains one of these characters or upper case letters 39 # enter the changing function 40 if ( $nick =~/[A-Z]|\||\\|\]|\[|\^|-|\`|3|0|1|4|_/ ) { 41 $nick =~ s/\|//; 42 $nick =~ s/\\//; 43 $nick =~ s/\]//; 44 $nick =~ s/\[//; 45 $nick =~ s/\^//; 46 $nick =~ s/-//; 47 $nick =~ s/_//; 48 $nick =~ s/\`//; 49 $nick =~ s/3/e/; 50 $nick =~ s/0/O/; 51 $nick =~ s/1/i/; 52 $nick =~ s/4/a/; 53 $nick = lc($nick); 54 55 # fail safe 56 if ($oldnick ne $nick) { 57 # emit signal 58 Irssi::signal_emit("event privmsg", $server, $data, 59 $nick, $address, $target); 60 61 #and stop 62 Irssi::signal_stop(); 63 } 64 } 65 } 66 } 67 68} 69 70Irssi::settings_add_str('washnicks', 'washnicks_channels', '#fof'); 71 72sub update_config { 73 @channels=split(/ /,Irssi::settings_get_str('washnicks_channels')); 74} 75 76update_config(); 77 78Irssi::signal_add('setup changed', 'update_config'); 79Irssi::signal_add('event privmsg', 'wash_nick'); 80