From 6c12b260489687e82eaa1c6fed353dd2a40da838 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 4 Oct 2010 00:55:33 +0100 Subject: [PATCH] ypp-chatlog-alerter: ring the bell; better formatting of hours --- ypp-chatlog-alerter | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ypp-chatlog-alerter b/ypp-chatlog-alerter index 6df461b..275d7b5 100755 --- a/ypp-chatlog-alerter +++ b/ypp-chatlog-alerter @@ -106,6 +106,7 @@ proc for_lw {args} { set e_life 120 set tint_switch 90 +set bell_again 60 set tint_switched [expr { exp( -($tint_switch+0.0) / $e_life ) }] proc retint {} { @@ -121,8 +122,10 @@ proc retint {} { lappend newprtimes {} } elseif {$age < 60} { lappend newprtimes [format "%3ds" $age] - } else { + } elseif {$age < 3600} { lappend newprtimes [format "%3dm" [expr {$age/60}]] + } else { + lappend newprtimes [format "%3dh" [expr {$age/3600}]] } set latest [expr { $time > $latest ? $time : $latest }] set tint [expr { exp( (-($age >= 0 ? $age : 0) + 0.0) / $e_life ) }] @@ -274,10 +277,14 @@ proc process-line {l} { proc message {pirate msg} { global times pirates messages height - global lw_ls lw_ws + global lw_ls lw_ws bell_again set ix [lsearch -exact $pirates $pirate] set now [clock seconds] + + if {$ix<0 || [lindex $times $ix] < $now-$bell_again} { + bell -nice + } if {$ix < 0} { set cix 0 set oldest $now @@ -311,6 +318,8 @@ proc parseargs {} { foreach arg $argv { if {![string compare $arg --test-tints]} { showtints + } elseif {![string compare $arg --no-bell]} { + set bell_again -1 } else { error "unknown option $arg" } -- 2.30.2