Code: Select all
#################################################################################################
# USAGE: !cfg <cfgname> where <cfgname> is one of ET Q3 Q4, etc.
set mycfgfile "/path/to/my/file.db"
# set this to the valid cfg names to make checking user's input easier
set validcfgnames "ET Q3 Q4"
bind pub - !cfg cfgproc
proc cfgproc {nick uhost hand chan text} {
global mycfgfile validcfgnames
set text [split [string toupper $text]]
if {[lsearch -exact $validcfgnames $text] == -1} {
puthelp "PRIVMSG $nick :Invalid config filename. Valid names are $validcfgnames"
return
}
if {[file exists $mycfgfile]} {
set input [open $mycfgfile r]
set cfgdata "[split [read $input] \n]"
catch {close $mycfgfile}
foreach line $cfgdata {
if {[lindex [split $line /] 3] == "$text"} {
puthelp "PRIVMSG $nick :CFG Match $line"
}
}
} else {
puthelp "PRIVMSG $nick :no cfg file found!"
return
}
}
Code: Select all
set text [split [string toupper $text]]
and
foreach line $cfgdata {
if {[lindex [split $line /] 3] == "$text"} {
puthelp "PRIVMSG $nick :CFG Match $line"
}
}
Code: Select all
set text [string toupper $text]
set text [split $text]
and
foreach line $cfgdata {
set cfgtmp [split $line /];set cfgtmp [string toupper [lindex $cfgtmp 3]]
if {$cgftmp == "$text"} {
puthelp "PRIVMSG $nick :CFG Match $line"
}
}
Code: Select all
foreach line $cfgdata {
set cfgtmp [split $line /];set cfgtmp [string toupper [lindex $cfgtmp 3]]
set cfgnametmp [split $line /];set cfgnametmp [lindex $cfgnametmp 4]]
Code: Select all
#USAGE: !cfg <cfgname> where <cfgname> is one of ET Q3 Q4, etc.
set mycfgfile "/home/zielik/shared/filesrv/xdcc/xdcc.pack"
# set this to the valid cfg names to make checking user's input easier
set validcfgnames "ET Q3 Q4 CS CSS WSW"
bind pub - !cfg cfgproc
proc cfgproc {nick uhost hand chan text} {
global mycfgfile validcfgnames
set text [string toupper $text]
set text [split $text]
if {[lsearch -exact $validcfgnames $text] == -1} {
puthelp "notice $nick :Invalid config filename. Valid names are $validcfgnames"
return
}
if {[file exists $mycfgfile]} {
set input [open $mycfgfile r]
set cfgdata "[split [read $input] \n]"
catch {close $mycfgfile}
foreach line $cfgdata {
set cfgtmp [split $line /];set cfgtmp [string toupper [lindex $cfgtmp 3]]
if {$cfgtmp == $text} {
puthelp "PRIVMSG $nick :CFG Match $line"
} else {
puthelp "notice $nick :no cfg file found!"
}
}
}
}
Code: Select all
1 /home/zielik/filesys/cfg/et/lock.rar cfg_lock.ET 16104
2 /home/zielik/filesys/cfg/et/cfg.d4rkman30.X.04.rar cfg_d4rkman.ET 15365
3 /home/zielik/filesys/cfg/et/Sno0pCFG.rar cfg_sno0p.ET 10465
4 /home/zielik/filesys/cfg/et/nonix.rar cfg_nonix.Q4 5758
Code: Select all
set cfgtmp [split $line /];set cfgtmp [string toupper [lindex $cfgtmp 3]]