setudef flag torrent
set torrent_db "tlist.db"
bind pub - !tadd torrent_add
bind pub - !thelp torrent_help
bind pub - !stats torrent_stats
bind pub - !info torrent_info
proc torrent_add {hand uhost nick chan arg} {
global site serv info torrent_db
if {[ischanset $chan "+torrent"]} {
set site [lindex $arg 0]
set serv [lindex $arg 1]
set info [lindex $arg 2]
putserv "PRIVMSG $chan :Adding $site in $torrent_db!"
tadd
}
}
proc torrent_help {hand uhost nick chan arg} {
if {[ischanset $chan "+torrent"]} {
putserv "PRIVMSG $chan :To add a torrent site type: !tadd site <info about what they serv> <signup_info>."
}
}
proc tadd {} {
global torrent_db file site serv info
set file [open $torrent_db a]
puts $file "Site: $site Info: $serv Signup Last Checked: $info"
close $file
}
proc torrent_info {nick uhost hand chan text} {
set torrent_search [open $::torrent_db]
set data [read $torrent_search]
set lines [split $data \n]
while {![eof $torrent_search]} {
lappend lines [gets $torrent_search]
}
close $torrent_search
foreach x $lines { putserv "PRIVMSG $chan :$x" }
}
proc torrent_stats {nick host hand chan text} {
global torrent_db
if {[ischanset $chan "+torrent"]} {
set linecount 0
set input [open $torrent_db r]
set lines [split [read $input] \n]
catch {close $input}
foreach line $lines {
incr linecount
}
puthelp "PRIVMSG $chan :i have toldel of $linecount Torrent sites in my database."
}
}