summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/hilightwin.pl26
1 files changed, 24 insertions, 2 deletions
diff --git a/scripts/hilightwin.pl b/scripts/hilightwin.pl
index 7d70317..2e407fa 100644
--- a/scripts/hilightwin.pl
+++ b/scripts/hilightwin.pl
@@ -11,7 +11,7 @@ use Irssi;
use POSIX;
use vars qw($VERSION %IRSSI);
-$VERSION = "0.04";
+$VERSION = "0.05";
%IRSSI = (
authors => "Timo \'cras\' Sirainen, Mark \'znx\' Sangster",
contact => "tss\@iki.fi, znxster\@gmail.com",
@@ -22,6 +22,26 @@ $VERSION = "0.04";
changed => "Sun May 25 18:59:57 BST 2008"
);
+sub is_ignored {
+ my ($dest) = @_;
+
+ my @ignore = split(' ', Irssi::settings_get_str('hilightwin_ignore_targets'));
+ return 0 if (!@ignore);
+
+ my %targets = map { $_ => 1 } @ignore;
+
+ return 1 if exists($targets{"*"});
+ return 1 if exists($targets{$dest->{target}});
+
+ if ($dest->{server}) {
+ my $tag = $dest->{server}->{tag};
+ return 1 if exists($targets{$tag . "/*"});
+ return 1 if exists($targets{$tag . "/" . $dest->{target}});
+ }
+
+ return 0;
+}
+
sub sig_printtext {
my ($dest, $text, $stripped) = @_;
@@ -33,7 +53,8 @@ sub sig_printtext {
if(
($dest->{level} & ($opt)) &&
- ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0
+ ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0 &&
+ (!is_ignored($dest))
) {
my $window = Irssi::window_find_name('hilight');
@@ -49,6 +70,7 @@ my $window = Irssi::window_find_name('hilight');
Irssi::print("Create a window named 'hilight'") if (!$window);
Irssi::settings_add_bool('hilightwin','hilightwin_showprivmsg',1);
+Irssi::settings_add_str('hilightwin', 'hilightwin_ignore_targets', '');
Irssi::signal_add('print text', 'sig_printtext');