diff -up ../chatroom.old/chatroom.info ./chatroom.info
--- ../chatroom.old/chatroom.info	2007-10-12 15:10:02.000000000 +0200
+++ ./chatroom.info	2008-05-14 15:31:17.000000000 +0200
@@ -1,9 +1,4 @@
-; $Id: chatroom.info,v 1.1.2.4 2007/06/28 12:09:20 darrenoh Exp $
+; $Id$
 name = Chat Room
 description = Enables the creation of rooms that provide access to chats and chat archives.
-
-; Information added by drupal.org packaging script on 2007-10-12
-version = "5.x-1.9"
-project = "chatroom"
-datestamp = "1192194602"
-
+core = 6.x
diff -up ../chatroom.old/chatroom.module ./chatroom.module
--- ../chatroom.old/chatroom.module	2007-10-05 21:37:34.000000000 +0200
+++ ./chatroom.module	2008-05-14 15:29:05.000000000 +0200
@@ -41,40 +41,36 @@ function chatroom_perm() {
 /**
  * Implementation of hook_menu().
  */
-function chatroom_menu($may_cache) {
-  $items = array();
-  $items[] = array(
-    'path' => 'admin/settings/chatroom',
-    'callback' => 'drupal_get_form',
-    'callback arguments' => array('chatroom_admin_settings'),
-    'title' => t('Chat room'),
-    'description' => t('Configure chat rooms.'),
-    'access' => user_access('administer chat rooms')
-  );
-  $items[] = array(
-    'path' => 'chatrooms',
-    'callback' => 'chatroom_page',
-    'access' => user_access('access chat rooms'),
-    'title' => t('Chat rooms'),
-    'type' => MENU_SUGGESTED_ITEM
-  );
-  $items[] = array(
-    'path' => 'chatrooms/kicked',
-    'callback' => 'chatroom_chat_kicked_user',
-    'access' => user_access('access chat rooms'),
-    'type' => MENU_CALLBACK
-  );
-  $items[] = array(
-    'path' => 'chatrooms/chat',
-    'callback' => 'chatroom_chat',
-    'access' => user_access('access chat rooms'),
-    'type' => MENU_CALLBACK
-  );
-  $items[] = array(
-    'path' => 'chatrooms/archives',
-    'callback' => 'chatroom_chat_archive',
-    'access' => user_access('access chat rooms'),
-    'type' => MENU_CALLBACK
+function chatroom_menu() {
+  $items['admin/settings/chatroom'] = array(
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('chatroom_admin_settings'),
+    'title' => 'Chat room',
+    'access arguments' => array('administer chat rooms'),
+  );
+  $items['chatrooms'] = array(
+    'title' => 'Chat rooms',
+    'page callback' => 'chatroom_page',
+    'access arguments' => array('access chat rooms'),
+    'type' => MENU_SUGGESTED_ITEM,
+  );
+  $items['chatrooms/kicked'] = array(
+    'page callback' => 'chatroom_chat_kicked_user',
+    'page arguments' => array(2),
+    'access arguments' => array('access chat rooms'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['chatrooms/chat'] = array(
+    'page callback' => 'chatroom_chat',
+    'page arguments' => array(2),
+    'access arguments' => array('access chat rooms'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['chatrooms/archives'] = array(
+    'page callback' => 'chatroom_chat_archive',
+    'page arguments' => array(2),
+    'access arguments' => array('access chat rooms'),
+    'type' => MENU_CALLBACK,
   );
   return $items;
 }
@@ -167,13 +163,13 @@ function chatroom_admin_settings() {
   $form['chatroom_alerts']['chatroom_message_alert_upload'] = array(
     '#type' => 'file',
     '#title' => t('Custom new message sound'),
-    '#description' => isset($js['messageSound']) ? t('Replace the custom new message sound with a new MP3. !Listen to current file.', array('!Listen' => l(t('Listen'), $js['messageSound'], array('id' => 'sound_message')))) : t('Replace the default new message sound with your own MP3.'),
+    '#description' => isset($js['messageSound']) ? t('Replace the custom new message sound with a new MP3. !Listen to current file.', array('!Listen' => l(t('Listen'), $js['messageSound'], array('attributes' => array('id' => 'sound_message'))))) : t('Replace the default new message sound with your own MP3.'),
     '#size' => 30,
   );
   $form['chatroom_alerts']['chatroom_user_alert_upload'] = array(
     '#type' => 'file',
     '#title' => t('Custom new user sound'),
-    '#description' => isset($js['userSound']) ? t('Replace the custom new user sound with a new MP3. !Listen to current file.', array('!Listen' => l(t('Listen'), $js['userSound'], array('id' => 'sound_user')))) : t('Replace the default new user sound with your own MP3.'),
+    '#description' => isset($js['userSound']) ? t('Replace the custom new user sound with a new MP3. !Listen to current file.', array('!Listen' => l(t('Listen'), $js['userSound'], array('attributes' => array('id' => 'sound_user'))))) : t('Replace the default new user sound with your own MP3.'),
     '#size' => 30,
   );
   if (!empty($js)) {
@@ -189,7 +185,8 @@ function chatroom_admin_settings() {
   return system_settings_form($form);
 }
 
-function chatroom_admin_settings_validate($form_id, $form_values) {
+//function chatroom_admin_settings_validate($form_id, $form_values) {
+function chatroom_admin_settings_validate($form, &$form_state) {
   $path = file_directory_path();
   if (file_check_directory($path, FILE_CREATE_DIRECTORY)) {
     $path .= '/chatroom';
@@ -208,7 +205,7 @@ function chatroom_admin_settings_validat
   }
 }
 
-function chatroom_admin_settings_submit($form_id, $form_values) {
+function chatroom_admin_settings_submit($form, &$form_state) {
   $path = file_directory_path() .'/chatroom';
   if (file_check_upload('chatroom_user_alert_upload')) {
     file_save_upload('chatroom_user_alert_upload', "$path/user.mp3", FILE_EXISTS_REPLACE);
@@ -216,7 +213,7 @@ function chatroom_admin_settings_submit(
   if (file_check_upload('chatroom_message_alert_upload')) {
     file_save_upload('chatroom_message_alert_upload', "$path/message.mp3", FILE_EXISTS_REPLACE);
   }
-  system_settings_form_submit($form_id, $form_values);
+  system_settings_form_submit($form, &$form_state);
 }
 
 function _chatroom_element_numeric_unsigned($element) {
@@ -255,7 +252,7 @@ function chatroom_node_info() {
 /**
  * Implementation of hook_form().
  */
-function chatroom_form(&$node) {
+function chatroom_form(&$node, &$params) {
   global $user;
   $form['title'] = array(
     '#type' => 'textfield',
@@ -629,7 +626,7 @@ function chatroom_view($node, $teaser = 
 /**
  * returns a create chat form
  */
-function chatroom_create_chat_form($room_id) {
+function chatroom_create_chat_form(&$form_state, $room_id) {
   $form['chatroom_create_chat'] = array(
     '#type' => 'fieldset',
     '#title' => t('Create a new chat'),
@@ -657,11 +654,11 @@ function chatroom_create_chat_form($room
 /**
  * validates attempt to create chat - checks this name is not already in use
  */
-function chatroom_create_chat_form_validate($f_id, $f_values) {
-  $crid = $f_values['room_id'];
-  $name = $f_values['chat_name'];
-  $sql = "SELECT ccid FROM {chatroom_chat} WHERE crid = %d AND chatname = '%s' AND when_archived IS NULL";
-  if (db_num_rows(db_query_range($sql, $crid, $name, 0, 1))) {
+function chatroom_create_chat_form_validate($form, &$form_state) {
+  $crid = $form_state['values']['room_id'];
+  $name = $form_state['values']['chat_name'];
+  $sql = "SELECT COUNT(ccid) FROM {chatroom_chat} WHERE crid = %d AND chatname = '%s' AND when_archived IS NULL";
+  if (db_result(db_query_range($sql, $crid, $name, 0, 1))) {
     form_set_error('chatroom_chat_name', t('A chat called %name already exists.', array('%name' => $name)));
   }
 }
@@ -669,12 +666,12 @@ function chatroom_create_chat_form_valid
 /**
  * creates a chat
  */
-function chatroom_create_chat_form_submit($f_id, $f_values) {
+function chatroom_create_chat_form_submit($form, &$form_state) {
   global $user;
   $created = db_query("
     INSERT INTO {chatroom_chat} (crid, uid, chatname, modified)
     VALUES (%d, %d, '%s', %d)
-  ", $f_values['room_id'], $user->uid, $f_values['chat_name'], time());
+  ", $form_state['values']['room_id'], $user->uid, $form_state['values']['chat_name'], time());
   if (!$created) {
     drupal_set_message(t("There was an error creating your chat"), 'error');
   }
@@ -851,11 +848,11 @@ function chatroom_get_active_chats($star
   else {
     $result = db_query($sql);
   }
-  if (db_num_rows($result) > 0) {
-    $chats = array();
-    while ($chat = db_fetch_object($result)) {
-      $chats[] = $chat;
-    }
+  $chats = array();
+  while ($chat = db_fetch_object($result)) {
+    $chats[] = $chat;
+  }
+  if (!empty($rows)) {
     return $chats;
   }
   return FALSE;
@@ -1201,20 +1198,20 @@ function chatroom_chat_register_user($ch
   global $user;
   $cache_file = _chatroom_get_cache_file("chat.$chat_id");
   chatroom_chat_update_cache($cache_file);
-  $result = db_query_range("
-    SELECT coid FROM {chatroom_online_list}
+  $count = db_result(db_query_range("
+    SELECT COUNT(coid) FROM {chatroom_online_list}
     WHERE ccid = %d AND uid = %d AND session_id = '%s'
-  ", $chat_id, $user->uid, session_id(), 0, 1);
-  if (db_num_rows($result)) {
+  ", $chat_id, $user->uid, session_id(), 0, 1));
+  if ($count) {
     chatroom_chat_update_online_time($chat_id);
   }
   else {
     $is_admin = user_access('administer chats');
-    $result = db_query_range("
-      SELECT coid FROM {chatroom_online_list}
+    $count = db_result(db_query_range("
+      SELECT COUNT(coid) FROM {chatroom_online_list}
       WHERE ccid = %d AND session_id = '%s'
-    ", $chat_id, session_id(), 0, 1);
-    if (db_num_rows($result)) {
+    ", $chat_id, session_id(), 0, 1));
+    if ($count) {
       db_query("
         UPDATE {chatroom_online_list} SET uid = %d, is_admin = %d
         WHERE ccid = %d AND session_id = '%s'
@@ -1223,7 +1220,7 @@ function chatroom_chat_register_user($ch
     else {
       db_lock_table('chatroom_online_list');
       $result = db_query("SELECT COALESCE(MAX(guest_id) + 1, 1) FROM {chatroom_online_list} WHERE ccid = %d", $chat_id);
-      if ($result && db_num_rows($result)) {
+      if ($result) {
         db_query("
           INSERT INTO {chatroom_online_list}
           (ccid, uid, is_admin, session_id, guest_id, modified)
@@ -1279,11 +1276,13 @@ function chatroom_chat_settings($chat) {
     $js['smileysMarker'] = '------';
   }
   $drupal_js = drupal_add_js();
-  foreach ($drupal_js['setting'] as $setting) {
-    if (is_array($setting['chatroom'])) {
-      foreach ($js as $key => $value) {
-        if (array_key_exists($key, $setting['chatroom'])) {
-          unset($js[$key]);
+  if (is_array($drupal_js['setting'])) {
+    foreach ($drupal_js['setting'] as $setting) {
+      if (is_array($setting['chatroom'])) {
+        foreach ($js as $key => $value) {
+          if (array_key_exists($key, $setting['chatroom'])) {
+            unset($js[$key]);
+          }
         }
       }
     }
@@ -1434,9 +1433,9 @@ function chatroom_form_chat_delete($chat
  * @param array $form_values
  * @return string
  */
-function chatroom_form_chat_delete_submit($form_id, $form_values) {
-  $chat = chatroom_chat_get_from_id($form_values['chat_id']);
-  chatroom_chat_delete($form_values['chat_id']);
+function chatroom_form_chat_delete_submit($form, &$form_state) {
+  $chat = chatroom_chat_get_from_id($form_state['values']['chat_id']);
+  chatroom_chat_delete($form_state['values']['chat_id']);
   return "node/$chat->nid";
 }
 
@@ -1465,14 +1464,14 @@ function chatroom_form_chat_archive($cha
  * @param array $form_values
  * @return string
  */
-function chatroom_form_chat_archive_submit($form_id, $form_values) {
-  chatroom_archive_chat($form_values['chat_id']);
-  file_delete(_chatroom_get_cache_file('chat.'. $form_values['chat_id']));
+function chatroom_form_chat_archive_submit($form, &$form_state) {
+  chatroom_archive_chat($form_state['values']['chat_id']);
+  file_delete(_chatroom_get_cache_file('chat.'. $form_state['values']['chat_id']));
   db_query("
     INSERT INTO {chatroom_msg_archive} (cmid, ccid, uid, msg_type, msg, session_id, recipient, modified)
     SELECT * FROM {chatroom_msg} WHERE ccid = %d
-  ", $form_values['chat_id']);
-  $chat = chatroom_chat_get_from_id($form_values['chat_id']);
+  ", $form_state['values']['chat_id']);
+  $chat = chatroom_chat_get_from_id($form_state['values']['chat_id']);
   chatroom_block_update_cache('chatrooms');
   chatroom_block_update_cache('chats');
 }
@@ -1714,8 +1713,9 @@ function chatroom_chat_old_msg_limit($ch
  */
 function _chatroom_variable_get($name, $default) {
   $result = db_query_range("SELECT value FROM {variable} WHERE name = '%s'", $name, 0, 1);
-  if (db_num_rows($result)) {
-    $default = unserialize(db_result($result));
+  $data = db_result($result);
+  if (!empty($data)) {
+    $default = unserialize($data);
   }
   return $default;
 }
@@ -1849,7 +1849,7 @@ function chatroom_is_banned_user($crid) 
     $result = FALSE;
   }
   else {
-    $result = db_num_rows(db_query_range("SELECT crid FROM {chatroom_ban_list} WHERE crid = %d AND uid = %d", $crid, $user->uid, 0, 1));
+    $result = db_result(db_query_range("SELECT COUNT(crid) FROM {chatroom_ban_list} WHERE crid = %d AND uid = %d", $crid, $user->uid, 0, 1));
   }
   return $result;
 }
@@ -1883,10 +1883,8 @@ function chatroom_get_chatroom_list($arc
     $result = db_query($sql);
   }
   $rooms = array();
-  if (db_num_rows($result) > 0) {
-    while ($room = db_fetch_object($result)) {
-      $rooms[] = $room;
-    }
+  while ($room = db_fetch_object($result)) {
+    $rooms[] = $room;
   }
   return $rooms;
 }
@@ -1942,3 +1940,48 @@ function chatroom_chat_get_online_list($
   return $users;
 }
 
+/**
+ * Implementation of hook_theme()
+ */
+function chatroom_theme() {
+  $theme['chatroom_block_commands'] = array(
+    'arguments' => array(),
+  );
+  $theme['chatroom_block_chats'] = array(
+    'arguments' => array(),
+  );
+  $theme['chatroom_block_rooms'] = array(
+    'arguments' => array(),
+  );
+  $theme['chatroom_block_chat_online_list'] = array(
+    'arguments' => array(),
+  );
+  $theme['chatroom_block_site_online_list'] = array(
+    'arguments' => array('uid'),
+  );
+  $theme['chatroom_display'] = array(
+    'arguments' => array('tree'),
+  );
+  $theme['chatroom_list'] = array(
+    'arguments' => array('tree'),
+  );
+  $theme['chatroom_chat_kicked_user'] = array(
+    'arguments' => array('chat'),
+  );
+  $theme['chatroom_chat_banned_user'] = array(
+    'arguments' => array('chat'),
+  );
+  $theme['chatroom_chat'] = array(
+    'arguments' => array('chat'),
+  );
+  $theme['chatroom_chat_board'] = array(
+    'arguments' => array(),
+  );
+  $theme['chatroom_chat_textentry'] = array(
+    'arguments' => array(),
+  );
+  $theme['chatroom_chat_archive'] = array(
+    'arguments' => array('chat'),
+  );
+  return $theme;
+}
Common subdirectories: ../chatroom.old/po and ./po
Common subdirectories: ../chatroom.old/sounds and ./sounds
