Bug 72316

Summary: KMail only removes the last signature on reply
Product: [Unmaintained] kmail Reporter: Malte S. Stretz <mss>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: bensberg, jtamate, lemma, peter_e
Priority: NOR Keywords: triaged
Version: 1.5.94   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: search for first "-- " instead of last
Removes all the signatures blocks

Description Malte S. Stretz 2004-01-10 16:11:38 UTC
Version:           1.5.94 (using KDE 3.1.94 (CVS >= 20031206), Gentoo)
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice)
OS:          Linux (i686) release 2.4.20-gentoo-r8

If you reply to a mail which features two signatures, KMail only removes the last of them. Simple sample:
| From: me
| To: You
| Subject: Test
| 
| foo
| -- 
| bar
| -- 
| baz

As stupid as two signatures might sound, they happen in real life. Two samples:
1. Some mailinglists append their footers preceding the two dashes. If now the users has his own sig, the recepient will receive a sig with two sigs (this is where I noticed it).
2. The sig may contain other sig delimiters, take this as an example:
-- 
-- ACME, Inc
-- Joe User
-- PHB
-- Tel.: 555 1234
--
Comment 1 Malte S. Stretz 2004-01-10 16:14:26 UTC
Wow. Seems like Bugzilla snips at sig boundaries, too :-/ The missing sample is:
| -- 
| -- ACME, INC.
| -- Joe User
| -- PHB
| -- Tel.: 555 1234
| -- 
Comment 2 Don Sanders 2004-01-12 04:00:50 UTC
Subject: Re:  KMail only removes the last signature on reply

That's expected behavior. Maybe a wish to change this would be ok but 
it's not a bug in my opinion.

Don.

Comment 3 Malte S. Stretz 2004-01-12 07:54:58 UTC
Sorry, to me this is not expected behaviour. Especially because all other MUAs I know (Including KMail 1.4 and Mozilla) behave otherwise.

I don't think ther's an official spec for the sig delimiter but normally everything following the first delimiter is the sig. This is important especially for the mailinglist example I gave; if the mailinglist appends its own footer with its own sig delimiter, over time the users' sigs will accumulate.

As I stated above, did KMail 1.4 behave "correctly". You suggested I should refile this as a wish, but if 1.5 changes its behaviour and later my wish was granted and 1.6 changes its behaviour back... that would be really confusing.

Feel free to close this bug again, I'll keep it closed then, but in my eyes this is definitely a bug.
Comment 4 Benno Schulenberg 2006-03-03 16:52:00 UTC
IMHO it is a bug.  Attached patch changes KMail over to the expected behaviour.
Comment 5 Benno Schulenberg 2006-03-03 16:52:55 UTC
Created attachment 14939 [details]
search for first "-- " instead of last
Comment 6 Jaime Torres 2008-09-09 17:39:11 UTC
kmail 1.10.1, in a signature like

--
a
--
b
--
--
c
--
d
--

In the reply, the resulting signature will be

>--
>c
>--
>d
>--
your signature.
Comment 7 Michael Leupold 2008-11-07 12:34:49 UTC
I'm not sure if I'm doing something wrong, but trying Jaime's example gives both signatures in the reply for me. Do I have to select a special option to make it remove it?
Comment 8 Peter Eisentraut 2009-03-22 09:15:46 UTC
This is obviously a regression from KDE 3 which has a significant real-life impact, and no one is able to explain why the new behavior is supposed to be better.  Can the patch please be applied?
Comment 9 Jaime Torres 2009-03-22 21:53:32 UTC
About the signature blocks:
http://en.wikipedia.org/wiki/Signature_block

In a message like the following, coming from a non signature block removing mail:

Text 1
-- 
First sign


> From: bla
> Texto 2

> Aquí algo de texto.
 
> -- 
> Signature Block 2
 
> Adios
 
>> Texto 3

>> -- 
>> Signature block 3

With the (version for Qt 4.5) of the proposed patch, the result will be only:
> Text 1

What do you prefer?

The problem with the signatures is that they were not thinked to be mailed and remailed.. Otherwise they would have a clear beginning and a clear end.

Worst of all, I guess there is no regular expresion to match all the signatures blocks.
Comment 10 Peter Eisentraut 2009-03-23 08:28:25 UTC
(In reply to comment #9)
> About the signature blocks:
> http://en.wikipedia.org/wiki/Signature_block
> 
> In a message like the following, coming from a non signature block removing
> mail:
> 
> Text 1
> -- 
> First sign
> 
> 
> > From: bla
> > Texto 2
> 
> > Aquí algo de texto.
> 
> > -- 
> > Signature Block 2
> 
> > Adios
> 
> >> Texto 3
> 
> >> -- 
> >> Signature block 3
> 
> With the (version for Qt 4.5) of the proposed patch, the result will be only:
> > Text 1
> 
> What do you prefer?

That is what I would prefer, yes.

(The way to override this behavior was usually to mark the text to be included in the reply.  Then you get only the marked text, and everything else, signature or not, is stripped.)
Comment 11 Jaime Torres 2009-03-23 12:57:00 UTC
Created attachment 32355 [details]
Removes all the signatures blocks

Searches for all the "-- " blocks, and removes them, the end of the block is triggered by a change in the reply prefix (for example, from > to >>).
Comment 12 Jaime Torres 2009-03-28 17:28:59 UTC
SVN commit 946070 by jtamate:

BUG: 72316

 removes the Signature Blocks (SB) from prefix+"-- (end of line)" until a line that
 * does not starts with prefix or
 * starts with prefix+(any substring of prefix)
 where prefix can only have any number of ">" and spaces.

 M  +49 -5     kmmessage.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=946070