]> git.vpit.fr Git - perl/scripts/xchat.git/blobdiff - tools.pl
Make sure local_context() runs the code only when the context was found
[perl/scripts/xchat.git] / tools.pl
index b06f166d614b31cb12d53410dc245cb41e790a85..070f096d8da4777e71647ae74db4407d08453e70 100755 (executable)
--- a/tools.pl
+++ b/tools.pl
@@ -10,6 +10,7 @@ use Xchat qw<:all>;
 
 use lib get_info 'xchatdir';
 use Xchat::XPI;
+use Xchat::XPI::Utils qw<gui save_context>;
 
 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'
@@ -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 ];
  }