Index: openacs-4/packages/chat/www/ajax/chat.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/ajax/Attic/chat.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/chat/www/ajax/chat.tcl 30 Mar 2006 09:15:13 -0000 1.1.2.1 +++ openacs-4/packages/chat/www/ajax/chat.tcl 31 Mar 2006 12:52:49 -0000 1.1.2.2 @@ -11,23 +11,35 @@ {msg ""} } +set message_output "" +set user_output "" + ::chat::Chat c1 -volatile -chat_id $id -session_id $s switch -- $m { add_msg { + # do not allow messages longer than 200 characters if { [string length $msg] > 200 } { set msg [string range $msg 0 200] } - set _ [c1 $m $msg] - - set user_id [ad_conn user_id] - chat_message_post $id $user_id $msg f - - # ns_log notice "--c add_msg returns '$_' -chat_id:$id -session_id:$s msg:$msg m:$m" + # do not insert empty messages, if they managed to get here + if { $msg ne "" } { + set message_output [c1 $m $msg] + set user_id [ad_conn user_id] + chat_message_post $id $user_id $msg f + } } - login - - get_new - - get_all {set _ [c1 $m]} + login - get_new - get_all { + set message_output [c1 $m] + } + get_updates { + set message_output [c1 get_new] + set user_output [c1 get_users] + } + get_users { + c1 encoder noencode + set user_output [c1 get_users] + } default {ns_log error "--c unknown method $m called."} } @@ -39,8 +51,9 @@ #messages .user {margin: 0px 5px; text-align: right; vertical-align: top; font-weight:bold;} #messages .message {vertical-align: top;} #messages .line {margin:0px;} +#users { width: 100%; font-size: 12px; color: #666666; font-family: Trebuchet MS, Lucida Grande, Lucida Sans Unicode, Arial, sans-serif; } +#users .user {text-align: left; vertical-align: top; font-weight:bold; } +#users .timestamp {text-align: right; vertical-align: top; } - -
$_
- +
$message_output
$user_output
" \ No newline at end of file