chiark / gitweb /
Dies if doesn't get a ping. Configs separated.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 14 Dec 2000 16:35:14 +0000 (16:35 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 14 Dec 2000 16:35:14 +0000 (16:35 +0000)
blight.tcl [new file with mode: 0644]
bot.tcl
test.tcl

diff --git a/blight.tcl b/blight.tcl
new file mode 100644 (file)
index 0000000..4825da3
--- /dev/null
@@ -0,0 +1,8 @@
+# Configuration for Blight
+
+set host chiark
+set nick Blight
+set ownfullname "here to Help"
+set ownmailaddr blight@chiark.greenend.org.uk
+
+source bot.tcl
diff --git a/bot.tcl b/bot.tcl
index 55d93c7b3295105cccfd33d34713a716b4ac60d5..5d19dd063f6c6db8fb2f5a33e4f31b7c593250c3 100755 (executable)
--- a/bot.tcl
+++ b/bot.tcl
@@ -1,16 +1,22 @@
-#!/usr/bin/tclsh8.2
+# Core bot code
 
-set host chiark
-set port 6667
-if {![info exists nick]} { set nick Blight }
-if {![info exists ownfullname]} { set ownfullname "here to Help" }
-set ownmailaddr blight@chiark.greenend.org.uk
+proc defset {varname val} {
+    upvar #0 $varname var
+    if {![info exists var]} { set var $val }
+}
+
+# must set host
+defset port 6667
+
+defset nick testbot
+defset ownfullname "testing bot"
+defset ownmailaddr test-irc-bot@example.com
 
-set musthaveping_ms 10000
-set out_maxburst 6
-set out_interval 2100
-set out_lag_lag 5000
-set out_lag_very 25000
+defset musthaveping_ms 10000
+defset out_maxburst 6
+defset out_interval 2100
+defset out_lag_lag 5000
+defset out_lag_very 25000
 
 proc manyset {list args} {
     foreach val $list var $args {
@@ -232,7 +238,10 @@ proc msg_PING {p c s1} {
     global musthaveping_after
     prefix_none
     sendout PONG $s1
-    if {[info exists musthaveping_after]} { after cancel $musthaveping_after] }
+    if {[info exists musthaveping_after]} {
+       after cancel $musthaveping_after
+       unset musthaveping_after
+    }
 }
 
 proc check_nick {n} {
@@ -1234,7 +1243,3 @@ ensure_globalsecret
 ensure_outqueue
 loadhelp
 ensure_connecting
-
-#if {![regexp {tclsh} $argv0]} {
-#    vwait terminate
-#}
index d54d29e21868ad1321cd088e907821fdd38860d0..4db26481335ce364d06b97440396cabe184fc7c8 100644 (file)
--- a/test.tcl
+++ b/test.tcl
@@ -1,2 +1,7 @@
+# Configuration for testbot
+
+set host chiark
 set nick testbot
 set ownfullname confused
+
+source bot.tcl