[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OpenVerse] Bug in user cancel of a room download




This patch has been implemented :)

Kaos, get a current tarball from me so our code is in sync.. I had to patch
this by hand and it as a real bitch. CVS will be up soon.


On Sat, 15 Jan 2000, you wrote:
> On Sat, 15 Jan 2000 09:14:18 -0500, Ed Lange <elange@mediasoft.net> wrote:
> > To make moving forward and backward between rooms easier in this case,
> > maybe a "Room History" pulldown would help.  Then you could browse
> > through all your previously visited rooms by their title and/or
> > server:port, and jump to them easily.  I'll take a stab at implementing
> > this over the weekend.
> 
> I went and implemented this.  If any room history is available, a "History"
> menu item appears under the Passageways menu.  Under this, is a list of the
> servers you've recently visited.  It currently lists up to 10 servers, but
> this is configurable in the variable MV(room_history.max).  It tries not to
> add duplicates, by comparing host and port information to the existing
> list.  This catches most duplicates, but it can fail in certain cases, such
> as multiple hostnames pointing to the same host.  For example,
> world.openverse.org and us.openverse.org are both the same.
> 
> The History menu also works with the Refresh List function, so you can see
> if any of your recent servers are populated.  Your history is also stored
> in history.txt, so it is available between sessions.  The format of this
> file is the same as passageways.txt (roomname|host:port).
> 
> If my or your mailer mangles the patch file, I've made it available at
> http://justice.loyola.edu/~elange/OpenVerse/history.patch
> 
> To apply this patch, save it to file /tmp/nopush.patch and
> cd /usr/lib
> patch -p0 < /tmp/nopush.patch
> 
> *** org/OpenVerse/lib/Globals.tcl	Sat Jan 15 17:26:03 2000
> --- OpenVerse/lib/Globals.tcl	Sat Jan 15 16:10:51 2000
> ***************
> *** 147,150 ****
> --- 147,156 ----
>   set MV(panel) "Fun"
>   
> + # ------------------------------------
> + # Initialize Room History
> + # ------------------------------------
> + set MV(room_history.file) "$MV(homedir)/history.txt"
> + set MV(room_history.max) 10
> + set MV(room_history.0.host) ""
>   
>   # ------------------------------------------------------------------------
> *** org/OpenVerse/lib/Passage.tcl	Sun Jan  9 14:11:11 2000
> --- OpenVerse/lib/Passage.tcl	Sat Jan 15 16:23:10 2000
> ***************
> *** 48,55 ****
>   		-command "QueryServers 1"
>   
>   	if [file exists "$MV(bookmarks)"] {
> ! 		set MV(pwq.queries) {}
>   		set infile [open "$MV(bookmarks)" r]
> ! 		set server 0
>   		while {[eof $infile] != 1} {
>   			gets $infile input
> --- 48,87 ----
>   		-command "QueryServers 1"
>   
> + 	set MV(pwq.queries) {}
> + 	set server 0
> + 
> + 	# read in the history if it hasn't been done yet
> + 	if { $MV(room_history.0.host) == "" } {
> + 	    ReadHistory
> + 	} 
> + 
> + 	if {$MV(room_history.0.host) != ""} {
> + 	    $MV(passageways_menu).m add cascade -menu \
> + 		    $MV(passageways_menu).m.h -label "History"
> + 	    if !$MV(use_windowmanager_colors) {
> + 		menu $MV(passageways_menu).m.h -bg $MV(colors.pw.bg) \
> + 			-fg $MV(colors.pw.fg) -activeforeground $MV(colors.pw.afg) \
> + 			-activebackground $MV(colors.pw.abg)
> + 	    } else {
> + 		menu $MV(passageways_menu).m.h
> + 	    }
> + 	    for {set c 0} {$c < $MV(room_history.max)} {incr c} {
> + 		if {$MV(room_history.$c.host) != ""} {
> + 		    set MV(pwq.queries) "$server"
> + 		    set MV(pwq.$server.name) "$MV(room_history.$c.name)"
> + 		    set MV(pwq.$server.host) "$MV(room_history.$c.host)"
> + 		    set MV(pwq.$server.port) "$MV(room_history.$c.port)"
> + 		    set MV(pwq.$server.menu) "$MV(passageways_menu).m.h"
> + 		    incr server
> + 		    $MV(passageways_menu).m.h add command -label "$MV(room_history.$c.name)" \
> + 			    -command "ConnectToRoom $MV(room_history.$c.host) $MV(room_history.$c.port)"
> + 		}
> + 	    }
> + 	}
> + 
>   	if [file exists "$MV(bookmarks)"] {
> ! 		# set MV(pwq.queries) {}
>   		set infile [open "$MV(bookmarks)" r]
> ! 		# set server 0
>   		while {[eof $infile] != 1} {
>   			gets $infile input
> *** org/OpenVerse/lib/IOFuncs.tcl	Sat Jan 15 17:26:03 2000
> --- OpenVerse/lib/IOFuncs.tcl	Sat Jan 15 16:56:53 2000
> ***************
> *** 330,333 ****
> --- 330,334 ----
>   	set MV(roomport) $port
>   	set MV(sock) [socket $MV(roomhost) $MV(roomport)]
> + 
>   	fconfigure $MV(sock) -blocking 0
>   	set args [fconfigure $MV(sock) -sockname]
> ***************
> *** 505,508 ****
> --- 506,512 ----
>   			wm title . $rest
>   			set MV(roomname) $rest
> + 
> + 		        # Now that we have the room's name, add to history
> + 		        AddToHistory $MV(roomhost) $MV(roomport) $MV(roomname)
>   		}
>   		"SUB" {
> ***************
> *** 1359,1360 ****
> --- 1363,1451 ----
>   }
>   
> + proc AddToHistory {host port name} {
> +     global MV
> + 
> +     # if the history entry 0 is null, we haven't read them in yet
> +     if { $MV(room_history.0.host) == "" } {
> + 	ReadHistory
> +     }
> + 
> +     set found 0
> + 
> +     # see if its already here
> +     for {set c 0} {$c < $MV(room_history.max)} {incr c} {
> + 	if { $MV(room_history.$c.host) == $host && $MV(room_history.$c.port) == $port } {
> + 	    set found 1
> + 	    
> + 	    # already here in another slot; slide it up
> + 	    for {set c2 $c} {$c2 > 0} {incr c2 -1} {
> + 		set MV(room_history.$c2.name) $MV(room_history.[expr $c2 -1].name)
> + 		set MV(room_history.$c2.host) $MV(room_history.[expr $c2 -1].host)
> + 		set MV(room_history.$c2.port) $MV(room_history.[expr $c2 -1].port)
> + 	    }
> + 	}
> +     }
> + 
> +     if (!$found) {
> + 	# slide the rest down, discard the bottom
> + 	for {set c [expr $MV(room_history.max) -1]} {$c > 0} {incr c -1} {
> + 	    set MV(room_history.$c.name) $MV(room_history.[expr $c -1].name)
> + 	    set MV(room_history.$c.host) $MV(room_history.[expr $c -1].host)
> + 	    set MV(room_history.$c.port) $MV(room_history.[expr $c -1].port)
> + 	}
> +     }
> + 
> +     set MV(room_history.0.name) $name
> +     set MV(room_history.0.host) $host
> +     set MV(room_history.0.port) $port
> +     DumpHistory
> +     DoBookmarks
> + }
> + 
> + proc DumpHistory {} {
> +     global MV
> + 
> +     set outfile [open "$MV(room_history.file)" w]
> +     
> +     for {set c 0} {$c < $MV(room_history.max)} {incr c} {
> + 	DebugIt "room_history.$c: $MV(room_history.$c.host) $MV(room_history.$c.port) $MV(room_history.$c.name)"
> + 
> + 	if { $MV(room_history.$c.host) != "" } {
> + 	    puts $outfile "$MV(room_history.$c.name)|$MV(room_history.$c.host):$MV(room_history.$c.port)"
> + 	}
> +     }
> + 
> +     close $outfile
> + }
> + 
> + proc ReadHistory {} {
> +     global MV
> + 
> +     set cur 0
> + 
> +     if [file exists "$MV(room_history.file)"] {
> + 	set infile [open "$MV(room_history.file)" r]
> + 	while {[eof $infile] != 1} {
> + 	    gets $infile input
> + 	    set bm [split $input "|"]
> + 	    set serv [split [lindex $bm 1] ":"]
> + 	    if {[string first "|" $input] != -1} {
> + 		if { $cur >= $MV(room_history.max) } {
> + 		    return
> + 		}
> + 
> + 		set MV(room_history.$cur.name) "[lindex $bm 0]"
> + 		set MV(room_history.$cur.host) "[lindex $serv 0]"
> + 		set MV(room_history.$cur.port) "[lindex $serv 1]"
> + 
> + 		incr cur
> + 	    }
> + 	}
> +     }
> + 
> +     for {} { $cur < $MV(room_history.max) } {incr cur} {
> + 	set MV(room_history.$cur.name) ""
> + 	set MV(room_history.$cur.host) ""
> + 	set MV(room_history.$cur.port) ""
> +     }
> + }
> 
> ----------------------------------------------------------
> To unsubscribe to the OpenVerse mailing list send a message to
> openverse-request with the following word in the BODY of the message.
> UNSUBSCRIBE
> If you need assistance from a human, email cruise@openverse.org
> ----------------------------------------------------------
-- 
Cruise - 
OpenVerse Visual Chat - http://openverse.org/
----------------------------------------------------------
To unsubscribe to the OpenVerse mailing list send a message to
openverse-request with the following word in the BODY of the message.
UNSUBSCRIBE
If you need assistance from a human, email cruise@openverse.org
----------------------------------------------------------