/** * Process a message received and validated by the Inbound Message processor. * * @param \stdClass $record The Inbound Message record * @param \stdClass $data The message data packet. * @return bool Whether the message was successfully processed. * @throws \core\message\inbound\processing_failed_exception when the message can not be found. */ public function process_message(\stdClass $record, \stdClass $data) { global $DB; if (!($maildata = $DB->get_record('messageinbound_messagelist', array('id' => $record->datavalue)))) { // The message requested couldn't be found. Failing here will alert the user that we failed. throw new \core\message\inbound\processing_failed_exception('oldmessagenotfound', 'tool_messageinbound'); } mtrace("=== Request to re-process message {$record->datavalue} from server."); mtrace("=== Message-Id:\t{$maildata->messageid}"); mtrace("=== Recipient:\t{$maildata->address}"); $manager = new \tool_messageinbound\manager(); return $manager->process_existing_message($maildata); }
/** * Execute the main Inbound Message pickup task. */ public function execute() { $manager = new \tool_messageinbound\manager(); return $manager->tidy_old_messages(); }