From: Vincent Pit Date: Fri, 20 Nov 2015 17:08:44 +0000 (-0200) Subject: Strip ANSI sequences from hostnames X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=707ebbe12e6aaada84a123ae0c36215d49b5223d;p=perl%2Fscripts%2Fxchat.git Strip ANSI sequences from hostnames Rizon colors vhosts... yes. --- diff --git a/clones.pl b/clones.pl index d661eb9..5fb37f0 100755 --- a/clones.pl +++ b/clones.pl @@ -55,7 +55,7 @@ sub clone_list_str { sub host { my $userhost = lc $_[0]; - return $userhost =~ /@([^@]+)$/ ? $1 : $userhost; + return $userhost =~ /@([^@]+)$/ ? strip_code($1) : $userhost; } sub add { diff --git a/opers.pl b/opers.pl index 218b2d2..f8d178d 100755 --- a/opers.pl +++ b/opers.pl @@ -23,7 +23,7 @@ hook_server '352', sub { return EAT_NONE if $opers{$serv}{irc_lc($nick)}; $opers{$serv}{irc_lc($nick)} = $nick; - my $host = $_[0][4] . '@' . $_[0][5]; + my $host = $_[0][4] . '@' . strip_code $_[0][5]; my %chans; push @{$chans{$_->{type}}}, $_ for grep $_->{server} eq $serv, get_list 'channels'; diff --git a/tools.pl b/tools.pl index f7b1606..070f096 100755 --- a/tools.pl +++ b/tools.pl @@ -121,7 +121,7 @@ hook_command 'HGREP', sub { $txt = qr/$txt/i; my @matches; for (get_list 'users') { - my $host = $_->{host}; + my $host = strip_code $_->{host}; next unless $host =~ /$txt/; push @matches, [ $_->{nick}, $host ]; }