diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:19:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:19:02 +0000 |
commit | 03929dac2a29664878d2c971648a4fe1fb698462 (patch) | |
tree | 02c5e2b3e006234aa29545f7a93a1ce01b291a8b /scripts/act.pl | |
parent | Initial commit. (diff) | |
download | irssi-scripts-03929dac2a29664878d2c971648a4fe1fb698462.tar.xz irssi-scripts-03929dac2a29664878d2c971648a4fe1fb698462.zip |
Adding upstream version 20231031.upstream/20231031upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/act.pl')
-rw-r--r-- | scripts/act.pl | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/act.pl b/scripts/act.pl new file mode 100644 index 0000000..21cbbbb --- /dev/null +++ b/scripts/act.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl +# resets window activity status +# by c0ffee +# - http://www.penguin-breeder.org/irssi/ + +#<scriptinfo> +use strict; +use vars qw($VERSION %IRSSI); + +use Irssi 20020120; +$VERSION = "0.15"; +%IRSSI = ( + authors => "c0ffee", + contact => "c0ffee\@penguin-breeder.org", + name => "Reset window activity status", + description => "Reset window activity status. defines command /act", + license => "Public Domain", + url => "http://www.penguin-breeder.org/irssi/", + changed => "Thu Apr 16 15:55:05 BST 2015", +); +#</scriptinfo> + +# +# /ACT [PUBLIC|ALL] +# +# /ACT without parameters marks windows as non-active where no +# public talk occured. +# +# /ACT PUBLIC also removes those where no nick hilight was triggered +# +# /ACT ALL sets all windows as non-active + +Irssi::command_bind 'act' => sub { + my ( $data, $server, $item ) = @_; + $data =~ s/\s+$//g; + if ($data) { + Irssi::command_runsub('act', $data, $server, $item); + } + else { + _act(1); + } +}; + +Irssi::command_bind('act public', sub { _act(2); }); +Irssi::command_bind('act all', sub { _act(3); }); + +sub _act { + my($level) = @_; + for (Irssi::windows()) { + if ($_->{data_level} <= $level) { + Irssi::signal_emit("window dehilight", $_); + } + } +} |