You are here

function messaging_store_unpack_message in Messaging 6.3

Unpack stored messages

Parameters

$message: Array as retrieved from the db store

$full: True for loading the account data if this message is intended for a user And loading the file objects associated too

File

./messaging.store.inc, line 180
Database storage for the messaging framework

Code

function messaging_store_unpack_message(&$message, $full = FALSE) {
  if ($message->uid && $full) {
    $message->account = messaging_load_user($message->uid);
  }
  if ($message->sender && $full) {
    $message->sender_account = messaging_load_user($message->sender);
  }

  // Check destinations array, in case it was not properly filled
  if (empty($message->destinations)) {
    if (!empty($message->account) && ($userdest = messaging_user_destination($message->account, $message->method, $message))) {
      $message->destinations = array(
        $userdest,
      );
    }
    elseif (!empty($message->destination)) {
      $message->destinations = array(
        $message->destination,
      );
    }
  }
}