exit; } //Getting Chat Users $users = BuckysPrivateMessenger::getUserList($userID); //Getting User IDs on the Messenger List $buddyIDs = array(); $newUserHTML = ''; foreach ($users as $row) { $newUserHTML .= '<a href="#" class="single_chat_user ' . (!$row['online'] || !$row['buddyStatus'] ? "single_chat_user_offline" : '') . '" data-id="' . $row['userID'] . '" data-hash="' . buckys_encrypt_id($row['userID']) . '"> <img src="' . BuckysUser::getProfileIcon($row) . '" /><span> ' . $row['name'] . '</span></a>'; $buddyIDs[] = $row['userID']; } //Create Messages XML $result = array(); if ($newUserHTML != '') { $buddyIDs = array_unique($buddyIDs); $messages = BuckysPrivateMessenger::getMessages($userID, $buddyIDs, 'new'); //Getting Conversation List $convList = isset($_SESSION['converation_list']) ? $_SESSION['converation_list'] : array(); foreach ($messages as $row) { if (!isset($result[$row['userID']])) { //Init Array $result[$row['userID']] = array('html' => '', 'count' => 0, 'name' => ''); //If there is a user that has sent new message and is not on the conversation list, add him to the conversation list and get all old messages if (!in_array($row['userID'], $convList)) { //Add to conversation list if (is_array(BuckysPrivateMessenger::openConversationBox($userID, $row['userID']))) { $result[$row['userID']]['html'] = BuckysPrivateMessenger::getMessagesHTML($userID, $row['userID'], 'old'); } } } $result[$row['userID']]['html'] .= '<div class="single_private_message">
public function updateConversationList($userID, $buddyID) { global $db; //Getting Conversation List $convList = isset($_SESSION['converation_list']) ? $_SESSION['converation_list'] : array(); //Getting the users that sent new messages not in the conversation list $newMessages = BuckysPrivateMessenger::getMessages($userID, $buddyID, 'new'); foreach ($newMessages as $row) { if (!in_array($row['userID'], $convList)) { $convList[] = $row['userID']; } } $_SESSION['converation_list'] = $convList; }