From d0ba82f48e104649b0cb07ad7a4df4c3c199771c Mon Sep 17 00:00:00 2001
From: Jonathan Zacsh <jzacsh@gmail.com>
Date: Mon, 29 Aug 2011 14:29:44 -0400
Subject: [PATCH 1/2] utilizing theme("item_list") in
 theme_chatroom_user_list() instead of hardcoding a
 <ul>/<li> loop.

---
 chatroom.theme.inc |   37 +++++++++++++++++++++++++++++++------
 1 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/chatroom.theme.inc b/chatroom.theme.inc
index 2df06e5..866e89a 100644
--- a/chatroom.theme.inc
+++ b/chatroom.theme.inc
@@ -248,6 +248,7 @@ function theme_chatroom_system_message($message, $node) {
 function theme_chatroom_user_list($variables) {
   global $user;
 
+  $output = '<div class="chatroom-user-list-wrapper">';
   $users = $variables['users'];
   $node = $variables['node'];
   $is_admin = $user->uid == $node->uid || user_access('administer chats');
@@ -256,12 +257,16 @@ function theme_chatroom_user_list($variables) {
   $user_links = chatroom_chat_get_user_links($node, $users);
   $active_user_links = chatroom_chat_get_active_user_links($node);
 
-  $html = '<div id="chatroom-user-list-wrapper"><ul id="chatroom-user-list">';
   foreach ($users as $chat_user) {
+    $item = array('data' => NULL);
+
     $class = 'chatroom-user' . ($chat_user->sid == session_id() ? ' chatroom-current-user' : '');
+    $item['class'] = explode(' ', $class);
     $id = 'chatroom_' . ($chat_user->uid ? "user_$chat_user->uid" : "guest_$chat_user->guest_id");
-    $html .= '<li id="' . $id . '" class="' . $class . '">';
-    $html .= theme('username', array('account' => $chat_user));
+    $item['id'] = array($id);
+
+    //tack-on the user-name
+    $item['data'] .= theme('username', array('account' => $chat_user));
 
     // Add links after the user name.
     $visible_links = array();
@@ -282,10 +287,30 @@ function theme_chatroom_user_list($variables) {
       }
       $visible_links[] = theme('chatroom_chat_user_link', array('link' => $link));
     }
-    $html.= ' ' . implode(' ', $visible_links) . '</li>';
+
+    //tack-on links after the username:
+    $vars = array(
+      'items' => $visible_links,
+      'title' => NULL,
+      'type' => 'ul',
+      'attributes' => array(),
+    );
+    $item['data'] .= theme('item_list', $vars);
+    $item_list[] = $item;
   }
-  $html .= '</ul></div>';
-  return $html;
+
+  $vars = array(
+    'items' => $item_list,
+    'title' => NULL,
+    'type' => 'ul',
+    'attributes' => array(
+      'id' => array('chatroom-user-list'),
+    ),
+  );
+  $output .= theme('item_list', $vars);
+
+  $output .= '</div><!--//#chatroom-user-list-wrapper-->';
+  return $output;
 }
 
 /**
-- 
1.7.6.1


From 65525fe99b5b4ce842fe0149c9e9127285d66fbf Mon Sep 17 00:00:00 2001
From: Jonathan Zacsh <jzacsh@gmail.com>
Date: Mon, 29 Aug 2011 14:58:28 -0400
Subject: [PATCH 2/2] Issue #1263590: removed calls to
 chatroom_get_utc_timestamp() and replaced with time();
 also removed the function definition.

---
 chatroom.module |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/chatroom.module b/chatroom.module
index 7599a5c..0cc9a9f 100644
--- a/chatroom.module
+++ b/chatroom.module
@@ -1380,16 +1380,6 @@ function chatroom_get_message_time_string($timestamp) {
 }
 
 /**
- * Return a UTC timestamp.
- *
- * @return int timestamp
- */
-function chatroom_get_utc_timestamp() {
-  $date = new DateTime('now', new DateTimeZone('UTC'));
-  return $date->format('U');
-}
-
-/**
  * Posted messages are handled here.
  *
  * @return boolean
@@ -1436,7 +1426,7 @@ function chatroom_chat_post_message($node, $last_msg_id) {
     'sid' => session_id(),
     'msg_type' => chatroom_chat_get_message_type($_POST['message']),
     'recipient_uid' => 0,
-    'modified' => chatroom_get_utc_timestamp(),
+    'modified' => time(),
     'anon_name' => isset($_POST['anonName']) ? $_POST['anonName'] : '',
   );
   if ($message['msg_type'] == 'command') {
@@ -1714,7 +1704,7 @@ function chatroom_msg_user($node, $to_user, $from_user, $message) {
     'sid' => session_id(),
     'msg_type' => 'private_message',
     'recipient_uid' => $to_user->uid,
-    'modified' => chatroom_get_utc_timestamp(),
+    'modified' => time(),
     'anon_name' => '',
   );
   return chatroom_chat_save_message($private_message_data, $node);
-- 
1.7.6.1

