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/beepaway.pl | |
parent | Initial commit. (diff) | |
download | irssi-scripts-upstream/20231031.tar.xz irssi-scripts-upstream/20231031.zip |
Adding upstream version 20231031.upstream/20231031upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/beepaway.pl')
-rw-r--r-- | scripts/beepaway.pl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/beepaway.pl b/scripts/beepaway.pl new file mode 100644 index 0000000..ade6e7b --- /dev/null +++ b/scripts/beepaway.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl +# +# by Simon 'corecode' Schuberty <corecode@corecode.ath.cx> + +use strict; +use vars qw($VERSION %IRSSI); +$VERSION = "2018122301"; +%IRSSI = ( + authors => "Simon 'corecode' Schubert", + contact => "corecode\@corecode.ath.cx", + name => "beepaway", + description => "Only beep when you are away", + license => "BSD", + changed => "$VERSION", +); +use Irssi 20020324; + +sub catch_away { + my $level; + my $server; + ($server) = @_; + + if ($server->{usermode_away}) { + $level = Irssi::settings_get_str("beep_away_msg_level") + } else { + $level = Irssi::settings_get_str("beep_back_msg_level") + } +# Irssi::print "%R>>%n setting levels ``$level''"; + if ($level eq '' || $level =~ m/NONE/) { + $server->command("/^set -clear beep_msg_level "); + } else { + $server->command("/^set beep_msg_level ".$level); + } +} + +Irssi::settings_add_str($IRSSI{name}, "beep_away_msg_level", "MSGS NOTICES DCC DCCMSGS HILIGHT"); +Irssi::settings_add_str($IRSSI{name}, "beep_back_msg_level", "NONE"); + +Irssi::signal_add("away mode changed", "catch_away"); + +print CLIENTCRAP '%B>>%n '.$IRSSI{name}.' '.$VERSION.' (c) '.$IRSSI{authors}.' loaded'; |