Code: Select all
bind pub - !addinfo pub:addinfo
proc pub:addinfo {nick uhost hand chan text} {
if {[scan $text {%s%s} file url] != 2} {
puthelp "Usage: !addinfo <file> <url>"
return
}
set token [::http::geturl $url]
set content [::http::data $token]
::http::cleanup $content
set fp [open "/home/$file" "w"]
foreach line [split $content \n] {
puts $fp [join $line "\n"]
}
close $fp
}
Code: Select all
[wrong # args: should be "bind type flags cmd/mask ?procname?"]
Code: Select all
bind pubm - "*!addinfo*" pub:addinfo
Code: Select all
Tcl error [pub:addinfo]: could't open socket: host is unreachable (Name or service not known)
Code: Select all
bind pub - !addinfo pub:addinfo
Code: Select all
foreach line [split $content \n] {
puts $fp [join $line "\n"]
}
Code: Select all
puts $fp $content
Code: Select all
package require TclCurl
bind pub - !addinfo pub:addinfo
proc pub:addinfo {nick uhost hand chan text} {
if {[scan $text {%s%s%s} release url filename] != 3} {
puthelp "Usage: !addinfo <release> <url> <filename>"
return
}
exec mkdir "/home/bot/1/filesys/info/$release"
set curlHandle [curl::init]
$curlHandle configure -url $url -file "/home/bot/1/filesys/info/$release/$filename"
$curlHandle perform
}
putlog "Reciever StoreiNfo.tcl - Loaded By Fire-Fox"
Code: Select all
##################
### Mysql path ###
##################
load /usr/lib/tcltk/mysqltcl-3.05/libmysqltcl3.05.so
# define database parameters
set mysql_(user) "USERNAME"
set mysql_(password) "PASSWORD"
set mysql_(host) "localhost"
set mysql_(database) "bots"
set mysql_(table) "TABLE"
if {![info exists mysql_(handle)]} {
set mysql_(handle) [mysqlconnect -host $mysql_(host) -user $mysql_(user) -password $mysql_(password) -db $mysql_(database)]
}
package require TclCurl
bind pub - !addinfo pub:addinfo
proc pub:addnfo {nick uhost hand chan text} {
global mysql_
if {[scan $text {%s%s%s} rlsname url filename] != 3} {
puthelp "Usage: !addinfo <release> <url> <filename>"
return
}
exec mkdir "/home/bot/1/filesys/nfo/$release"
set curlHandle [curl::init]
$curlHandle configure -url $url -file "/home/bot/1/filesys/info/$rlsname/$filename"
$curlHandle perform
#TEST
set infofp [open "/home/bot/1/filesys/info/$release/$filename" "r"]
set rawinfo [read $infofp]
close $infofp
#END
putlog "$rawinfo"
set escapedinfo [mysql::escape $mysql_(handle) $rawinfo]
set nix [mysqlexec $mysql_(handle) "INSERT INTO $mysql_(table) (release,filename,rawinfo) VALUES ( '$release' , '$filename' , '$escapednfo' )"]
}
putlog "Reciever StoreNfoToDB.tcl - Loaded By Fire-Fox"
######################################
### Timer for the mysql connection ###
######################################
if {[timerexists nfo:dbconnection] !=""} { killtimer $dbconnect(dbtimer) }
set dbconnect(dbtimer) [timer 1 info:dbconnection]
proc info:dbconnection {} {
global mysql_ dbconnect
if {[catch {mysqlping $mysql_(handle)}] != 0} {
set mysql_(handle) [mysqlconnect -host $mysql_(host) -user $mysql_(user) -password $mysql_(password) -db $mysql_(database)]
}
if {[set var [timerexists info:dbconnection]] !="" } { killtimer $var }
set dbconnect(dbtimer) [timer 1 info:dbconnection]
}
putlog "Reciever StoreiNfo.tcl - Loaded By Fire-Fox"