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.28 -r1.29 --- openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 21 Nov 2018 12:32:18 -0000 1.28 +++ openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 22 Nov 2018 09:08:33 -0000 1.29 @@ -37,7 +37,13 @@ return [_ chat.Room_not_found] } else { chat_room_get -room_id $chat_id -array c - next -chat_id $chat_id -package_id $c(context_id) -mode $mode -path $path + next -chat_id $chat_id \ + -package_id $c(context_id) \ + -mode $mode \ + -path $path \ + -logout_messages_p $c(logout_messages_p) \ + -login_messages_p $c(login_messages_p) \ + -timewindow $c(messages_time_window) } } @@ -59,12 +65,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.49 -r1.50 --- openacs-4/packages/xowiki/tcl/chat-procs.tcl 21 Nov 2018 12:32:18 -0000 1.49 +++ openacs-4/packages/xowiki/tcl/chat-procs.tcl 22 Nov 2018 09:08:33 -0000 1.50 @@ -19,6 +19,7 @@ {sweepinterval 5} {login_messages_p t} {logout_messages_p t} + {conf {}} } Chat instproc init {} { @@ -48,10 +49,20 @@ if {[:user_id] != 0 || [:session_id] != 0} { :init_user_color } + :set_options } + Chat instproc set_options {} { + dict for {key value} ${:conf} { + ::xo::clusterwide nsv_set ${:array}-options $key $value + } + if {[nsv_array exists ${:array}-options]} { + foreach {key value} [nsv_array get ${:array}-options] { + :set $key $value + } + } + } - Chat instproc register_nsvs {msg_id user_id msg color secs} { # Tell the system we are back again, in case we were auto logged out if { ![nsv_exists ${:array}-login $user_id] } { @@ -408,6 +419,9 @@ {-package_id ""} {-mode ""} {-path ""} + -login_messages_p + -logout_messages_p + -timewindow } { #:log "--chat" if {![ns_conn isconnected]} return @@ -521,11 +535,19 @@ }] + set conf [dict create] + foreach var [list login_messages_p logout_messages_p timewindow] { + if {[info exists $var]} { + dict set conf $var [set $var] + } + } + [self] create c1 \ -destroy_on_cleanup \ -chat_id $chat_id \ -session_id $session_id \ - -mode $mode + -mode $mode \ + -conf $conf 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.235 -r1.236 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 21 Nov 2018 12:32:18 -0000 1.235 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 22 Nov 2018 09:08:33 -0000 1.236 @@ -4665,6 +4665,9 @@ {-chat_id ""} {-mode ""} {-path ""} + -login_messages_p + -logout_messages_p + -timewindow }} } chat instproc render {} { @@ -4673,10 +4676,21 @@ # 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