Re: X-Commands in body longer than 72-80 characters?
"Richard G. Ball" <Richard_Ball@merck.com> 07/16/02 04:25PM >>> On [2002-Jul-16] Tim Pierce <twp@rootsweb.com> wrote: In article <sd342c82.076@ccp2.jhuccp.org>, KEVIN ZEMBOWER <KZEMBOWER@jhuccp.org> wrote:
We're using GroupWise here. As far as I can tell, there's no
So, are there any alternative solutions?
It's supposed to be legal to break headers into multiple lines by adding whitespace at the front of each "continuation line." [snip]
So you could try forcing the issue by breaking the X-Command into these continuation lines yourself well before the 72-character
Richard's solution, below, seems to work like a champ. No problems in testing with it so far. For others who may implement this, make sure that, if you used the original X-Commands-in-the-body recipe, from the FAQ, that you remove the older recipe before you install and run this one. Forgetting to do that cost me about an hour's work. Richard, and all others who contributed to this discussion, thank you very much. -Kevin Zembower option to [snip] limit.
I don't know if SmartList/procmail will actually handle the continuation line correctly, but it seems like it ought to.
If Kevin can't turn off line-wrap he probably can't enforce headers either :-( Since x-commands are not common there isn't much of a performance penalty for using the Perl sledge-hammer to make things fit. So: put the x-command in the body on as many lines as needed and then in rc.local.r00 do: :0 B * $ ^[ ]*\/$\X_COMMAND:.*[^ ] { # Remove the X_Command from the body, and insert it in the header # allow it to extend over multiple lines. the perl script concatenates the # whole body together and removes irrelevant whitespace. this is then fed back # to procmail to extract the command and put it in the header. :0 fw |perl -ne 'if(/^$/ .. eof()) {chomp;push(@l,$_);}else{print;}if(eof()){forea ch (@l){$i++;last if /__END/}$l=join(" ",@l[0..$i-1]);$l.="\n";$l=~tr/ / /s;$l= ~s/^\s+//;$l.=join("\n",@l[$i..$#l]);print "\n$l\n";}' :0 B * $ ^\/$\X_COMMAND:.*[^ ] { :0 fw | grep -v "^$X_COMMAND:" | formail -I"$MATCH" } } Note: this assumes there are no x-commands in the headers (if there are you need to account for that case separately. I think the above comes out of code Alan Stebbens put out for handling this "problem". Rich -- richard_ball@merck.com (I regret the presence of the legal disclaimer but I have no control over it) ------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ============================================================================== _______________________________________________ Smartlist mailing list Smartlist@lists.RWTH-Aachen.DE http://MailMan.RWTH-Aachen.DE/mailman/listinfo/smartlist
Hmm... I'm interested in updating the FAQ, but the code seems to be a bit crazy yet. (Ironically, the word-wrapping doesn't help. ;-) Now, I could be way off on this one, so don't go jumping up to place this into production; there are some dark corners to this stuff that I'm sure I don't know about! If the goal here is to pick out and unwrap text from a message and inject that text as a header using perl, then I'm thinking this might be saner: --- cut here --- # Allow embedding a single X-Command on multiple lines # within the body of an email. (Lines will be joined.) # Look for FIRST magic X_CMD: token. If found, # take from there to __END and add to message header. # Like this: X_CMD: X-Command: blah blah blah __END # (X-Command: blah blah blah..) can be across multiple lines... # Note that this is kind of expensive, but X-Commands should # be somewhat rare. :0 Bw * X_CMD: * __END { XCMD=`perl -p -0077 -e \ 's/[\n\r\s]+/ /sg; \ s/^.*?X_CMD:\s*(.*?)\s*__END.*/$1/;'` :0 f |formail -i "$XCMD" } # End of recipe --- cut here --- Please let me know if I'm out to lunch on this one. Check out the SmartList FAQ at http://www.hartzler.net/smartlist/ Regards, Pete.
participants (2)
-
KEVIN ZEMBOWER
-
Peter Hartzler