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.54.2.26 -r1.54.2.27 --- openacs-4/packages/xowiki/tcl/chat-procs.tcl 13 Mar 2023 12:03:23 -0000 1.54.2.26 +++ openacs-4/packages/xowiki/tcl/chat-procs.tcl 13 Mar 2023 14:04:37 -0000 1.54.2.27 @@ -41,6 +41,12 @@ set :now [clock clicks -milliseconds] if {![info exists :user_id]} { + # + # Chat may be instantiated outside xowiki, where ::xo::cc is + # assumed to exist. + # + ::xo::ConnectionContext require -url [ad_conn url] + set :user_id [ad_conn user_id] set :requestor [::xo::cc requestor] if {${:user_id} == 0} { @@ -92,6 +98,9 @@ if {![nsv_exists ${:array}-color idx]} { ::acs::clusterwide nsv_set ${:array}-color idx 0 } + if {![nsv_array exists ${:array}-anonymous_ids]} { + ::acs::clusterwide nsv_set ${:array}-anonymous_ids . . + } if {${:user_id} != 0 || [:session_id] != 0} { :init_user_color } @@ -286,13 +295,6 @@ Chat instproc login {} { :log "--chat login mode=${:mode}" if {${:login_messages_p} && ![:user_active ${:user_id}]} { - if {![nsv_array exists ${:array}-anonymous_ids]} { - # - # Create array in case it does not exist, since we need it in - # the next command. - # - ::acs::clusterwide nsv_set ${:array}-anonymous_ids . . - } :add_msg -uid ${:user_id} -get_new false [_ xotcl-core.has_entered_the_room] } elseif {${:user_id} > 0 && ![nsv_exists ${:array}-login ${:user_id}]} { # give some proof of our presence to the chat system when we @@ -666,7 +668,6 @@
- }] set conf [dict create] @@ -684,6 +685,10 @@ -conf $conf #:log "--CHAT created c1 with mode=$mode" + append html [subst { + + }] + set js "" set data [c1 login] if {$data ne ""} {