Re: Active user display bug?

Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Mon, 27 Mar 1995 12:56:03 +0200

Hi!

On Sat, 25 Mar 1995 11:58:40 -0800 (PST),
Marc Lewis <marc@blarg.com> said:

Marc> Is there a way to get an active users display to "come back"
Marc> after shutting down a view and reloading it? I've tried
Marc> assigning addresses, names, etc to the text object manually,
Marc> but to no avail.

The active users script used a text object to list the user
names. This was a bad idea as it turns out to cause problems: If
someone moves a node, the text showing the user list will stay on its
position on the map which can cause confusion. Restarts do not work
with the usual mechanism, as the text object has no IP address
attribute (which was your problem).

I changed the active users script to write the user list into the
`active users' attribute of the node object. This solves the problems,
although it may not look as nice if you have lots of users on one
machine. Below is the patch for ip_monitor.tcl.

Juergen

*** ../../scotty-1.2.4/tkined/ip_monitor.tcl Mon Feb 27 18:30:11 1995
--- ip_monitor.tcl Mon Mar 27 12:34:44 1995
***************
*** 791,803 ****
tcp close $f

set txt ""
! if {[info exists users]} {
! foreach user [array names users] {
! lappend txt "$user/$users($user)"
! }
}

! ined -noupdate text $id [join $txt "\\n"]
}
}

--- 791,804 ----
tcp close $f

set txt ""
! foreach user [array names users] {
! lappend txt "$user/$users($user)"
! }
! if {$txt == ""} {
! set txt "no users"
}

! ined -noupdate attribute $id "active users" $txt
}
}

***************
*** 813,822 ****
if {[catch {tcp connect $ip finger} f]} continue
tcp close $f

! set size [ined -noupdate size $id]
! set dx [expr {([lindex $size 2] - [lindex $size 0]) / 2 + 5}]
! set dy [expr {([lindex $size 3] - [lindex $size 1]) / -2}]
! set id [CloneNode $id [ined create TEXT ""] $dx $dy]

set users_ip($id) $ip

--- 814,821 ----
if {[catch {tcp connect $ip finger} f]} continue
tcp close $f

! ined -noupdate attribute $id "active users" "no users"
! ined label $id "active users"

set users_ip($id) $ip

***************
*** 933,939 ****
""
"Active Users:"
" Display the number of active users as reported by the finger"
! " daemon in a text object."
""
"Monitor Job Info:"
" This command display information about all monitoring jobs"
--- 932,940 ----
""
"Active Users:"
" Display the number of active users as reported by the finger"
! " daemon in the 'active users' attribute. Note, there might be"
! " active users that are not displayed because finger output"
! " is quite untrustworthy."
""
"Monitor Job Info:"
" This command display information about all monitoring jobs"