- Small code improvements related to r4487

release-0.6
alecpl 14 years ago
parent 784a425e07
commit 89d19c4e61

@ -490,6 +490,7 @@ class rcube_message
// if this was a related part try to resolve references // if this was a related part try to resolve references
if ($mimetype == 'multipart/related' && sizeof($this->inline_parts)) { if ($mimetype == 'multipart/related' && sizeof($this->inline_parts)) {
$a_replaces = array(); $a_replaces = array();
$img_regexp = '/^image\/(gif|jpe?g|png|tiff|bmp|svg)/';
foreach ($this->inline_parts as $inline_object) { foreach ($this->inline_parts as $inline_object) {
$part_url = $this->get_part_url($inline_object->mime_id); $part_url = $this->get_part_url($inline_object->mime_id);
@ -498,23 +499,23 @@ class rcube_message
if ($inline_object->content_location) { if ($inline_object->content_location) {
$a_replaces[$inline_object->content_location] = $part_url; $a_replaces[$inline_object->content_location] = $part_url;
} }
// MS Outlook sends sometimes non-related attachments as related
// In this case multipart/related message has only one text part if (!empty($inline_object->filename)) {
// We'll add all such attachments to the attachments list // MS Outlook sends sometimes non-related attachments as related
if (!isset($got_html_part) && empty($inline_object->content_id) // In this case multipart/related message has only one text part
&& !empty($inline_object->filename) // We'll add all such attachments to the attachments list
) { if (!isset($got_html_part) && empty($inline_object->content_id)) {
$this->attachments[] = $inline_object; $this->attachments[] = $inline_object;
} }
// MS Outlook sometimes also adds non-image attachments as related // MS Outlook sometimes also adds non-image attachments as related
// We'll add all such attachments to the attachments list // We'll add all such attachments to the attachments list
// Warning: some browsers support pdf in <img/> // Warning: some browsers support pdf in <img/>
// @TODO: we should fetch HTML body and find attachment's content-id else if (!preg_match($img_regexp, $inline_object->mimetype)) {
// to handle also image attachments without reference in the body $this->attachments[] = $inline_object;
if (!empty($inline_object->filename) }
&& !preg_match('/^image\/(gif|jpe?g|png|tiff|bmp|svg)/', $inline_object->mimetype) // @TODO: we should fetch HTML body and find attachment's content-id
) { // to handle also image attachments without reference in the body
$this->attachments[] = $inline_object; // @TODO: should we list all image attachments in text mode?
} }
} }

Loading…
Cancel
Save