Index: openacs-4/packages/xowiki/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/chat-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/xowiki/tcl/chat-procs.tcl 9 Apr 2006 17:46:37 -0000 1.8 +++ openacs-4/packages/xowiki/tcl/chat-procs.tcl 17 Aug 2006 01:44:26 -0000 1.9 @@ -17,16 +17,16 @@ set timelong [clock format [$child time]] set timeshort [clock format [$child time] -format {[%H:%M:%S]}] 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 url "/shared/community-member?user%5fid=$user_id" - set creator "$name" + acs_user::get -user_id $user_id -array user + set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}] + set url "/shared/community-member?user%5fid=$user_id" + set creator "$name" } else { - set creator "Nobody" + set creator "Nobody" } append result "$timeshort\ - [my encode $creator]\ - [my encode $msg]\n" + [my encode $creator]\ + [my encode $msg]\n" } return $result } @@ -44,35 +44,36 @@ if {![info exists mode]} { set mode polling if {[info command ::thread::mutex] ne "" && - ![catch {ns_conn contentsentlength}]} { - # we seem to have libthread installed, and the patch for obtaining the tcl-stream - # from a connection thread, so we can use the background delivery thread; - # scripted streaming should work everywhere - set mode scripted-streaming - if {[regexp (firefox) [string tolower [ns_set get [ns_conn headers] User-Agent]]]} { - # for firefox, we could use the nice mode without the spinning load indicator - set mode streaming - } + ![catch {ns_conn contentsentlength}]} { + # we seem to have libthread installed, and the patch for obtaining the tcl-stream + # from a connection thread, so we can use the background delivery thread; + # scripted streaming should work everywhere + set mode scripted-streaming + if {[regexp (firefox) [string tolower [ns_set get [ns_conn headers] User-Agent]]]} { + # for firefox, we could use the nice mode without the spinning load indicator + # currently, streaming mode seems broken with current firefox... + #set mode streaming + } } my log "--mode $mode" } switch $mode { polling { - ::xowiki::Page requireJS "/resources/xowiki/get-http-object.js" - set jspath packages/xowiki/www/ajax/chat.js - set login_url ${path}ajax/chat?m=login&$context - set get_update "chatSendCmd(\"$path/ajax/chat?m=get_new&$context\",chatReceiver)" - set get_all "chatSendCmd(\"$path/ajax/chat?m=get_all&$context\",chatReceiver)" + ::xowiki::Page requireJS "/resources/xowiki/get-http-object.js" + set jspath packages/xowiki/www/ajax/chat.js + set login_url ${path}ajax/chat?m=login&$context + set get_update "chatSendCmd(\"$path/ajax/chat?m=get_new&$context\",chatReceiver)" + set get_all "chatSendCmd(\"$path/ajax/chat?m=get_all&$context\",chatReceiver)" } streaming { - set jspath packages/xowiki/www/ajax/streaming-chat.js - set subscribe_url ${path}ajax/chat?m=subscribe&$context + set jspath packages/xowiki/www/ajax/streaming-chat.js + set subscribe_url ${path}ajax/chat?m=subscribe&$context } scripted-streaming { - append context &mode=scripted - set jspath packages/xowiki/www/ajax/scripted-streaming-chat.js - set subscribe_url ${path}ajax/chat?m=subscribe&$context + append context &mode=scripted + set jspath packages/xowiki/www/ajax/scripted-streaming-chat.js + set subscribe_url ${path}ajax/chat?m=subscribe&$context } } set send_url ${path}ajax/chat?m=add_msg&$context&msg= @@ -82,6 +83,8 @@ } set file [open [acs_root_dir]/$jspath]; set js [read $file]; close $file + my log "--CHAT mode=$mode" + switch $mode { polling {return "\