Posted by electronerd Tue 20th Mar 2007 01:20 - Syntax is Diff - 16 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
-
diff --git a/newseen.tcl b/newseen.tcl
-
index 3fc51a5..34e4820 100644
-
--- a/newseen.tcl
-
+++ b/newseen.tcl
-
@@ -5,12 +5,20 @@ set hseen_db [::mysql::connect -host localhost -user $mysqluser -password $mysql
-
set hseen_channel #nerdstar-test
-
-
-
+proc hseen_pingdb { } {
-
+ global hseen_db mysqluser mysqlpass mysqldb
-
+ if { ! [::mysql::ping $hseen_db] } {
-
+ ::mysql::close $hseen_db
-
+ set hseen_db [::mysql::connect -host localhost -user $mysqluser -password $mysqlpass -db $mysqldb]
-
+ }
-
+}
-
+
-
#a little test proc
-
bind PUB - !hseen hseen
-
proc hseen {nick uhost hand chan txt} {
-
global hseen_db
-
#make sure the connection is up
-
- ::mysql::ping $hseen_db
-
+ hseen_pingdb
-
-
#escape what's gonna be put into an SQL statement from the outside
-
set txt [::mysql::escape $hseen_db $txt]
-
@@ -40,7 +48,7 @@ proc hseen:join {nick uhost hand chan} {
-
-
global hseen_db
-
#make sure the server is alive
-
- ::mysql::ping $hseen_db
-
+ hseen_pingdb
-
-
#escape what we're shoving in the query
-
set hand [::mysql::escape $hseen_db $hand]
-
@@ -72,7 +80,7 @@ proc hseen:leave {hand reason} {
-
-
global hseen_db
-
#make sure the connection is alive
-
- ::mysql::ping $hseen_db
-
+ hseen_pingdb
-
-
#escape what's going into the SQL to avoid injection
-
set hand [::mysql::escape $hseen_db $hand]
-
@@ -102,7 +110,7 @@ proc hseen:finishbotjoin {from kw txt} {
-
set nicks [chanlist $hseen_channel]
-
putlog $nicks
-
global hseen_db
-
- ::mysql::ping $hseen_db
-
+ hseen_pingdb
-
-
#set everyone offline
-
::mysql::exec $hseen_db "UPDATE ixc_users
PermaLink to this entry https://pastebin.co.uk/12068
Posted by electronerd Tue 20th Mar 2007 01:20 - Syntax is Diff - 16 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
Comments: 0