Index: openacs-4/packages/chat/tcl/chat-ajax-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-ajax-procs.tcl,v diff -u -N -r1.26 -r1.27 --- openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 20 Nov 2018 17:46:20 -0000 1.26 +++ openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 21 Nov 2018 09:56:37 -0000 1.27 @@ -37,9 +37,15 @@ return [_ chat.Room_not_found] } else { chat_room_get -room_id $chat_id -array c - set package_id $c(context_id) + next \ + -chat_id $chat_id \ + -package_id $c(context_id) \ + -mode $mode \ + -path $path \ + -login_messages_p $c(login_messages_p) \ + -logout_messages_p $c(logout_messages_p) \ + -timewindow $c(messages_time_window) } - next -chat_id $chat_id -package_id $package_id -mode $mode -path $path } Chat instproc initialize_nsvs {} { @@ -60,12 +66,6 @@ ad_return_forbidden ad_script_abort } - if {[chat_room_exists_p ${:chat_id}]} { - chat_room_get -room_id ${:chat_id} -array c - set :login_messages_p $c(login_messages_p) - set :logout_messages_p $c(logout_messages_p) - set :timewindow $c(messages_time_window) - } next } 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 -N -r1.46 -r1.47 --- openacs-4/packages/xowiki/tcl/chat-procs.tcl 20 Nov 2018 18:45:56 -0000 1.46 +++ openacs-4/packages/xowiki/tcl/chat-procs.tcl 21 Nov 2018 09:56:37 -0000 1.47 @@ -403,7 +403,15 @@ return $mode } - ::xo::ChatClass instproc login {-chat_id {-package_id ""} {-mode ""} {-path ""}} { + ::xo::ChatClass instproc login { + -chat_id + {-package_id ""} + {-mode ""} + {-path ""} + -login_messages_p + -logout_messages_p + -timewindow + } { #:log "--chat" if {![ns_conn isconnected]} return auth::require_login @@ -430,8 +438,9 @@ if {[string index $path end] ne "/"} {append path /} if {![info exists chat_id]} {set chat_id $package_id} set session_id [ad_conn session_id].[clock seconds] - set context id=$chat_id&s=$session_id&class=[self] - set base_url ${xowiki_path}chat?${context} + set base_url [export_vars -base ${xowiki_path}chat -no_empty { + {id $chat_id} {s $session_id} {class "[self]"} + }] # This might come in handy to get resources from the chat package # if we want to have e.g. a separate css. @@ -515,11 +524,22 @@ }] - [self] create c1 \ - -destroy_on_cleanup \ - -chat_id $chat_id \ - -session_id $session_id \ - -mode $mode + set chat_cmd [list \ + [self] create c1 \ + -destroy_on_cleanup \ + -chat_id $chat_id \ + -session_id $session_id \ + -mode $mode] + # We don't want to override Chat class default with our own and + # therefore we build the command dynamically depending if these + # variables are there or not. + set optional_vars [list login_messages_p logout_messages_p timewindow] + foreach var $optional_vars { + if {[info exists $var]} { + lappend chat_cmd -${var} [set $var] + } + } + {*}$chat_cmd set data [c1 login] if {$data ne ""} { Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v diff -u -N -r1.233 -r1.234 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 19 Nov 2018 14:32:29 -0000 1.233 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 21 Nov 2018 09:56:37 -0000 1.234 @@ -4665,6 +4665,9 @@ {-chat_id ""} {-mode ""} {-path ""} + -login_messages_p + -logout_messages_p + -timewindow }} } chat instproc render {} { @@ -4673,7 +4676,22 @@ # make the chat just for including page set chat_id [${:__including_page} item_id] } - set r [::xowiki::Chat login -chat_id $chat_id -mode $mode -path $path] + set chat_cmd [list \ + ::xowiki::Chat login \ + -chat_id $chat_id \ + -mode $mode \ + -path $path] + # We don't want to override Chat class default with our own and + # therefore we build the command dynamically depending if these + # variables are there or not. + set optional_vars [list login_messages_p logout_messages_p timewindow] + foreach var $optional_vars { + if {[info exists $var]} { + lappend chat_cmd -${var} [set $var] + } + } + set r [{*}$chat_cmd] + #ns_log notice chat=>$r return $r