View Full Version : [ITCL] - groupinfo
groupfile
slots 5 2
users 3
can i get the info in itcl script of users(names/uids) in group and wich of them have leech/ratio ? or maybe how many leech slots are free?
if how?
neoxed
11-11-2004, 05:12 PM
proc GetUserList {} {
set UserList ""
foreach UserID [user list] {lappend UserList [resolve uid $UserID]}
return [lsort -ascii $UserList]
}
proc GetGroupList {} {
set GroupList ""
foreach GroupID [group list] {lappend GroupList [resolve gid $GroupID]}
return [lsort -ascii $GroupList]
}
proc GetGroupUsers {GroupID} {
set UserList ""
foreach UserName [GetUserList] {
if {[userfile open $UserName] != 0} {continue}
set UserFile [userfile bin2ascii]
if {[regexp -nocase {groups ([\s\d]+)} $UserFile Result GIDList]} {
if {[lsearch -exact $GIDList $GroupID] != -1} {lappend UserList $UserName}
}
}
return $UserList
}
These functions return a list of users, groups and users in the specified group, respectively. If you want to find out a users ratio, you'll have to use ioFTPD's 'userfile' command to read their user file.
## This will create a list of user names with a ratio of 0 in section 0 in the STAFF group
set LeechUsers ""
set GroupUsers [GetGroupUsers [resolve group "STAFF"]]
foreach UserName $GroupUsers {
if {[userfile open $UserName] == 0} {
set UserFile [userfile bin2ascii]
foreach UserLine [split $UserFile "\n"] {
if {[string equal -nocase "ratio" [lindex $UserLine 0]]} {
## Append the user to the leech list if they have a ratio of 0 in section 0
if {[lindex $UserLine 1] == 0} {lappend LeechUsers $UserName}
break
}
}
}
tnx
if {[regexp -nocase {groups((sd+)+)} $UserFile Result GIDList]} {
whats this 'groups((sd+)+)'
neoxed
11-12-2004, 05:30 AM
Hmm, it appears the [PHP] vB tag removed the backslashes. I've corrected my previous post (using the [CODE] tag instead).
vBulletin® v3.8.11 Alpha 3, Copyright ©2000-2025, vBulletin Solutions, Inc.