diff --git a/mailboxes/folders-lib.pl b/mailboxes/folders-lib.pl
index f2876bed1..1d546650f 100755
--- a/mailboxes/folders-lib.pl
+++ b/mailboxes/folders-lib.pl
@@ -2627,11 +2627,11 @@ foreach my $a (@$attach) {
return @rv;
}
-# quoted_message(&mail, quote-mode, sig, 0=any,1=text,2=html)
+# quoted_message(&mail, quote-mode, sig, 0=any,1=text,2=html, sig-at-top?)
# Returns the quoted text, html-flag and body attachment
sub quoted_message
{
-local ($mail, $qu, $sig, $bodymode) = @_;
+local ($mail, $qu, $sig, $bodymode, $sigtop) = @_;
local $mode = $bodymode == 1 ? 1 :
$bodymode == 2 ? 2 :
%userconfig ? $userconfig{'view_html'} :
@@ -2667,7 +2667,13 @@ if (($cfg->{'html_edit'} == 2 ||
$quote = &html_escape($writer)."\n".
"
\n".
&safe_html($htmlbody->{'data'}).
- "
".$sig."
\n";
+ "";
+ if ($sigtop) {
+ $quote = $sig."
\n".$quote;
+ }
+ else {
+ $quote = $quote.$sig."
\n";
+ }
}
elsif ($qu && $qm == 1) {
# Quoted HTML below line
@@ -2677,8 +2683,13 @@ if (($cfg->{'html_edit'} == 2 ||
}
else {
# Un-quoted HTML
- $quote = &safe_html($htmlbody->{'data'}).
- $sig."
\n";
+ $quote = &safe_html($htmlbody->{'data'});
+ if ($sigtop) {
+ $quote = $sig."
\n".$quote;
+ }
+ else {
+ $quote = $quote.$sig."
\n";
+ }
}
}
elsif ($plainbody) {
@@ -2691,7 +2702,13 @@ if (($cfg->{'html_edit'} == 2 ||
$quote = &html_escape($writer)."\n".
"\n".
"$pd
".
- "
".$sig."
\n";
+ "";
+ if ($sigtop) {
+ $quote = $sig."
\n".$quote;
+ }
+ else {
+ $quote = $quote.$sig."
\n";
+ }
}
elsif ($qu && $qm == 1) {
# Quoted plain text as HTML below line
@@ -2701,8 +2718,13 @@ if (($cfg->{'html_edit'} == 2 ||
}
else {
# Un-quoted plain text as HTML
- $quote = "$pd
".
- $sig."
\n";
+ $quote = "$pd
";
+ if ($sigtop) {
+ $quote = $sig."
\n".$quote;
+ }
+ else {
+ $quote = $quote.$sig."
\n";
+ }
}
}
$html_edit = 1;
@@ -2722,7 +2744,12 @@ else {
&wrap_lines($quote, 78));
}
$quote = $writer."\n".$quote if ($quote && $qu);
- $quote .= "$sig\n" if ($sig);
+ if ($sig && $sigtop) {
+ $quote = $sig."\n".$quote;
+ }
+ elsif ($sig && !$sigtop) {
+ $quote = $quote.$sig."\n";
+ }
}
return ($quote, $html_edit, $body);
}