xo::db::chat_room instproc save_new (public)

 <instance of xo::db::chat_room[i]> save_new \
    [ -creation_user creation_user ] args [ args... ]

Defined in /var/www/openacs.org/packages/chat/tcl/xotcl-chat-procs.tcl

Create a new chat room and make sure its creator is granted the necessary privileges

Switches:
-creation_user (optional)
Parameters:
args (required)
Returns:
new chat room id

Testcases:
No testcase defined.
Source code:
if {![info exists :context_id]} {
    set :context_id ${:package_id}
}

#
# save_new wants certain object metadata to be supplied
# explicitly to the call. Here we pass them as arguments when
# we detect them as instance variables.
#
set args [list]
foreach var {package_id context_id creation_ip creation_user} {
    if {[info exists :${var}] && "-${var}" ni $args} {
        lappend args -${var} [set :${var}]
    }
}

::xo::dc transaction {
    set room_id [next {*}$args]
    :grant_creator
}

return $room_id
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: