<#channel> <# users> <description>
example:
#mychannel 3 test channel
when showchans is typed in channel it should return the first channel with greater than 5 users. If the first channel contains less than 5 users, it should move on until it finds one with greater than five. Currently however, it just returns the first channel in the list. oddly though, the part of the script which makes it move on if the line is blank, works. Here is the script.
Code: Select all
proc showchans {nick uhost hand chan arg} {
global sd_setting
set amount 0
if {(![file exists sdchans.txt]) || (![file readable sdchans.txt])} {
putserv "NOTICE $nick :Unable to read from file sdchans.txt."
return
} else {
if {![string equal {} [lindex [split $arg] 0]]} {
set nick [lindex [split $arg] 0]
}
set fd [open sdchans.txt r]
for {set temp 0} {$temp <= 0} {incr temp} {
gets $fd line
if { (![string equal {} $line]) || (![lindex [split $line] 1] > 5) } {
incr amount
putserv "PRIVMSG #spamwatch :[join [lindex [split $line] 0]]"
}
}
}
close $fd
}
bind pub - showchans showchans
putlog "loaded, testing"