- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::db::chat_room
::xo::db::chat_room create ...
Defined in
Class Relations
::xo::db::Class create ::xo::db::chat_room \ -superclass ::xo::db::ObjectMethods (to be applied on instances)
ban_user (scripted, public)
<instance of xo::db::chat_room> ban_user -party_id party_idBans specified user from the chat room
- Switches:
- -party_id (required)
- Testcases:
- No testcase defined.
permission::grant -party_id $party_id -object_id ${:room_id} -privilege chat_bancount_messages (scripted, public)
<instance of xo::db::chat_room> count_messagesCount messages currently persisted for this chat room.
- Testcases:
- No testcase defined.
set room_id ${:room_id} ::xo::dc get_value count_messages { select count(*) from chat_msgs where room_id = :room_id }create_transcript (scripted, public)
<instance of xo::db::chat_room> create_transcript \ [ -pretty_name pretty_name ] [ -description description ] \ [ -creation_user creation_user ] [ -creation_ip creation_ip ]Creates a new transcript of all current chat room messages.
- Switches:
- -pretty_name (optional)
- -description (optional)
- -creation_user (optional)
- -creation_ip (optional)
- Returns:
- transcript_id of the new transcript or 0 when no messages were in the chat room.
- Testcases:
- No testcase defined.
if {![info exists pretty_name]} { set today [clock format [clock seconds] -format "%d.%m.%Y"] set pretty_name "#chat.transcript_of_date# $today" } if {![info exists description]} { set description "#chat.automatically_created_transcript#" } if {![info exists creation_user]} { set creation_user ${:creation_user} } set contents [:transcript_messages] if {[llength $contents] > 0} { set t [::xo::db::chat_transcript new -volatile -creation_user $creation_user -creation_ip $creation_ip -pretty_name $pretty_name -description $description -package_id ${:package_id} -room_id ${:room_id} -contents [join $contents \n]] $t save_new return [$t transcript_id] } else { return 0 }delete (scripted, public)
<instance of xo::db::chat_room> delete args [ args... ]Delete the chat room and all of its transcripts
- Parameters:
- args (required)
- Testcases:
- No testcase defined.
set room_id ${:room_id} foreach transcript_id [::xo::dc list get_transcripts { select transcript_id from chat_transcripts where room_id = :room_id }] { ::acs::dc call acs_object delete -object_id $transcript_id } nextdelete_messages (scripted, public)
<instance of xo::db::chat_room> delete_messagesDelete all persisted messages from the chat room.
- Testcases:
- No testcase defined.
set room_id ${:room_id} ::xo::dc dml delete_messages { delete from chat_msgs where room_id = :room_id }flush (scripted, public)
<instance of xo::db::chat_room> flushSave all currently persisted messages for this chat room as a new transcript and then delete them.
- Testcases:
- No testcase defined.
if {${:auto_transcript_p}} { :create_transcript } :delete_messagesgrant_creator (scripted, public)
<instance of xo::db::chat_room> grant_creatorGrants operative privileges to the chat creator (when available on the chat room object). In detail the permissions to edit, view and delete the chat room and also to create transcripts of it.
- Testcases:
- No testcase defined.
if {${:creation_user} ne ""} { foreach privilege {edit view delete} { permission::grant -party_id ${:creation_user} -object_id ${:room_id} -privilege chat_room_${privilege} } permission::grant -party_id ${:creation_user} -object_id ${:room_id} -privilege chat_transcript_create }grant_moderator (scripted, public)
<instance of xo::db::chat_room> grant_moderator \ -party_id party_idMake specified party the chat room moderator
- Switches:
- -party_id (required)
- Testcases:
- No testcase defined.
permission::grant -party_id $party_id -object_id ${:room_id} -privilege chat_room_moderategrant_user (scripted, public)
<instance of xo::db::chat_room> grant_user -party_id party_idGrants operative privileges to the specified party. In detail, the permission to read and write for the chat room.
- Switches:
- -party_id (required)
- Testcases:
- No testcase defined.
::xo::dc transaction { foreach privilege {read write} { permission::grant -party_id $party_id -object_id ${:room_id} -privilege chat_${privilege} } }post_message (scripted, public)
<instance of xo::db::chat_room> post_message [ -msg msg ] \ [ -creation_user creation_user ] [ -creation_ip creation_ip ]Post a message in the chat room. This actually means persisting the message in the database, but only if the chat room is configured to be archived.
- Switches:
- -msg (optional)
- the message
- -creation_user (optional)
- the alleged creation user of the persisted message. Won't be set automatically from the connection
- -creation_ip (optional)
- the alleged creation IP of the persisted message. Won't be set automatically from the connection
- Testcases:
- No testcase defined.
if {!${:archive_p}} { return } set room_id ${:room_id} set message_id [db_nextval acs_object_id_seq] ::xo::dc dml save_message { insert into chat_msgs ( msg_id, room_id, msg, creation_user, creation_ip, creation_date) values ( :message_id, :room_id, :msg, :creation_user, :creation_ip, current_timestamp ) }revoke_moderator (scripted, public)
<instance of xo::db::chat_room> revoke_moderator \ -party_id party_idRevoke moderation rights on the chat room for specified party
- Switches:
- -party_id (required)
- Testcases:
- No testcase defined.
set parties $party_id foreach party_id $parties { permission::revoke -party_id $party_id -object_id ${:room_id} -privilege chat_room_moderate }revoke_user (scripted, public)
<instance of xo::db::chat_room> revoke_user -party_id party_idRevokes operative privileges to the specified party. In detail, the permission to read and write for the chat room.
- Switches:
- -party_id (required)
- Testcases:
- No testcase defined.
::xo::dc transaction { foreach privilege {read write} { permission::revoke -party_id $party_id -object_id ${:room_id} -privilege chat_${privilege} } }save_new (scripted, public)
<instance of xo::db::chat_room> save_new \ [ -creation_user creation_user ] args [ args... ]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.
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_idtranscript_messages (scripted, public)
<instance of xo::db::chat_room> transcript_messagesFormats the current content of a chat room as a list of messages formatted so they can be displayed or stored in the transcript.
- Returns:
- list of formatted messages
- Testcases:
- No testcase defined.
set room_id ${:room_id} set contents [list] ::xo::dc foreach get_archives_messages { select msg, creation_user, to_char(creation_date, 'DD.MM.YYYY hh24:mi:ss') as creation_date from chat_msgs where room_id = :room_id and msg is not null order by creation_date } { if {$creation_user > 0} { set user_name [::chat::Package get_user_name -user_id $creation_user] if {$user_name eq ""} { set user_name Unknown } } else { set user_name "system" } lappend contents "\[$creation_date\] ${user_name}: $msg" } return $contentsunban_user (scripted, public)
<instance of xo::db::chat_room> unban_user -party_id party_idLift ban on specified user from the chat room
- Switches:
- -party_id (required)
- Testcases:
- No testcase defined.
permission::revoke -party_id $party_id -object_id ${:room_id} -privilege chat_banVariables
::xo::db::chat_room set __default_metaclass ::xotcl::Class ::xo::db::chat_room set __default_superclass ::xotcl::Object ::xo::db::chat_room set abstract_p f ::xo::db::chat_room set auto_save false ::xo::db::chat_room array set db_constraints {logout_messages_p \ {{default true}} pretty_name not_null messages_time_window {{default 600}} auto_transcript_p \ {{default false}} auto_flush_p {{default true}} archive_p {{default true}} avatar_p \ {{default true}} login_messages_p {{default true}} active_p {{default true}}} ::xo::db::chat_room array set db_slot \ {logout_messages_p ::xo::db::chat_room::slot::logout_messages_p description \ ::xo::db::chat_room::slot::description pretty_name ::xo::db::chat_room::slot::pretty_name \ messages_time_window ::xo::db::chat_room::slot::messages_time_window auto_transcript_p \ ::xo::db::chat_room::slot::auto_transcript_p auto_flush_p \ ::xo::db::chat_room::slot::auto_flush_p archive_p ::xo::db::chat_room::slot::archive_p \ room_id ::xo::db::chat_room::slot::room_id avatar_p ::xo::db::chat_room::slot::avatar_p \ login_messages_p ::xo::db::chat_room::slot::login_messages_p active_p \ ::xo::db::chat_room::slot::active_p} ::xo::db::chat_room set id_column room_id ::xo::db::chat_room set name_method {} ::xo::db::chat_room set object_type chat_room ::xo::db::chat_room set object_type_key 0000000000110101 ::xo::db::chat_room set pretty_name {#chat.Room#} ::xo::db::chat_room set pretty_plural {#chat.Rooms#} ::xo::db::chat_room set security_inherit_p t ::xo::db::chat_room set sql_package_name ::xo::db::chat_room ::xo::db::chat_room set supertype acs_object ::xo::db::chat_room set table_name chat_rooms ::xo::db::chat_room set with_table true
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables