Index: chatroom.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/chatroom/Attic/chatroom.module,v
retrieving revision 1.50.2.43
diff -u -p -r1.50.2.43 chatroom.module
--- chatroom.module	23 Feb 2007 19:42:27 -0000	1.50.2.43
+++ chatroom.module	23 Feb 2007 21:39:21 -0000
@@ -1626,9 +1626,13 @@ function chatroom_get_chatroom_list($sta
  * gets a list of online users in a given chat
  * returns the current user at the top of the list
  */
-function chatroom_chat_get_online_list($chat_id, $cache_timestamp = FALSE) {
-  if (!$cache_timestamp) {
-    $cache_timestamp = time();
+function chatroom_chat_get_online_list($chat_id, $cache_timestamp) {
+  // To do: store old timestamps for every cache file.
+  if ($cache_timestamp < time() - 5) { // Use the new timestamp if it's more than five seconds old.
+    variable_set('chatroom_timestamp', $cache_timestamp);
+  }
+  else { // Otherwise use the old timestamp.
+    $cache_timestamp = variable_get('chatroom_timestamp', 0);
   }
   $result = db_query('SELECT     col.uid,
                                  col.session_id,
@@ -1642,7 +1646,7 @@ function chatroom_chat_get_online_list($
                       LEFT JOIN  {users} AS du
                       ON         du.uid = col.uid
                       WHERE      col.ccid = %d
-                      AND        col.modified > (%d - 5)',
+                      AND        col.modified > %d',
                       $chat_id, $cache_timestamp);
   $users = array();
   $session_id = session_id();
