X-Git-Url: https://git.distorted.org.uk/~mdw/ircbot/blobdiff_plain/892f5a82345005e6847a9443df7ac83088361be1..9d6128b9226b4241a711b64748c3817d9265b5ab:/bridge.tcl diff --git a/bridge.tcl b/bridge.tcl index f0f84f5..8bac56c 100755 --- a/bridge.tcl +++ b/bridge.tcl @@ -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 { @@ -53,11 +53,11 @@ def_bnbot event {l} { global channel errorCode if {[regexp {^1002 JOIN ([^ ]+) \w+} $l dummy n]} { set bnnicks($n) 1 - sendprivmsg $channel "[bnnick_clean $n] has joined $bnchanfn" + 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" + sendprivmsg $channel "[bnnick_clean $n] has left $bnchanfn." } elseif {[regexp {^1004 WHISPER ([^ ]+) \w+ "(.*)"$} $l dummy n text]} { if {[catch { go_usercommand "$botid $n" $bnchanfn $n $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 } } @@ -99,7 +99,7 @@ proc tellall {msg} { proc msg_JOIN {p c chan} { global onchan_nicks prefix_nick - tellall "$n has joined $chan" + tellall "$n has joined $chan." set onchan_nicks($n) 1 } @@ -108,7 +108,7 @@ proc msg_NICK {p c newnick} { prefix_nick kill_nick $n set onchan_nicks($newnick) 1 - tellall "$n has changed nicks to $newnick" + tellall "$n has changed nicks to $newnick." } proc kill_nick {n} { global onchan_nicks; catch { unset onchan_nicks($n) } } @@ -125,7 +125,7 @@ proc msg_KILL {p c user why} { } proc msg_PART {p c chan} { prefix_nick - tellall "$n has left $chan" + tellall "$n has left $chan." kill_nick $n } proc msg_QUIT {p c why} { @@ -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" +}