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

[OpenVerse] Updated Text Chat Plugin



Here is a little extra ( to the room name and user count), displays the
users in the current room and when you double click on their name, it
sends a whois. Here it is if anyone wants it:

#
# Roomname and user count for a room in text chat
# -JACK-
#
# Updated: added user name list and a whois on a double click on the name
#
RegisterPlugin ChatExtra ProcessInput.pre CE_Init

global CE
global MV
set CE(u_count) 0
set CE(r_name) $MV(roomname)
set CE(names) ""


proc CE_Init { what cmd parms rest } {
	global CE
	global MV
	set CE(r_name) $MV(roomname)
	
	if {[winfo exists .chat] && ![winfo exist .chat.ce]} {
	frame .chat.ce
	pack .chat.ce 
	label .chat.ce.room -text "Roomname: $CE(r_name)"  -width 80
-relief sunken
	label .chat.ce.u -text "Users: $CE(u_count)" -relief sunken
	pack .chat.ce.room -side left  
	pack .chat.ce.u -side right 
	}
 
	if {[string compare $cmd "NEW"] == 0} {
		incr CE(u_count)

		# add the name to the list
                set tmp [split $parms " "]
                lappend CE(names) [lindex $tmp 0]
		CE_DoUsers

		if {[winfo exists .chat.ce]} {destroy .chat.ce} else
{return 1}
		if {[winfo exists .chat]} {
		frame .chat.ce
		pack .chat.ce
		label .chat.ce.room -text "Roomname: $CE(r_name)" -width
76 -relief sunken
		label .chat.ce.u -text "Users: $CE(u_count)" -relief
sunken
		pack .chat.ce.room -side left -fill both
		pack .chat.ce.u -side right -fill both
		} else {return 1}
	}
	if {[string compare $cmd "NOMORE"] == 0} {
		set CE(u_count) [expr $CE(u_count) - 1]
	
                # remove from the name list
                set where [lsearch $CE(names) $parms]
                set CE(names) [lreplace $CE(names) $where $where]
        	CE_DoUsers      
	
		if {[winfo exists .chat.ce]} {destroy .chat.ce} else
{return 1}
		if {[winfo exists .chat]} {
		frame .chat.ce
		pack .chat.ce -side top
		label .chat.ce.room -text "Roomname: $CE(r_name)" -width
76 -relief sunken
		label .chat.ce.u -text "Users: $CE(u_count)" -relief
sunken
		pack .chat.ce.room -side left -fill both
		pack .chat.ce.u -side right -fill both
		} else {return 1}
	}
	if {[string compare $cmd "ROOMNAME"] == 0} {
		set CE(names) ""
		CE_DoUsers
		set CE(r_name) "$parms"
		set CE(u_count) 0
		destroy .chat.ce.room
		if {[winfo exists .chat.ce]} {destroy .chat.ce} else
{return 1}
		if {[winfo exists .chat]} {
		frame .chat.ce
		pack .chat.ce -side top
		label .chat.ce.room -text "Roomname: $CE(r_name)" -width
76 -relief sunken
		label .chat.ce.u -text "Users: $CE(u_count)" -relief
sunken
		pack .chat.ce.room -side left -fill both
		pack .chat.ce.u -side right -fill both
		} else {return 1}
	} 
	return 1
}

proc CE_DoUsers {} {
	global CE
	if {[winfo exists .chat]} {
	if {[winfo exists .chat.chat.names]} { destroy .chat.chat.names}
	frame .chat.chat.names -relief sunken
	pack .chat.chat.names -side right -fill y
	label .chat.chat.names.l -text "OV USERS:"  
	listbox .chat.chat.names.list -yscroll ".chat.chat.names.scroll
set" -relief sunken -background white -width 13
	scrollbar .chat.chat.names.scroll -command ".chat.chat.names.list
yview" 
	pack .chat.chat.names.l 
	pack .chat.chat.names.list -side left -fill y
	pack .chat.chat.names.scroll -side right -fill y
		
	bind .chat.chat.names.list <Double-1> { CE_HandleName}
	
	foreach name $CE(names) {
		.chat.chat.names.list insert end $name
	} 
	
	}
}

proc CE_HandleName {} {
	set name [selection get]
	
	# whois
	SendToServer "WHOIS $name"
}

Make a directory in your plugins directory (like "ChatExtra") and add this
file to it and name it PlugInit.tcl...

I'm gearing towards to making the text chat a "separate client", so you
can just use it to chat and not have to depend on the graphic screen. Even
tho OV is advertized as a visual chat program, i still like to just use
the text chat.

Also this looks better if you make the .chat.chat.text -background white,
and the entry for text chat -background white too. The stale grey seems
kinda blah, tho some say white is the same, but hey....

laters,
Jack
-------------------------------------------------------

-- 
Cruise - 
OpenVerse Visual Chat - http://openverse.org/
-----------------------------------------------------------------
To unsubscribe to the OpenVerse mailing list send a message
to openverse-request@openverse.org with the following word
in the BODY of the message.

UNSUBSCRIBE

If you need assistance from a human, email cruise@openverse.org
-----------------------------------------------------------------