diff options
| author | ailin-nemui | 2017-02-13 19:47:53 +0100 |
|---|---|---|
| committer | GitHub | 2017-02-13 19:47:53 +0100 |
| commit | f5801eb3f56c452a8c3598aae3320e0a41c0b5ca (patch) | |
| tree | 5eb65339f8da49066db1be57a6a8f1617d6ecfbc /scripts | |
| parent | c5adacf95d1c6fa33573a0f3d021cbbbd4fa1aab (diff) | |
| parent | 6ea316d2d74f5b55bc4ef8ef8e43ec8ed0132575 (diff) | |
| download | scripts.irssi.org-f5801eb3f56c452a8c3598aae3320e0a41c0b5ca.tar.bz2 | |
Merge pull request #348 from dequis/hilightwin_ignore_targets
hilightwin.pl: Add hilightwin_ignore_targets setting
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/hilightwin.pl | 26 |
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'); |
