You are here

protected function Messaging_Message::do_dispatch in Messaging 7

Check whether the message is to be sent / queued

Return value

boolean Final success status

File

./messaging.message.inc, line 488
Drupal Messaging Framework - Message class file

Class

Messaging_Message
Message class

Code

protected function do_dispatch() {

  // Mark as processed, so it is actually queued/sent
  $this
    ->set_status(self::STATUS_DISPATCH);

  // Now, depending on message status, make a final decission.
  if (!empty($this->test)) {
    $result = TRUE;
    $this
      ->invoke_hook('test');
  }
  elseif (!empty($this->queue)) {
    $result = $this
      ->process('queue');
  }
  else {
    $result = $this
      ->process('send');
  }

  // Message done, maybe log and return
  if ($result) {
    return $this
      ->dispatch_success();
  }
  else {
    return $this
      ->dispatch_failed();
  }
}