- Partially fixed "empty body" issue by showing raw body of malformed message (#1486166)

release-0.6
alecpl 15 years ago
parent a9bfe21ba6
commit 4f69328132

@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
- Partially fixed "empty body" issue by showing raw body of malformed message (#1486166)
- Fix importing/sending to email address with whitespace (#1486214)
- Added XIMSS (CommuniGate) driver for Password plugin
- Fix newly attached files are not saved in drafts w/o editing any text (#1486202)

@ -1226,17 +1226,15 @@ class rcube_imap
else
$this->struct_charset = $this->_structure_charset($structure);
/*
@TODO: here we can recognize malformed BODYSTRUCTURE and parse
the message in other way to create our own message structure.
Example of structure for malformed MIME message:
("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL)
if ($headers->ctype != 'text/plain'
&& !is_array($structure[0]) && $structure[0] == 'text'
&& !is_array($structure[1]) && $structure[1] == 'plain')
{ }
*/
// Here we can recognize malformed BODYSTRUCTURE and
// 1. [@TODO] parse the message in other way to create our own message structure
// 2. or just show the raw message body.
// Example of structure for malformed MIME message:
// ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL)
if ($headers->ctype && $headers->ctype != 'text/plain'
&& $structure[0] == 'text' && $structure[1] == 'plain') {
return false;
}
$struct = &$this->_structure_part($structure);
$struct->headers = get_object_vars($headers);

@ -785,7 +785,23 @@ function rcmail_print_body($part, $p = array())
unset($data['body']);
// plaintext postprocessing
if ($part->ctype_secondary == 'plain') {
if ($part->ctype_secondary == 'plain')
$body = rcmail_plain_body($body);
// allow post-processing of the message body
$data = $RCMAIL->plugins->exec_hook('message_part_after', array('type' => $part->ctype_secondary, 'body' => $body) + $data);
return $data['type'] == 'html' ? $data['body'] : html::tag('pre', array(), $data['body']);
}
/**
* Handle links and citation marks in plain text message
*
* @param string Plain text string
* @return string Formatted HTML string
*/
function rcmail_plain_body($body)
{
// make links and email-addresses clickable
$replacements = new rcube_string_replacer;
@ -837,12 +853,8 @@ function rcmail_print_body($part, $p = array())
// insert the links for urls and mailtos
$body = $replacements->resolve(join("\n", $a_lines));
}
// allow post-processing of the message body
$data = $RCMAIL->plugins->exec_hook('message_part_after', array('type' => $part->ctype_secondary, 'body' => $body) + $data);
return $data['type'] == 'html' ? $data['body'] : html::tag('pre', array(), $data['body']);
return $body;
}
@ -1027,7 +1039,8 @@ function rcmail_message_body($attrib)
}
}
else
$out .= html::div('message-part', html::tag('pre', array(), Q($MESSAGE->body)));
$out .= html::div('message-part', html::tag('pre', array(),
rcmail_plain_body(Q($MESSAGE->body, 'strict', false))));
$ctype_primary = strtolower($MESSAGE->structure->ctype_primary);
$ctype_secondary = strtolower($MESSAGE->structure->ctype_secondary);

Loading…
Cancel
Save