one of the documented procedures in this installation of the ACS
chat_get_personal_posts   chatter_id
What it does:
Returns HTML fragment of all person-to-person messages between currently connected user and user CHATTER_ID
Defined in: /web/philip/tcl/chat-defs.tcl

Source code:

    set user_id [ad_verify_and_get_user_id]
    set db [ns_db gethandle subquery]

    set order ""
    if {[ad_parameter MostRecentOnTopP chat]} {
	set order "desc"

    set chat_rows ""

    set selection [ns_db select $db "select to_char(creation_date,'HH24:MI:SS') as time, 
 nvl(msg_bowdlerized, msg) as filtered_msg, first_names, creation_user
from chat_msgs, users
where chat_msgs.creation_user = users.user_id
  and ((creation_user = $chatter_id and recipient_user = $user_id) 
       or (creation_user = $user_id and recipient_user = $chatter_id))
order by creation_date $order"]

    while { [ns_db getrow $db $selection]} {

	set filtered_msg [link_urls [ns_quotehtml $filtered_msg]]
	append chat_rows "<a target=newwindow href=/shared/community-member?user_id=$creation_user>$first_names</a> ($time) $filtered_msg\n<br>\n"

    ns_db releasehandle $db
    return $chat_rows