gustafn
committed
on 09 Apr 06
when choosing the delivery mode, check for the existance of libthread *and* the patch for aolserver to make bgdelivery work (naviserver has … Show more
when choosing the delivery mode, check for the existance of libthread *and* the patch for aolserver to make bgdelivery work (naviserver has this

on default),

Show less

openacs-4/.../xowiki/tcl/chat-procs.tcl (+5 -3)
26 26       }
27 27       append result "<TR><TD class='timestamp'>$timeshort</TD>\
28 28         <TD class='user'>[my encode $creator]</TD>\
29 29         <TD class='message'>[my encode $msg]</TD></TR>\n"
30 30     }
31 31     return $result
32 32   }
33 33
34 34   Chat proc initialize_nsvs {} {;}      ;# noop
35 35
36 36   Chat proc login {-chat_id -package_id -mode} {
37 37     my log "--"
38 38     auth::require_login
39 39     if {![info exists package_id]} {set package_id [ad_conn package_id] }
40 40     if {![info exists chat_id]}    {set chat_id $package_id }
41 41     set context id=$chat_id&s=[ad_conn session_id].[clock seconds]
42 42     set path    [site_node::get_url_from_object_id -object_id $package_id]
43 43    
44 44     if {![info exists mode]} {
45 45       set mode polling
46         if {[info command ::thread::mutex] ne ""} {
47           # we seem to have libthread installed, we can use the background delivery thread
  46       if {[info command ::thread::mutex] ne "" &&
  47           ![catch {ns_conn contentsentlength}]} {
  48         # we seem to have libthread installed, and the patch for obtaining the tcl-stream
  49         # from a connection thread, so we can use the background delivery thread;
48 50         # scripted streaming should work everywhere
49 51         set mode scripted-streaming
50 52         if {[regexp (firefox) [string tolower [ns_set get [ns_conn headers] User-Agent]]]} {
51 53           # for firefox, we could use the nice mode without the spinning load indicator
52 54           set mode streaming
53 55         }
54 56       }
55 57       my log "--mode $mode"
56 58     }
57 59
58 60     switch $mode {
59 61       polling {
60 62         ::xowiki::Page requireJS  "/resources/xowiki/get-http-object.js"
61 63         set jspath packages/xowiki/www/ajax/chat.js
62 64         set login_url ${path}ajax/chat?m=login&$context
63 65         set get_update  "chatSendCmd(\"$path/ajax/chat?m=get_new&$context\",chatReceiver)"
64 66         set get_all     "chatSendCmd(\"$path/ajax/chat?m=get_all&$context\",chatReceiver)"
65 67       }
66 68       streaming {
67 69         set jspath packages/xowiki/www/ajax/streaming-chat.js