]> jfr.im git - irssi-scripts.git/blame - nohilight.pl
no autorun smshilight
[irssi-scripts.git] / nohilight.pl
CommitLineData
3f24f7e4 1use Irssi;
2use vars qw($VERSION %IRSSI);
3
4$VERSION = "0.1";
5%IRSSI = (
6 authors => "Paul Traylor",
7 name => "nohilight",
8 description => "Do not hilight messages from a list of users",
9 license => 'MIT',
10 url => 'http://github.com/kfdm/irssi-nohilight',
11 contact => 'http://github.com/kfdm/irssi-nohilight/issues'
12);
13
14sub remove_hilight {
15 my ($dest, $text, $stripped) = @_;
16 if ($dest->{level} & MSGLEVEL_HILIGHT) {
17 my @nicks = map(quotemeta, split(/[, ]/, Irssi::settings_get_str('nohilight_nicks')));
18 foreach my $nick (@nicks) {
19 if ($stripped =~ /<.?$nick>/) {
20 my $window = $dest->{window};
21 $text =~ s/%/%%/g;
22 $window->print($text, MSGLEVEL_PUBLIC);
23 Irssi::signal_stop();
24 return;
25 }
26 }
27 }
28}
29
30Irssi::signal_add_first('print text', 'remove_hilight');
31Irssi::settings_add_str($IRSSI{'name'}, 'nohilight_nicks', '');
32Irssi::print('%G>>%n '.$IRSSI{name}.' '.$VERSION.' loaded');