Index: openacs-4/packages/acs-tcl/tcl/whos-online-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/whos-online-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/acs-tcl/tcl/whos-online-procs.tcl 18 Sep 2018 15:26:54 -0000 1.8 +++ openacs-4/packages/acs-tcl/tcl/whos-online-procs.tcl 18 Sep 2018 15:27:19 -0000 1.9 @@ -26,11 +26,11 @@ } ad_proc -private whos_online::flush {} { - Removing all user_ids from the last_hit (nsv_set) which have a timestamp older than + Removing all user_ids from the last_hit (nsv_set) which have a timestamp older than the number of seconds indicated by the proc whos_online::interval. @author Bjoern Kiesbye -} { +} { array set last_hit [nsv_array get last_hit] set onliners_out [list] set interval 1 @@ -39,11 +39,11 @@ for { set search [array startsearch last_hit] } { [array anymore last_hit $search] } {} { set user [array nextelement last_hit $search] set time $last_hit($user) - if {$time<$oldtime} { - lappend onliners_out $user - } + if {$time<$oldtime} { + lappend onliners_out $user + } } - + array donesearch last_hit $search for { set i 0 } { $i < [llength $onliners_out] } { incr i } { @@ -75,7 +75,7 @@ @author Bjoern Kiesbye } { if { $user_id != 0 } { - nsv_set last_hit $user_id [ns_time] + nsv_set last_hit $user_id [ns_time] if { ![nsv_exists first_hit $user_id] } { nsv_set first_hit $user_id [ns_time] } @@ -111,14 +111,14 @@ } ad_proc -public whos_online::num_users {} { - Get the number of registered users currently online, and not invisible + Get the number of registered users currently online, and not invisible } { # We might want to optimize this, but for now, let's just do it this way: return [llength [whos_online::user_ids]] } ad_proc -public whos_online::num_anonymous {} { - Get the number of anonymous users currently online, and not invisible + Get the number of anonymous users currently online, and not invisible } { # Not implemented yet: number of anonymous users counted by IP + number of invisible users return 0 @@ -127,8 +127,8 @@ ad_proc -public whos_online::user_ids { {-all:boolean} } { - This function returns a list of user_ids from users which have requested a page - from this Server in the last 10 min and aren't set to invisible. + This function returns a list of user_ids from users which have requested a page + from this Server in the last 10 min and aren't set to invisible. @param all Set this flag if you want to include invisible users. @@ -140,36 +140,36 @@ for { set search [array startsearch last_hit] } { [array anymore last_hit $search] } {} { set user_id [array nextelement last_hit $search] - if { $last_hit($user_id) > $oldtime } { + if { $last_hit($user_id) > $oldtime } { # User is online if { $all_p || ![user_invisible_p $user_id] } { # And he's not invisible, or we want all users lappend onliners $user_id - } - } + } + } } - + array donesearch last_hit $search return $onliners } -ad_proc -public whos_online::set_invisible { +ad_proc -public whos_online::set_invisible { user_id } { This procedure sets the user user_id to invisible, - his user_id will not be returned by user_ids. - The invisible state will only last as long as the user is online. + his user_id will not be returned by user_ids. + The invisible state will only last as long as the user is online. @author Bjoern Kiesbye } { nsv_set invisible_users $user_id [ns_time] } -ad_proc -public whos_online::unset_invisible { +ad_proc -public whos_online::unset_invisible { user_id } { - This procedure unsets the invisible state of user_id. + This procedure unsets the invisible state of user_id. @author Bjoern Kiesbye } { @@ -182,7 +182,7 @@ ad_proc -public whos_online::user_invisible_p { user_id } { - This function checks if the user user_id is set + This function checks if the user user_id is set to invisible. Returns a Tcl boolean. @author Bjoern Kiesbye @@ -194,7 +194,7 @@ This function returns a list with all user_ids which are set to invisible @author Bjoern Kiesbye -} { +} { return [nsv_array names invisible_users] }