one of the documented procedures in this installation of the ACS
chat_post_message   db   msg   user_id   chat_room_id
What it does:
Post message to the chat room
Defined in: /web/philip/tcl/chat-defs.tcl

Source code:

    set selection [ns_db 1row $db "
select group_id, moderated_p, scope
from chat_rooms
where chat_room_id = $chat_room_id"]


    set client_ip_address [peeraddr]
    set user_id [ad_verify_and_get_user_id]

    if { $moderated_p == "t" } {
	# If one of the moderators posts a message, we immediately approve it.

	switch $scope {
	    public {
		set moderator [ad_administration_group_member $db chat $chat_room_id $user_id]
	    group {
		set moderator [ad_permission_p $db "" "" "" $user_id $group_id]

	if $moderator {
	    set approved_p t
	} else {
	    set approved_p f

    } else {
	set approved_p t
    if {[empty_string_p $group_id] || [ad_user_group_member $db $group_id $user_id] && ![empty_string_p $msg] } {
	ns_db dml $db "insert into chat_msgs
	    (chat_msg_id, msg, msg_bowdlerized, content_tag, creation_date, creation_user, creation_ip_address, chat_room_id, approved_p)
	    (chat_msg_id_sequence.nextval, '$msg', '[bowdlerize_text $msg]', '[tag_content $msg]', sysdate, $user_id, '$client_ip_address',$chat_room_id, '$approved_p')
	if { $approved_p == "t" } {
	    util_memoize_flush "chat_entire_page $chat_room_id short"
	    util_memoize_flush "chat_entire_page $chat_room_id medium"
	    util_memoize_flush "chat_entire_page $chat_room_id long"
	    util_memoize_flush "chat_js_entire_page $chat_room_id"