diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-10-13 07:05:31 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-10-13 07:05:31 +0000 |
| commit | 3a5ea26530316f5ebd3ebef1dcc0d6cf794719e4 (patch) | |
| tree | 38408f7f3366b5bef678ebed3d54cf1a566b4531 /roundcubemail | |
| parent | 60f18a6712afbe2acc92aa0636436e1e868d4cd7 (diff) | |
#1485494: fixed signatures removal on reply
git-svn-id: https://svn.roundcube.net/trunk@1974 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail')
| -rw-r--r-- | roundcubemail/program/steps/mail/compose.inc | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/roundcubemail/program/steps/mail/compose.inc b/roundcubemail/program/steps/mail/compose.inc index ba09fe831..5c6e03f62 100644 --- a/roundcubemail/program/steps/mail/compose.inc +++ b/roundcubemail/program/steps/mail/compose.inc @@ -499,34 +499,38 @@ function rcmail_create_reply_body($body, $bodyIsHtml) if (! $bodyIsHtml) { + // try to remove the signature + if (($sp = strrpos($body, '-- ')) !== false && ($sp == 0 || $body{$sp-1} == "\n")) + { + if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r") + $body = substr($body, 0, max(0, $sp-1)); + } + // soft-wrap message first $body = rcmail_wrap_quoted($body, 75); - - // split body into single lines - $a_lines = preg_split('/\r?\n/', $body); - - // add > to each line - for($n=0; $n<sizeof($a_lines); $n++) - { - if (strpos($a_lines[$n], '>')===0) - $a_lines[$n] = '>'.$a_lines[$n]; - else - $a_lines[$n] = '> '.$a_lines[$n]; - } + + $body = rtrim($body, "\r\n"); + + if ($body) { + // split body into single lines + $a_lines = preg_split('/\r?\n/', $body); + + // add > to each line + for($n=0; $n<sizeof($a_lines); $n++) { + if (strpos($a_lines[$n], '>')===0) + $a_lines[$n] = '>'.$a_lines[$n]; + else + $a_lines[$n] = '> '.$a_lines[$n]; + } - $body = join("\n", $a_lines); + $body = join("\n", $a_lines); + } // add title line $prefix = sprintf("On %s, %s wrote:\n", $MESSAGE->headers->date, $MESSAGE->get_header('from')); - // try to remove the signature - if ($sp = strrpos($body, '-- ')) - { - if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r") - $body = substr($body, 0, $sp-1); - } $suffix = ''; } else |
