Index: chatroom.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/chatroom/chatroom.module,v
retrieving revision 1.61.2.1
diff -u -r1.61.2.1 chatroom.module
--- chatroom.module	23 Dec 2008 07:14:03 -0000	1.61.2.1
+++ chatroom.module	9 Jun 2009 22:28:19 -0000
@@ -502,6 +502,7 @@
         '@type' => $form_state['control'],
         '@time' => time(),
       ));
+    watchdog('chatroom', 'POST is ' . print_r($_POST, 1));
   }
 
   // Act on commands
@@ -866,6 +867,10 @@
     $query .= ' LIMIT %d';
     $query_args[] = $chat->old_msg_count;
   }
+
+  // Give third-party modules a chance to modify query.
+  $query = db_rewrite_sql($query, 'cm', 'cmid', array('chatroom_msg' => TRUE));
+
   // Query and process results
   $result = db_query($query, $query_args);
   $messages = array();
@@ -904,7 +909,7 @@
       AND ccid = %d
     ", time(), $chat->ccid, $chat->ccid);
   // Load users
-  $result = db_query("
+  $sql = "
     SELECT
       s.uid,
       u.name,
@@ -914,7 +919,11 @@
     LEFT JOIN {users} u ON u.uid = s.uid
     WHERE col.ccid = %d
     ORDER BY u.name ASC
-  ", $chat->ccid);
+  ";
+
+  $sql = db_rewrite_sql($sql, 'col', 'sid', array('chatroom_online_list' => TRUE));
+  dpm($sql, "rewritten");
+  $result = db_query($sql, $chat->ccid);
   $users = array();
   while ($u = db_fetch_object($result)) {
     if (empty($u->uid)) {
