From a38cd0f12a29ba323c1edaa7fbd1f51572454304 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 12 Nov 2012 09:16:22 +0100 Subject: Fix excessive LFs at the end of composed message with top_posting=true (#1488797) Conflicts: CHANGELOG --- program/steps/mail/compose.inc | 10 +++++----- program/steps/mail/func.inc | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'program/steps/mail') diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index bd8b6c0d3..064983a9a 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -901,9 +901,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 = ''; @@ -947,8 +948,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"; @@ -961,9 +961,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 diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index efca65b74..6712f2516 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1499,7 +1499,7 @@ function rcmail_wrap_and_quote($text, $length = 72) $out .= $line . "\n"; } - return $out; + return rtrim($out, "\n"); } -- cgit v1.2.3