# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/sbatman/workspace-pulse/ipn-new/modules/thirdpart/chatroom
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: chatroom.module
--- chatroom.module Base (BASE)
+++ chatroom.module Locally Modified (Based On LOCAL)
@@ -612,15 +612,17 @@
 function chatroom_archive_old_msgs($chat_id) {
   if ($chat_id != FALSE) {
     global $user;
-    $msgs = chatroom_chat_get_latest_msgs($chat_id, $user->uid);
+    $chat = chatroom_load_chat($chat_id);
+    $cmid = chatroom_load_messages(&$chat, $last_cmid = 0, $archived = FALSE, $limit = FALSE);
+    $msgs = $chat->messages;
     $result = db_query("
       INSERT INTO {chatroom_msg_archive}
       (cmid, ccid, uid, msg_type, msg, session_id, recipient, modified)
-      SELECT * FROM {chatroom_msg}
+      SELECT cmid, ccid, uid, msg_type, msg, sid, recipient, modified FROM {chatroom_msg}
       WHERE ccid = %d AND cmid < %d
     ", $chat_id, $msgs[0]['id']);
     if ($result) {
-      db_query("DELETE FROM {chatroom_msg} WHERE ccid = %d AND cmid < %d", $chat_id, $msgs[0]['id']);
+      db_query("DELETE FROM {chatroom_msg} WHERE ccid = %d AND cmid < %d", $chat_id, $cmid);
     }
   }
 }
