Index: openacs-4/packages/xotcl-core/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/Attic/chat-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/xotcl-core/tcl/chat-procs.tcl 31 Mar 2006 16:09:15 -0000 1.7 +++ openacs-4/packages/xotcl-core/tcl/chat-procs.tcl 7 Apr 2006 17:01:18 -0000 1.8 @@ -9,7 +9,7 @@ namespace eval ::xo { Class Message -parameter {time user_id msg color} Class Chat -superclass ::xo::OrderedComposite \ - -parameter {chat_id user_id session_id + -parameter {chat_id user_id session_id euid emsg {encoder urlencode} {timewindow 600} {sweepinterval 600} } @@ -39,12 +39,33 @@ if { ![nsv_exists $array-login $user_id] } { nsv_set $array-login $user_id [clock seconds] } - nsv_set $array $msg_id [list $now [clock seconds] $user_id $msg [my user_color $user_id]] nsv_set $array-seen newest $now nsv_set $array-seen last [clock seconds] ;#### PETER? nsv_set $array-last-activity $user_id $now + my check_message $user_id $msg + # ns_log Notice "YY ADDING TO NSV $array $msg_id [list $now [clock seconds] [my euid] [my emsg] [my user_color $user_id]]" + nsv_set $array $msg_id [list $now [clock seconds] [my euid] [my emsg] [my user_color $user_id]] if {$get_new} {my get_new} } + + Chat instproc current_message_valid {} { + if { [my exists euid] && [my set euid] == -1 } { + return 0 + } + return 1 + } + + Chat instproc check_message { user_id msg } { + set msg [ad_quotehtml $msg] + my set emsg $msg + my set euid $user_id + # if { [regexp {} $msg] } { + # ns_log Notice "YY Message ($msg) contains html!" + # my set emsg "[_ xotcl-core.html_is_not_allowed], [my user_name $user_id]" + # my set euid -1 + # } + } + Chat instproc active_user_list {} { nsv_array get [my set array]-login } @@ -176,18 +197,23 @@ return [nsv_get $array-color $user_id] } + Chat instproc user_name { user_id } { + acs_user::get -user_id $user_id -array user + return [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}] + } + Chat instproc user_link { -user_id -color } { if {$user_id > 0} { - acs_user::get -user_id $user_id -array user - set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}] - #set name [chat_user_name $user_id] + set name [my user_name $user_id] set url "/shared/community-member?user%5fid=$user_id" if {![info exists color]} { set color [my user_color $user_id] } set creator "$name" - } else { + } elseif { $user_id == 0 } { set creator "Nobody" + } else { + set creator "System" } return [my encode $creator] }