You are here

function messaging_store_unpack in Messaging 5

Same name and namespace in other branches
  1. 6 messaging.store.inc \messaging_store_unpack()
  2. 6.2 messaging.store.inc \messaging_store_unpack()
  3. 6.3 messaging.store.inc \messaging_store_unpack()

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

2 calls to messaging_store_unpack()
messaging_store_get in ./messaging.store.inc
Retrieve from messaging database storage
messaging_store_queue_process_step in ./messaging.store.inc
Retrieve and send queued messages

File

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

Code

function messaging_store_unpack(&$message, $full = FALSE) {

  // Preprocessing stored parameters
  if ($message['params']) {
    $params = unserialize($message['params']);
    $message['params'] = array();

    // Some optional fields that may be into params, may be extended
    foreach (array(
      'destination',
      'sender_name',
    ) as $field) {
      if (!empty($params[$field])) {
        $message[$field] = $params[$field];
        unset($params[$field]);
      }
    }

    // We only saved params for current sending method group
    $group = messaging_method_info($message['method'], 'group');
    $message['params'][$group] = $params;
  }
  if ($message['uid'] && $full) {
    $message['account'] = messaging_load_user($message['uid']);
  }
  if ($message['sender'] && $full) {
    $message['sender_account'] = messaging_load_user($message['sender']);
  }
}