other events
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 10 Jun 2002 00:26:18 +0000 (00:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 10 Jun 2002 00:26:18 +0000 (00:26 +0000)
ledmodule.tcl

index 27e08cc..eb1deed 100644 (file)
@@ -41,7 +41,7 @@ source userv.tcl
 
 defset errchan #$nick
 defset retry_after 900000
-defset chan_after 3000
+defset chan_after 1500
 defset chans_retry 3600000
 defset debug_reset_after 86400000
 
@@ -138,8 +138,15 @@ proc mon_nick_is {globlist ln} {
 }
 
 proc_mon gotchanlist {ch nll} {
+    global nick
     if {[lsearch -exact $mm(chans) $ch] == -1} return
-    set mm(present-$ch) $nll
+    set l {}
+    foreach nl $nll {
+       if {![string compare $nl [irctolower $nick]]} continue
+       if {[mon_nick_is $mm(nopresence) $nl]} continue
+       lappend $l $nl
+    }
+    set mm(present-$ch) $l
     mon_updateall $m
 }
 
@@ -437,8 +444,34 @@ proc config_change {} {
     set config_retry_after [after $chans_retry config_change]
 }
 
+proc allchans_shortly {} {
+    global chan_after onchans shortly_alling
+    if {[info exists shortly_alling]} {
+       ldebug {} "global check already pending"
+       return
+    }
+    foreach ch [array names onchans] {
+       manyset $onchans($ch) status after
+       if {"$status" != "shortly"} continue
+       set idle
+    }
+    set shortly_alling [after $chan_after allchans_sendnames]
+}
+
+proc allchans_sendnames {} {
+    global shortly_alling
+    unset shortly_alling
+    ldebug {} "asking for global namelist"
+    sendout NAMES
+}
+
 proc chan_shortly {ch} {
-    global chan_after
+    global chan_after shortly_alling
+    set ch [irctolower $ch]
+    if {[info exists shortly_alling]} {
+       ldebug c$ch "global check already pending"
+       return
+    }
     upvar #0 onchans($ch) oc
     if {[info exists oc]} {
        manyset $oc status after
@@ -454,6 +487,7 @@ proc chan_shortly {ch} {
 proc msg_353 {p c dest type chan nicklist} {
     set lchan [irctolower $chan]
     set nll [irctolower $nicklist]
+    regsub -all {[=@*]} $nll {} nll
     ldebug c$lchan "got names $nll"
     foreach m [list_objs monitor] {
        mon_gotchanlist $m $lchan $nll
@@ -525,8 +559,17 @@ proc connected {} {
     config_change
 }
 
-# JOIN PART
-# KICK KILL QUIT
+proc msg_JOIN {p c chan} { chan_shortly $chan }
+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_KICK {p c chans users comment} {
+    if {[llength $chans] > 1} {
+       allchans_shortly
+    } else {
+       chan_shortly [lindex $chans 0]
+    }
+}
 
 if {[catch {
     loadhelp