X-Git-Url: http://git.vpit.fr/?p=perl%2Fscripts%2Fxchat.git;a=blobdiff_plain;f=tools.pl;h=070f096d8da4777e71647ae74db4407d08453e70;hp=f162dad5a159674c7b34d44f04016f83c299422a;hb=HEAD;hpb=742dde9fdf8ef61c1a1382d326aaa2c1293a9f54 diff --git a/tools.pl b/tools.pl index f162dad..070f096 100755 --- a/tools.pl +++ b/tools.pl @@ -4,12 +4,13 @@ use strict; use warnings; use Data::Dumper; -use Encode qw/encode/; +use Encode qw; -use Xchat qw/:all/; +use Xchat qw<:all>; use lib get_info 'xchatdir'; use Xchat::XPI; +use Xchat::XPI::Utils qw; use constant MAX_MATCHES => 10; @@ -23,12 +24,11 @@ BEGIN { } hook_command 'TC', sub { - my $oldctxt = get_context; + my $guard = save_context; for (get_list 'channels') { set_context $_->{context}; - command 'GUI COLOR 0'; + gui 'clear'; } - set_context $oldctxt; return EAT_ALL; }, { help_text => 'TC, reset all tab color indicators' @@ -118,10 +118,10 @@ hook_command 'WIDE', sub { hook_command 'HGREP', sub { my $txt = $_[1][1]; return EAT_ALL unless defined $txt; - $txt = qr/$txt/; + $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 ]; } @@ -140,11 +140,13 @@ hook_command 'HGREP', sub { help_text => 'HGREP , print users in the current context whose hostname matches text' }; -$ph = new Xchat::XPI name => 'Misc tools', - tag => 'Tools', - desc => 'Perl interpretor, URI escaper', - author => 'Vincent Pit (VPIT)', - email => 'perl@profvince.com', - url => 'http://www.profvince.com'; +$ph = Xchat::XPI->new( + name => 'Misc tools', + tag => 'Tools', + desc => 'Perl interpretor, URI escaper', + author => 'Vincent Pit (VPIT)', + email => 'perl@profvince.com', + url => 'http://www.profvince.com', +); 1;