I loaded it and tried it, but it only lists global flags when it should list channel flags, and I cant see why.
heres the code:
Code: Select all
#---------------------------------------------------------------------
# chanxs.tcl
#
# Tcl script for IRC bot eggdrop.
# Usage: !chanxs
# Displays the access levels to the channel of all users in the
# userlist.
#
# v0: 25-Oct-2002
#---------------------------------------------------------------------
package require eggdrop 1.6
package require Tcl 8.0
bind PUB m|m !chanxs showchanusers
proc showchanusers { nick uhost hand chan text } {
# the flaglist in order of importance!
set flaglist {n m o f v}
# flagnames are used when outputting the results.
set flagname(n) owner
set flagname(m) master
set flagname(o) operator
set flagname(f) friend
set flagname(v) voice
# review all users in the userlist
foreach user [userlist] {
foreach flag $flaglist {
# check if user has global or channel access.
if {[matchattr $user $flag $chan]} {
# check if the user is on the channel
set usernick [hand2nick $user $chan]
if { $usernick != "" && $usernick != $user } {
set user "$user (aka $usernick)"
}
lappend userswithflag($flag) $user
break
}
}
}
# any results?
if { ![array exists userswithflag] } {
puthelp "PRIVMSG $chan :\002userlist\002: no results."
return 1
}
# output header
set line "([ctime [unixtime]]) userlist results for $chan:"
puthelp "PRIVMSG $chan :\002$line\002"
# output all results.
foreach flag $flaglist {
if {![info exists userswithflag($flag)]} { continue }
# a flagname was set?
if { ![info exists flagname($flag)] } {
set flagname($flag) "Flag $flag"
}
# join the list to a string
set list $userswithflag($flag)
set list [lsort -ascii -increasing $list]
set line [join $list ", "]
# limit the string length.
if {[string length $line] > 300 } {
set line "[string range $line 0 300] ..."
}
puthelp "PRIVMSG $chan :\002$flagname($flag)\002: $line"
}
# output footer.
set line "End of userlist results for $chan."
puthelp "PRIVMSG $chan :\002$line\002"
# log the request.
return 1
}
putlog "Userlist version 0 loaded."