#!/usr/bin/wish
+proc manyset {list args} {
+ foreach val $list var $args {
+ upvar 1 $var my
+ set my $val
+ }
+}
+
set progname ypp-chatlog-alerter
menu .mbar -tearoff 0
}
}
+set height 5
+
+listbox .t -width 5 -height $height -borderwidth 0
+listbox .p -width 14 -height $height -borderwidth 0
+listbox .m -width 80 -height $height -borderwidth 0
+pack .t .p .m -side left
+
proc newfile {} {
global currentfile defaultfile
- set newfile [tk_getOpenFile -multiple 0 -title "Select YPP log to track"]
+ set newfile [tk_getOpenFile -multiple 0 -initialfile $currentfile \
+ -title "Select YPP log to track"]
if {![string length $newfile]} return
set currentfile $newfile
refresh
}
-set currentfile {}
+proc for_ll {varname body} {
+ upvar 1 $varname l
+ foreach l {times pirates messages} {
+ set rc [catch { uplevel 1 $body } emsg]
+ switch -exact $rc {
+ 0 {
+ # ok
+ }
+ 4 {
+ # continue
+ }
+ 3 {
+ # break
+ return
+ }
+ default {
+ # error, return, etc.
+ return -code $rc -errorinfo $errorInfo \
+ -errorcode $errorCode $emsg
+ }
+ }
+ }
+}
+
+proc retint {} {
+ global messages
+ set i 0
+ set now [clock seconds]
+ foreach minfo $messages {
+ manyset $minfo then pirate msg
+ set !
+}
+
+proc init {} {
+ global currentfile height
+ global times pirates messages
+ set currentfile {}
+
+ foreach w {t p m} { .$w delete 0 end }
+ foreach l {times pirates messages}
+ for {set i 0} {$i<$height} {incr i} {
+ lappend times 0
+ lappend pirates {}
+ lappend messages {}
+ foreach w {t p m} { .$w insert end {} }
+ }
+}
proc refresh {} {
}
+init
+
if {[file exists $defaultfile]} {
source $defaultfile
}
-listbox .l
+refresh