From: Pablo Báez Date: Sun, 20 May 2018 14:39:42 +0000 (-0300) Subject: Add timer setting to disable stop messages X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=3f5e7fd9e96eb3e5af19465ea33aa2946c51be77;p=irssi-scripts.irssi.org.git Add timer setting to disable stop messages --- diff --git a/scripts/timer.pl b/scripts/timer.pl index 1c5a8c7..22c4f6f 100644 --- a/scripts/timer.pl +++ b/scripts/timer.pl @@ -19,7 +19,7 @@ use warnings; use vars qw ($VERSION %IRSSI); use Irssi 20020325 qw (command_bind command_runsub command timeout_add timeout_remove signal_add_first); -$VERSION = '0.7'; +$VERSION = '0.8'; %IRSSI = ( authors => 'Kimmo Lehto, Marcus Rueckert', contact => 'kimmo@a-men.org, darix@irssi.org' , @@ -29,6 +29,8 @@ $VERSION = '0.7'; changed => '2015-02-07' ); +Irssi::settings_add_bool('timer', 'timer_stop_msgs', 1); + our %timers; # my %timer = { repeat => \d+, command => '' , windowitem => NULL , server=> NULL, timer = NULL}; @@ -59,14 +61,15 @@ sub timer_command { sub cmd_timerstop { my ( $name ) = @_; + my $verbose = Irssi::settings_get_bool('timer_stop_msgs'); if ( exists ( $timers{$name} ) ) { timeout_remove($timers{$name}->{'timer'}); $timers{$name} = (); delete ( $timers{$name} ); - print( CRAP "Timer \"$name\" stopped." ); + print( CRAP "Timer \"$name\" stopped." ) if $verbose; } else { - print( CRAP "\cBTimer:\cB No such timer \"$name\"." ); + print( CRAP "\cBTimer:\cB No such timer \"$name\"." ) if $verbose; } }