Index: openacs-4/packages/chat/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-procs.tcl,v diff -u -r1.5.2.3 -r1.5.2.4 --- openacs-4/packages/chat/tcl/chat-procs.tcl 11 Apr 2006 07:12:46 -0000 1.5.2.3 +++ openacs-4/packages/chat/tcl/chat-procs.tcl 11 Apr 2006 11:29:46 -0000 1.5.2.4 @@ -102,6 +102,9 @@ nsv_set chat_room $room_id {} } + ns_log Notice "YY Adding message $msg to chat room $room_id" + ::chat::Chat c1 -volatile -chat_id $room_id -user_id 0 -session_id 0 + c1 add_msg -uid $user_id $msg if [catch {chat_post_message_to_db -creation_user $user_id $room_id $msg} errmsg] { ns_log error "chat_post_message_to_db: error: $errmsg" @@ -324,32 +327,32 @@ message moderator_p } { - Post message to the chat room and broadcast to all applet clients. Only use by HTML client. + Post message to the chat room and broadcast to all applet clients. Used by ajax + html. } { if {$moderator_p == "1" } { set status "approved" } else { set status "pending" } - # do not write messages to the database if the room should not be archived - chat_room_get -room_id $room_id -array room_info - if { $room_info(archive_p) eq "f" } { return } - set default_client [parameter::get -parameter "DefaultClient" -default "ajax"] if {$default_client eq "java"} { set chat_msg "[chat_user_name $user_id]$user_id$room_id$message$status" # Add message to queue. Notify thread responsible for # broadcast message to applets. - nsv_set chat html_message $chat_msg ns_mutex unlock [nsv_get chat new_message] - } else { + } + + # do not write messages to the database if the room should not be archived + chat_room_get -room_id $room_id -array room_info + if { $room_info(archive_p) eq "f" } { return } + + # write message to the database if [catch {chat_post_message_to_db -creation_user $user_id $room_id $message} errmsg] { ns_log error "chat_post_message_to_db: error: $errmsg" } - } }