From ac1cf45e4672ac30f232cee92e60eb1a2d17a5c5 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 4 Oct 2010 00:48:04 +0100 Subject: [PATCH] ypp-chatlog-alerter: disable debugging; do clear properly (new notification) --- ypp-chatlog-alerter | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ypp-chatlog-alerter b/ypp-chatlog-alerter index caefc5e..6df461b 100755 --- a/ypp-chatlog-alerter +++ b/ypp-chatlog-alerter @@ -74,12 +74,15 @@ proc hidenotice {} { } proc newfile {} { - global currentfile defaultfile + global currentfile defaultfile logfile set newfile [tk_getOpenFile -multiple 0 -initialfile $currentfile \ -title "Select YPP log to track"] if {![string length $newfile]} return + catch { close $logfile } + catch { unset logfile } + set currentfile $newfile set newdefaults [open $defaultfile.new w] puts $newdefaults "[list set currentfile $currentfile]" @@ -116,14 +119,14 @@ proc retint {} { set age [expr {$now-$time}] if {!$time} { lappend newprtimes {} - } elseif {$age < 120} { + } elseif {$age < 60} { lappend newprtimes [format "%3ds" $age] } else { lappend newprtimes [format "%3dm" [expr {$age/60}]] } set latest [expr { $time > $latest ? $time : $latest }] set tint [expr { exp( (-($age >= 0 ? $age : 0) + 0.0) / $e_life ) }] -puts "AGE $age LA $latest TI $tint" +#puts "AGE $age LA $latest TI $tint" tintentries .msg $i $tint incr i } @@ -212,7 +215,7 @@ proc file-read-lines {lvar body} { set l "$bufdata$lhs" set bufdata {} set got $rhs -puts ">>$l<<" +#puts ">>$l<<" uplevel 1 $body } append bufdata $got @@ -256,7 +259,7 @@ proc pollfile {} { file-read-lines l { hidenotice if {[regexp {^\[\d+:\d+:\d+\] (.*)} $l dummy rhs]} { -puts PROCLINE +#puts PROCLINE process-line $rhs } } @@ -264,7 +267,7 @@ puts PROCLINE proc process-line {l} { if {[regexp {^(\w+) tells ye, \"(.*)\"$} $l dummy pirate msg]} { -puts "MESSAGE $l" +#puts "MESSAGE $l" message $pirate $msg } } @@ -298,7 +301,7 @@ proc message {pirate msg} { $w delete $ix $w insert $ix $new } -puts "TIMES $times" +#puts "TIMES $times" .pirate itemconfigure $ix -foreground white retint } -- 2.30.2