chiark / gitweb /
Bugfixes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 12 Feb 2002 19:58:47 +0000 (19:58 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 12 Feb 2002 19:58:47 +0000 (19:58 +0000)
bot.tcl
irccore.tcl

diff --git a/bot.tcl b/bot.tcl
index 353839714232e556f99b1e0312c46753a809ec83..f05c738b908600196c6cda8f76db504f3ab12007 100755 (executable)
--- a/bot.tcl
+++ b/bot.tcl
@@ -152,6 +152,7 @@ proc tell_event {nl event} {
     # and new msg events are handled by the command procedures, not here.
     global calling_nick
     if {[info exists calling_nick]} { set save $calling_nick }
+puts "[list tell_event $nl $event]"
     switch -exact $event {
        none { }
        talk {
@@ -169,6 +170,8 @@ proc tell_event {nl event} {
        }
     }
     if {[info exists save]} { set calling_nick $save }
+global errorInfo
+puts "[list tell_event $nl $event] $errorInfo"
 }
 
 proc tell_getcstate {} {
@@ -194,6 +197,10 @@ proc tell_getcstate {} {
 }
 
 proc tell_event_core {nl event} {
+    catch_logged { tell_event_core1 $nl $event }
+}
+
+proc tell_event_core1 {nl event} {
     # event is `talk', `act', `ident' or `msgsarrive'
     # When user talks we actually get talk now and act later
     global calling_nick
@@ -201,6 +208,8 @@ proc tell_event_core {nl event} {
     set iml [msgsdb_get $nl inbound]
     if {![llength $iml]} return
 
+    set now [clock seconds]
+    tell_getcstate
     set ago [expr {$now - $telling_when}]
 
     # Now we have the components of a telling state
@@ -240,7 +249,7 @@ proc tell_event_core {nl event} {
     append evstate [string range $stt 0 0]
     append evstate [string range $event 0 0]
 
-    manyset [tell_effective_sec $n] sec secwhen
+    manyset [tell_effective_sec $nl] sec secwhen
     switch -exact $sec {
        insecure { append evstate ii }
        secure { append evstate [expr {$ago<$secwhen ? "sl" : "ss"}] }
@@ -254,7 +263,7 @@ proc tell_event_core {nl event} {
        append evstate u
     }
     
-    manyset [nickdb_set $n tellrel] rel relint relwithin
+    manyset [nickdb_get $nl tellrel] rel relint relwithin
     switch -exact $rel {
        unreliable { append evstate uu }
        remind { append evstate [expr {
@@ -273,7 +282,7 @@ proc tell_event_core {nl event} {
        }
        pm????? {
            # oops, messages passed are now out of date
-           catch { unset telling }
+           catch_restoreei { unset telling }
            return
        }
        ?m????? {
@@ -309,11 +318,11 @@ proc tell_event_core {nl event} {
            set stt passed
        }
        nas?u?? {
-           sendprivmsg $nl {You have messages (so identify yourself please).}]
+           sendprivmsg $nl {You have messages (so identify yourself please).}
            set stt mentioned
        }
        masl??? {
-           sendprivmsg $nl {Don't forget about your messages.}]
+           sendprivmsg $nl {Don't forget about your messages.}
        }
        pi????? {
            return
@@ -327,7 +336,7 @@ proc tell_event_core {nl event} {
        }
     }
     if {![info exists u]} {
-       catch { unset telling }
+       catch_restoreei { unset telling }
     } else {
        set telling [list $u $stt $now]
     }
@@ -1530,7 +1539,8 @@ proc tellme_rel_desc {v} {
     manyset $v rel every within
     switch -exact $rel {
        unreliable {
-           return "As soon as I've told you, I'll forget the message - note that this means messages can get lost !"
+           return "As soon as I've told you message(s), I'll forget them\
+ - note that this means messages can get lost !"
        }
        pester {
            set u {}
@@ -1542,7 +1552,8 @@ proc tellme_rel_desc {v} {
            error "bad tellrel $rel"
        }
     }
-    return "I'll remind you every [showintervalsecs $every 1] until you say delmsg$u."
+    return "After delivering messages, I'll remind you every\
+ [showintervalsecs $every 1] until you say delmsg$u."
 }
 
 def_setting timeformat {
@@ -1746,12 +1757,12 @@ def_ucmd set {
 }
 
 def_ucmd identpass {
-    set username [ta_word]
-    set passmd5 [md5sum "[ta_word]\n"]
-    ta_nomore
     prefix_nick
     check_notonchan
     set luser [irctolower $n]
+    set username [ta_word]
+    set passmd5 [md5sum "[ta_word]\n"]
+    ta_nomore
     upvar #0 nick_onchans($luser) onchans
     if {![info exists onchans] || ![llength $onchans]} {
        ucmdr "You must be on a channel with me to identify yourself." {}
index 22544dff7ecf9bc018828af5de2ad4439f8b7d1d..bdb8c8e7273a17d0c75d9732229602a33dcbd83e 100644 (file)
@@ -212,6 +212,13 @@ proc onread {args} {
     }
 }
 
+proc catch_restoreei {body} {
+    global errorInfo errorCode
+    set l [list $errorInfo $errorCode]
+    catch { uplevel 1 $body }
+    manyset $l errorInfo errorCode
+}
+
 proc catch_logged {body} {
     if {[catch { uplevel 1 $body } emsg]} {
        logerror "error (catch_logged): $emsg"