1# Print hilighted messages with MSGLEVEL_PUBLIC  to active window
2# for irssi 0.7.99 by Paweł 'Styx' Chuchmała based on hilightwin.pl by Timo Sirainen
3use strict;
4use Irssi;
5use vars qw($VERSION %IRSSI);
6$VERSION = "0.2";
7%IRSSI = (
8        authors         => "Paweł \'Styx\' Chuchmała",
9	contact         => "styx\@irc.pl",
10	name            => "showhilight",
11	description     => "Show hilight messages in active window",
12	license         => "GNU GPLv2",
13	changed         => "Fri Jun 28 11:09:42 CET 2002"
14
15);
16
17sub sig_printtext {
18  my ($dest, $text, $stripped) = @_;
19
20  my $window = Irssi::active_win();
21
22  if (($dest->{level} & MSGLEVEL_HILIGHT) && ($dest->{level} & MSGLEVEL_PUBLIC) &&
23       ($window->{refnum} != $dest->{window}->{refnum}) && ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0) {
24
25    $text =~ s/%/%%/g;
26    $text = $dest->{target}.":%K[".Irssi::settings_get_str('hilight_color').$dest->{window}->{refnum}."%K]:".$text;
27
28    $window->print($text, MSGLEVEL_CLIENTCRAP);
29  }
30}
31
32Irssi::signal_add('print text', 'sig_printtext');
33