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.8 -r1.9 --- openacs-4/packages/chat/www/ajax/chat.tcl 18 Sep 2018 15:08:16 -0000 1.8 +++ openacs-4/packages/chat/www/ajax/chat.tcl 28 Sep 2018 11:44:23 -0000 1.9 @@ -5,10 +5,11 @@ @creation-date Jan 31, 2006 @cvs-id $Id$ } -query { - m - id + m:word + id:integer s - {msg:optional,allhtml ""} + msg:optional,allhtml + {mode ""} } set ban_p [permission::permission_p -object_id $id -privilege "chat_ban"] @@ -17,27 +18,25 @@ ad_script_abort } -set message_output "" -set user_output "" - -::chat::Chat c1 -volatile -chat_id $id -session_id $s - +#ns_log notice "--chat m=$m session_id=$s [clock format [lindex [split $s .] 1] -format %H:%M:%S] mode=$mode" +::chat::Chat create c1 -destroy_on_cleanup -chat_id $id -session_id $s -mode $mode switch -- $m { add_msg { - set message_output [c1 add_msg $msg] + #ns_log notice "--c call c1 $m '$msg'" + ns_return 200 application/json [c1 $m $msg] + ad_script_abort + #ns_log notice "--c add_msg returns '$_'" } - login - get_new - get_all { - set message_output [c1 $m] + get_new { + ns_return 200 application/json [c1 $m] + ad_script_abort } - 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." - } + login - + subscribe - + get_all {set _ [c1 $m]} + default {ns_log error "--c unknown method $m called."} } + +#ns_log notice "--chat.tcl $m: returns '$_'" + +ns_return 200 text/html [subst {$_}]