chiark / gitweb /
ypp-chatlog-alerter: disable debugging; do clear properly (new notification)
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 3 Oct 2010 23:48:04 +0000 (00:48 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 3 Oct 2010 23:48:04 +0000 (00:48 +0100)
ypp-chatlog-alerter

index caefc5e306d3e538b6f38b4d45aa94019760ff92..6df461bec6d4e37cb96f0fdd0e0c7b320433dad4 100755 (executable)
@@ -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
 }