Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bncuserlist.tcl - Nice /sbnc who
Author Message
Kunsi Offline
Bastard Operator from Hell
*******

Posts: 68
Joined: May 2010
Reputation: 0
Post: #1
bncuserlist.tcl - Nice /sbnc who
Quote:17:04:25 <sBNC> bncuserlist
17:04:25 <-sBNC> Bouncer-Userlist (20/68 online):
17:04:25 <-sBNC> 1 User(s) on irc.euirc.net via 188.40.68.103:
17:04:25 <-sBNC> @* sBNC ( sbnc) - 10 seconds
17:04:25 <-sBNC> ---
17:04:25 <-sBNC> 1 User(s) on irc.iz-smart.net via default vHost:
17:04:25 <-sBNC> Pac-Man ( pacman) - 18 hours 14 minutes 4 seconds
17:04:25 <-sBNC> ---
17:04:25 <-sBNC> 2 User(s) on irc.quakenet.org via 188.40.68.103:
17:04:25 <-sBNC> Pac-Man ( paci) - 18 hours 14 minutes 4 seconds
17:04:25 <-sBNC> sBNCBoard ( board) - 6 days 2 hours 21 minutes 56 seconds
17:04:25 <-sBNC> ---
17:04:25 <-sBNC> End of List

Code:
internalbind command sbnc_bncuserlist
proc sbnc_bncuserlist {client params} {
    set params [split $params]
        
    if {[getbncuser $client admin] && [string tolower [lindex $params 0]] == "bncuserlist"} {
        set admins [list]
        set other [list]
        set sus_other [list]
        set online 0
        array set networks {}
        
        set ctx [getctx]
        
        foreach ident [bncuserlist] {
            setctx $ident
            
            if {[getbncuser $ident hasclient]} {
                incr online
                
                if {[getbncuser $ident admin]} {
                    set stats "@* "
                } elseif {[getbncuser $ident lock]} {
                    set stats " *!"
                } else {
                    set stats " * "
                }
            } elseif {[getbncuser $ident admin]} {
                if {[getbncuser $ident lock]} {
                    set stats "@ !"
                } else {
                    set stats "@  "
                }
            } elseif {[getbncuser $ident lock]} {
                set stats "  !"
            } else {
                set stats "   "
            }

            set server [getbncuser $ident server]
            set vhost [getbncuser $ident vhost]
            set seen [getbncuser $ident seen]
            
            if {$vhost == ""} {
                set vhost "default vHost"
            }
            
            if {$seen == 0} {
                set seen "Never"
            } elseif {[getbncuser $ident hasclient] == 1} {
                set seen "Online from [getbncuser $ident client]"
            } else {
                set seen [duration [expr {[unixtime] - [getbncuser $ident seen]}]]
            }
            
            if {$server == ""} {
                lappend other [format "% 3s % -20s (% 10s) - %s" $stats $::botnick $ident $seen]
            } else {
                set server "$server via $vhost"
                if {![info exists networks($server)]} {
                    set networks($server) [list [format "% 3s % -20s (% 10s) - %s" $stats $::botnick $ident $seen]]
                } else {
                    lappend networks($server) [format "% 3s % -20s (% 10s) - %s" $stats $::botnick $ident $seen]
                }
            }
        }
        
        setctx $ctx
        
        bncreply "Bouncer-Userlist ($online/[llength [bncuserlist]] online):"
        foreach name [lsort -dictionary [array names networks]] {
            bncreply "[llength $networks($name)] User(s) on $name:"
            foreach x $networks($name) {
                bncreply $x
            }
            bncreply "---"
        }
        if {[llength $other] > 0} {
            bncreply "[llength $other] User(s) with no server set:"
            foreach x $other {
                bncreply $x
            }
            bncreply "---"
        }
        bncreply "End of List"
        haltoutput
        return
    }
}
(This post was last modified: 15.08.2010 09:59 by Kunsi.)
24.07.2010 16:05
kunsi1990 Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


Contact Us | shroudBNC Home | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication