chiark / gitweb /
rename .cvsignore to .gitignore
[ircbot.git] / bridge.tcl
index 1282aed7e918eda4bb172e622fdae4c067373f33..8bac56c6e218cf287175ef076e1aa084398a6c3e 100755 (executable)
@@ -14,7 +14,7 @@ proc privmsg_unlogged {p ischan params} {
        if {[catch {
            prefix_nick
            set text [lindex $params 1]
-           if {"$line_org_endchar" == "\001"} {
+           if {![string compare $line_org_endchar "\001"]} {
                if {[regexp {^\?ACTION (.*)\?$} $text dummy text]} {
                    set towrite "* $n $text"
                } else {
@@ -55,7 +55,7 @@ def_bnbot event {l} {
        set bnnicks($n) 1
        sendprivmsg $channel "[bnnick_clean $n] has joined $bnchanfn."
     } elseif {[regexp {^1003 LEAVE ([^ ]+) \w+$} $l dummy n]} {
-       if {"$n" == "$bnnick"} return
+       if {![ircnick_compare $n $bnnick]} return
        catch { unset bnnicks($n) }
        sendprivmsg $channel "[bnnick_clean $n] has left $bnchanfn."
     } elseif {[regexp {^1004 WHISPER ([^ ]+) \w+ "(.*)"$} $l dummy n text]} {
@@ -74,7 +74,7 @@ def_bnbot event {l} {
            foreach m $pub_msgs { bnbot_writemsg $botid "$n $m" }
        }
     } elseif {[regexp {^1001 USER ([^ ]+) \w+} $l dummy n]} {
-       if {"$n" == "$bnnick"} return
+       if {![ircnick_compare $n $bnnick]} return
        set bnnicks($n) 1
     }
 }
@@ -86,7 +86,7 @@ proc msg_353 {p c dest type chan nicklist} {
     catch { unset onchan_nicks }
     foreach n $nicklist {
        regsub {^[@+]} $n {} n
-       if {"$n" == "$nick"} continue
+       if {![ircnick_compare $n $nick]} continue
        set onchan_nicks($n) 1
     }
 }
@@ -152,6 +152,10 @@ def_ucmd who {
     return [list $o]
 }
 
-loadhelp
-ensure_connecting
-foreach botid $bots { bnbot_ensure_connecting $botid }
+if {[catch {
+    loadhelp
+    ensure_connecting
+    foreach botid $bots { bnbot_ensure_connecting $botid }
+} emsg]} {
+    fail "startup: $emsg"
+}