You are here

function mailhandler_batch_finished in Mailhandler 6

Same name and namespace in other branches
  1. 7 mailhandler.retrieve.inc \mailhandler_batch_finished()
1 string reference to 'mailhandler_batch_finished'
mailhandler_retrieve in ./mailhandler.retrieve.inc
Connect to mailbox and run message retrieval

File

./mailhandler.retrieve.inc, line 260
Mailbox connection code.

Code

function mailhandler_batch_finished($success, $results, $operations) {
  if ($success) {
    $message = format_plural(count($results), '1 message retrieved for %mailbox.', '@count messages retrieved for %mailbox.', array(
      '%mailbox' => $results[0]['mailbox']['mail'],
    ));
    drupal_set_message($message);
  }
  if (!empty($results)) {

    // Return the results to any asking modules
    foreach (module_list() as $name) {
      if (module_hook($name, 'mailhandler_batch_results')) {
        $function = $name . '_mailhandler_batch_results';
        if (!($messages = $function($results))) {

          // Exit if a module has handled the submitted data.
          break;
        }
      }
    }
  }
}