All pastes #554907 Raw Edit

Miles

public text v1 · immutable
·published 2007-06-10 09:23 UTC
rendered paste body
use Irssi;

sub sig_printtext {
  my ($dest, $text, $stripped) = @_;
  my ($window) = Irssi::window_find_name('hilight');
  my ($target) = $dest->{target};
  if ((($dest->{level} & (MSGLEVEL_HILIGHT|MSGLEVEL_MSGS)) &&
       ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0) &&
     (!($target eq get_active_win())) &&
       ($target =~ /^#.*/)) {
    if ($dest->{level} & MSGLEVEL_PUBLIC) {
      $text = "$target: $text";
    }
    $window->print($text, MSGLEVEL_CLIENTCRAP) if ($window);
  }
}

sub get_active_win {
    my ($win) = Irssi::active_win();
    return $win->get_active_name();
}

Irssi::signal_add('print text', 'sig_printtext');