- Edited
I've been looking at the code in pipe.php:
//Strip quoted reply...TODO: figure out how mail clients do it without special tag..
if($cfg->stripQuotedReply() && ($tag=$cfg->getReplySeparator()) && strpos($var,$tag))
list($message)=split($tag,$var);
The way the code was written, it only operates on replies - not NEW messages. I have an issue with people submitting tickets and forgetting to delete their bulky signatures / disclaimers / etc.
My problem is (WAS) twofold.
1) I want to prevent the signatures.
2) I want to prevent them on new messages.
Turns out this isn't hard to START. (I love the code structure )
I commented out those lines, and above I added:
//STRIP ALL SIGNATURES (START WITH '--' ON A BLANK LINE)
//USER SHOULD SET REPLY SEP TO --
//THIS LOOKS FOR PATTERN ON A LINE BY ITSELF
if($cfg->stripQuotedReply() && ($tag=$cfg->getReplySeparator()) && strpos($var,"\n".$tag."\n"))
list($var)=split("\n".$tag."\n",$var);
ABOVE
if(!$ticket){ //New tickets...
For those who aren't as old as me, a double dash (--) on a new line by itself (no leading or trailing spaces, etc.) has long been a standard prefix for delimiting a signature. (Actually it might supposed to be no leading whitespace, one trailing whitespace?) It's quite well documented - here is an example:
http://email.about.com/od/emailsignaturenetiquette/qt/Use_the_Standard_Email_Signature_Delimiter.htm(http://email.about.com/od/emailsignaturenetiquette/qt/Use_the_Standard_Email_Signature_Delimiter.htm)
Old mailers scripts like "mailman" used to depend on it.
SO HERE IS THE PROBLEM.
The code above kind of works... BUT the message text it sees, has been trimmed BEFORE this point. If the goal is to fix this issue in the long run permanently, wouldn't it be a good idea to adopt standard signature detection and recommend that users suggest proper etticut to their users? I know it won't always happen, but it makes it an option.
The trouble with the existing code is MINOR - an unintentional truncation of message can occur if a message line contains two dashes and only whitespace - which seems to get trimmed down to just the two dashes, which is the standard delimeter.
In the meantime, this is a pretty good fix I think - does anyone see a problem?
Thanks again for an excellent tool!
m/