chiark / gitweb /
Change IRC nick to bnbridge.
[ircbot] / bot.tcl
diff --git a/bot.tcl b/bot.tcl
index 3da92b3f490237dbeb4cad56fe9d8cabc3e03d6f..e021af774f92c1c3ecca647b42331b362427c177 100755 (executable)
--- a/bot.tcl
+++ b/bot.tcl
@@ -376,9 +376,10 @@ proc nick_case {user} {
 }
 
 proc msg_NICK {p c newnick} {
-    global nick_arys nick_case
+    global nick_arys nick_case calling_nick
     prefix_nick
     recordlastseen_n $n "changing nicks to $newnick" 0
+    set calling_nick $newnick
     recordlastseen_n $newnick "changing nicks from $n" 1
     set luser [irctolower $n]
     lnick_marktime_cancel $luser
@@ -421,9 +422,14 @@ proc msg_JOIN {p c chan} {
     lappend nlist $nl
     nick_ishere $n
 }
-proc msg_PART {p c chan} {
+proc msg_PART {p c chan args} {
     prefix_nick
-    recordlastseen_n $n "leaving $chan" 1
+    set msg "leaving $chan"
+    if {[llength $args]} {
+       set why [lindex $args 0]
+       if {"[irctolower $why]" != "[irctolower $n]"} { append msg " ($why)" }
+    }
+    recordlastseen_n $n $msg 1
     process_kickpart $chan $n
 }
 proc msg_QUIT {p c why} {
@@ -1278,7 +1284,7 @@ proc lnick_pingstring {why oc apstring} {
     catch { exec uptime } uptime
     set nnicks [llength [array names nick_onchans]]
     if {[regexp \
- {^ *([0-9:apm]+) +up.*, +(\d+) users, +load average: +([0-9., ]+) *$} \
+ {^ *([0-9:apm]+) +up.*, +(\d+) users?, +load average: +([0-9., ]+) *$} \
             $uptime dummy time users load]} {
        regsub -all , $load {} load
         set uptime "$time  $nnicks/$users  $load"