You are here

function Messaging_Send_Method::message_prepare in Messaging 6.4

Same name and namespace in other branches
  1. 6.3 classes/messaging_method.class.inc \Messaging_Send_Method::message_prepare()
  2. 7 messaging.method.inc \Messaging_Send_Method::message_prepare()

Message processing: Decide on queue, log, cron and send options, prepare parameters

At this stage, the message can be still redirected through other sending method, or marked for discard

File

includes/messaging_method.class.inc, line 318
Drupal Messaging Framework - Send_Method class file

Class

Messaging_Send_Method
Sending method, implements all specific method functionality

Code

function message_prepare($message) {

  // If this method is disabled, mark for discard, log the error
  if (!$this->enabled) {
    $message->discard = TRUE;
    $message->queue = $message->cron = 0;
    $message
      ->set_error(t('The sending method is disabled.'));
  }
  else {

    // It will be queued always for pull methods, cron disabled though so it will wait till it's pulled
    $message->queue = !($this->type & self::TYPE_NOQUEUE) && ($this->type & self::TYPE_PULL || !$message->priority && ($message->queue || $this->queue));
    $message->log = $message->log || $this->log && variable_get('messaging_log', 0);

    // If the messaging method is of type push, cron processing will be enabled
    $message->cron = $message->cron || $message->queue && $this->type & self::TYPE_PUSH;
  }

  // Aditionally we can have a prepare callback
  if ($function = $this
    ->get_info('prepare callback')) {
    $function($message, $this
      ->get_info());
  }
}