watching you
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 10 Jun 2002 01:13:01 +0000 (01:13 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 10 Jun 2002 01:13:01 +0000 (01:13 +0000)
ledhelp
ledmodule.tcl

diff --git a/ledhelp b/ledhelp
index b5ba083..e94f74d 100644 (file)
--- a/ledhelp
+++ b/ledhelp
@@ -1,7 +1,10 @@
 :
 Commands:
- reload <username>   reload configuration from <username>
- help                display this help
+ who                    report on which channels are reported where
+ reload <username>      reload configuration from <username>
+ debug <username> ...   turn on debugging (causes lag!)
+ nodebug                turn off debugging
+ help                   display this help
 See
  http://... for full information
 
index f95ff21..8059f00 100644 (file)
@@ -144,6 +144,7 @@ proc_mon gotchanlist {ch nll} {
     foreach nl $nll {
        if {![string compare $nl [irctolower $nick]]} continue
        if {[mon_nick_is $mm(nopresence) $nl]} continue
+       if {[mon_nick_is $mm(ignore) $nl]} continue
        lappend l $nl
     }
     ldebug m$m "$ch names: $l"
@@ -528,6 +529,11 @@ def_ucmd nodebug {
     reporterr "debug disabled by $n"
 }
 
+proc_dset visibledest {
+    regexp {^[^:]*\:[^:]*} $dd(group) dest
+    return $dest
+}
+
 def_ucmd who {
     set r {}
     foreach m [list_objs monitor] {
@@ -536,8 +542,7 @@ def_ucmd who {
     }
     foreach d [list_objs deviceset] {
        upvar #0 deviceset/$d dd
-       regexp {^[^:]*\:[^:]*} $dd(group) dest
-       lappend r "sending $dd(monname) to $dest"
+       lappend r "sending $dd(monname) to [dset_visibledest $d]"
     }
     ucmdr [join $r "\n"] {}
 }
@@ -551,11 +556,34 @@ proc connected {} {
     config_change
 }
 
-proc msg_JOIN {p c chan} { chan_shortly $chan }
+proc warn_pref {n} {
+    set nl [irctolower $n]
+    set l {}
+    foreach m [list_objs monitor] {
+       upvar #0 monitor/$m mm
+       if {![mon_nick_is $mm(prefer) $n]} continue
+       append l $m
+    }
+    foreach d [list_objs deviceset] {
+       upvar #0 deviceset/$d dd
+       if {[lsearch $l $dd(monname)]==-1} continue
+       append l [dset_visibledest $d]
+    }
+    if {[llength $l]} {
+       sendprivmsg $nl "LEDs are watching you: [join $l " "]"
+    }
+}
+
+proc msg_JOIN {p c chan} {
+    prefix_nick
+    set nl [irctolower $n]
+    chan_shortly $chan
+    warn_pref $n
+}
 proc msg_PART {p c chan} { chan_shortly $chan }
 proc msg_KILL {p c user why} { allchans_shortly }
 proc msg_QUIT {p c why} { allchans_shortly }
-proc msg_NICK {p c newnick} { allchans_shortly }
+proc msg_NICK {p c newnick} { allchans_shortly; warn_pref $newnick }
 proc msg_KICK {p c chans users comment} {
     if {[llength $chans] > 1} {
        allchans_shortly