# Description: adds support for the dalnet watch command variable watch [info script] bind all <> [namespace current]::connect proc connect {} { global info variable watch if {[info exists info(server,watch)]} { set autoload 0 set startup 0 LoadFile $watch Echo .0 {[ info ] Watch script loaded, using WATCH for notify} info default global prefs set list "" foreach x $prefs(notify) { lappend list "+$x" } if {$list != ""} { after 7000 [list Send "WATCH $list"] } } else { command_unload .0 [file tail $watch] set autoload 1 set startup 0 LoadFile $watch } } proc unload {} {} noautoload procs command_watch raw_600 raw_601 raw_602 raw_604 raw_605 raw_607 raw_303 command_notify proc command_watch {window line} { Send "WATCH $line" } proc raw_600 {header line} { global notify info set nick [lindex $header 3] Echo .0 "\[ notify \] Signon by $nick ([lindex $header 4]@[lindex $header 5]) at [clock format [lindex $header 6] -format "%H:%M:%S"]" notify default if [info exists info(query,[string tolower $nick])] { Echo $info(query,[string tolower $nick]) "\[ notify \] Signon by $nick ([lindex $header 4]@[lindex $header 5]) at [clock format [lindex $header 6] -format "%H:%M:%S"]" notify default } lappend notify(on) $nick set notify([string tolower $nick]) "[lindex $header 4]@[lindex $header 5] [lindex $header 6]" DoNotifyWindow refresh Event notify 0 "nick nick address address" $nick![lindex $header 4]@[lindex $header 5] } proc raw_601 {header line} { global info notify set nick [lindex $header 3] Echo .0 "\[ notify \] Signoff by $nick ([lindex $header 4]@[lindex $header 5]) at [clock format [lindex $header 6] -format "%H:%M:%S"]" notify default if [info exists info(query,[string tolower $nick])] { Echo $info(query,[string tolower $nick]) "\[ notify \] Signoff by $nick ([lindex $header 4]@[lindex $header 5]) at [clock format [lindex $header 6] -format "%H:%M:%S"]" notify default } catch {unset notify([string tolower $nick])} set index [lsearch -exact [string tolower $notify(on)] [string tolower $nick]] set notify(on) [lreplace $notify(on) $index $index] DoNotifyWindow refresh Event unnotify 0 "nick nick address address" $nick![lindex $header 4]@[lindex $header 5] } proc raw_602 {header line} { global prefs notify Echo .0 "\[ notify \] [lindex $header 3] removed from watch list" set index [lsearch -exact [string tolower $prefs(notify)] [string tolower [lindex $header 3]]] set prefs(notify) [lreplace $prefs(notify) $index $index] set index [lsearch -exact [string tolower $notify(on)] [string tolower [lindex $header 3]]] set notify(on) [lreplace $notify(on) $index $index] DoNotifyWindow refresh } proc raw_604 {header line} { global prefs notify set nick [lindex $header 3] Echo .0 "\[ notify \] Online: $nick ([lindex $header 4]@[lindex $header 5]) since [clock format [lindex $header 6] -format "%m/%d/%y at %H:%M:%S"]" notify default if {[lsearch -exact [string tolower $prefs(notify)] [string tolower $nick]] == "-1"} { lappend prefs(notify) $nick } set notify([string tolower $nick]) "[lindex $header 4]@[lindex $header 5] [lindex $header 6]" if {[lsearch -exact [string tolower $notify(on)] [string tolower $nick]] == "-1"} { Event notify 0 "nick nick address address" $nick![lindex $header 4]@[lindex $header 5] } lappend notify(on) $nick DoNotifyWindow refresh } proc raw_605 {header line} { global prefs notify Echo .0 "\[ notify \] Offline: [lindex $header 3]" notify default if {[lsearch -exact [string tolower $prefs(notify)] [string tolower [lindex $header 3]]] == "-1"} { lappend prefs(notify) [lindex $header 3] } DoNotifyWindow refresh } proc raw_607 {header line} { } proc raw_303 {header line} { } proc command_notify {window line} { Echo $window "\[ info \] Please use /watch or unload the watch script" info default }