Merge branch 'MDL-48593-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2014-12-22 21:50:50 +01:00
commit 2323289e2e

View File

@ -372,7 +372,10 @@ class manager {
// Process and retrieve the message data for this message.
// This includes fetching the full content, as well as all headers, and attachments.
$this->process_message_data($envelope, $messagedata, $messageid);
if (!$this->process_message_data($envelope, $messagedata, $messageid)) {
mtrace("--- Message could not be found on the server. Is another process removing messages?");
return;
}
// When processing validation replies, we need to skip the sender verification phase as this has been
// manually completed.
@ -466,36 +469,25 @@ class manager {
$query = new \Horde_Imap_Client_Fetch_Query();
$query->imapDate();
// Fetch all of the message parts too.
$typemap = $structure->contentTypeMap();
foreach ($typemap as $part => $type) {
// The header.
$query->headerText(array(
'id' => $part,
));
}
// Fetch the message header.
$query->headerText();
// Retrieve the message with the above components.
$messagedata = $this->client->fetch($mailbox, $query, array('ids' => $messageid))->first();
// Store the data for this message.
$headers = '';
foreach ($typemap as $part => $type) {
// Grab all of the header data into a string.
$headers .= $messagedata->getHeaderText($part);
// We don't handle any of the other MIME content at this stage.
if (!$messagedata) {
// Message was not found! Somehow it has been removed or is no longer returned.
return null;
}
$data = new \stdClass();
// The message ID should always be in the first part.
$data = new \stdClass();
$data->messageid = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('Message-ID');
$data->subject = $envelope->subject;
$data->timestamp = $messagedata->getImapDate()->__toString();
$data->envelope = $envelope;
$data->data = $this->addressmanager->get_data();
$data->headers = $headers;
$data->headers = $messagedata->getHeaderText();
$this->currentmessagedata = $data;
@ -626,6 +618,9 @@ class manager {
private function process_message_part_attachment($messagedata, $partdata, $part, $filename) {
global $CFG;
// For Antivirus, the repository/lib.php must be included as it is not autoloaded.
require_once($CFG->dirroot . '/repository/lib.php');
// If a filename is present, assume that this part is an attachment.
$attachment = new \stdClass();
$attachment->filename = $filename;