summaryrefslogtreecommitdiff
path: root/program/steps/mail/compose.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail/compose.inc')
-rw-r--r--program/steps/mail/compose.inc30
1 files changed, 22 insertions, 8 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 2327debee..ffc1c7518 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -611,13 +611,13 @@ function rcmail_compose_editor_mode()
$useHtml = !empty($_POST['_is_html']);
}
else if ($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) {
- $useHtml = $MESSAGE->has_html_part(false);
+ $useHtml = $MESSAGE->has_html_part(false, true);
}
else if ($compose_mode == RCUBE_COMPOSE_REPLY) {
- $useHtml = ($html_editor == 1 || ($html_editor >= 2 && $MESSAGE->has_html_part(false)));
+ $useHtml = ($html_editor == 1 || ($html_editor >= 2 && $MESSAGE->has_html_part(false, true)));
}
else if ($compose_mode == RCUBE_COMPOSE_FORWARD) {
- $useHtml = ($html_editor == 1 || ($html_editor == 3 && $MESSAGE->has_html_part(false)));
+ $useHtml = ($html_editor == 1 || ($html_editor == 3 && $MESSAGE->has_html_part(false, true)));
}
else {
$useHtml = ($html_editor == 1);
@@ -730,6 +730,10 @@ function rcmail_compose_part_body($part, $isHtml = false)
if ($isHtml) {
if ($part->ctype_secondary == 'html') {
}
+ else if ($part->ctype_secondary == 'enriched') {
+ require_once(INSTALL_PATH . 'program/lib/enriched.inc');
+ $body = enriched_to_html($body);
+ }
else {
// try to remove the signature
if ($RCMAIL->config->get('strip_existing_sig', true)) {
@@ -743,6 +747,12 @@ function rcmail_compose_part_body($part, $isHtml = false)
}
}
else {
+ if ($part->ctype_secondary == 'enriched') {
+ require_once(INSTALL_PATH . 'program/lib/enriched.inc');
+ $body = enriched_to_html($body);
+ $part->ctype_secondary = 'html';
+ }
+
if ($part->ctype_secondary == 'html') {
// use html part if it has been used for message (pre)viewing
// decrease line length for quoting
@@ -750,6 +760,10 @@ function rcmail_compose_part_body($part, $isHtml = false)
$txt = new html2text($body, false, true, $len);
$body = $txt->get_text();
}
+ else if ($part->ctype_secondary == 'enriched') {
+ require_once(INSTALL_PATH . 'program/lib/enriched.inc');
+ $body = enriched_to_html($body);
+ }
else {
if ($part->ctype_secondary == 'plain' && $part->ctype_parameters['format'] == 'flowed') {
$body = rcube_mime::unfold_flowed($body);
@@ -906,9 +920,10 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
if (!$bodyIsHtml) {
$body = preg_replace('/\r?\n/', "\n", $body);
+ $body = trim($body, "\n");
// soft-wrap and quote message text
- $body = rcmail_wrap_and_quote(rtrim($body, "\n"), $LINE_LENGTH);
+ $body = rcmail_wrap_and_quote($body, $LINE_LENGTH);
$prefix .= "\n";
$suffix = '';
@@ -953,8 +968,7 @@ function rcmail_create_forward_body($body, $bodyIsHtml)
$date = format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long'));
$charset = $RCMAIL->output->get_charset();
- if (!$bodyIsHtml)
- {
+ if (!$bodyIsHtml) {
$prefix = "\n\n\n-------- " . rcube_label('originalmessage') . " --------\n";
$prefix .= rcube_label('subject') . ': ' . $MESSAGE->subject . "\n";
$prefix .= rcube_label('date') . ': ' . $date . "\n";
@@ -967,9 +981,9 @@ function rcmail_create_forward_body($body, $bodyIsHtml)
$prefix .= rcube_label('replyto') . ': ' . $MESSAGE->get_header('replyto') . "\n";
$prefix .= "\n";
+ $body = trim($body, "\r\n");
}
- else
- {
+ else {
// set is_safe flag (we need this for html body washing)
rcmail_check_safe($MESSAGE);
// clean up html tags