X-Git-Url: https://git.deb.at/w?p=pkg%2Ft-prot.git;a=blobdiff_plain;f=t-prot;h=81fbd71b49e6181f6771bb15b70707f7623741f0;hp=1cd6e9d74c5c08e8c1d01a5a40c9a093a4c6e18a;hb=2d178478460edcfdc4055642761b157ecb32c28f;hpb=771a8f8c1d215b3015bcf992111f0b56761a8f6c diff --git a/t-prot b/t-prot index 1cd6e9d..81fbd71 100755 --- a/t-prot +++ b/t-prot @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# $Id: t-prot,v 1.243 2005/05/27 10:00:35 jochen Exp $ +# $Id: t-prot,v 1.246 2006/06/17 22:45:55 jochen Exp $ require 5.006; use strict; use Fcntl qw(O_EXCL O_WRONLY O_CREAT); use Getopt::Mixed qw(nextOption); -use constant VER => '2.0'; +use constant VER => '2.1'; use constant REV => ''; -use constant REL => q$Revision: 1.243 $=~m/(\d+(?:\.\d+)+)/; +use constant REL => q$Revision: 1.246 $=~m/(\d+(?:\.\d+)+)/; # MTA expecting mail on STDIN # (you might have to adjust this if using a different MTA) use constant SENDMAIL => '/usr/sbin/sendmail -oi'; @@ -615,7 +615,7 @@ sub process_msg { /^(?:\e[^\a]+\a)?\Q$mutt_attachment\E\d+/o && $att[$x+1] =~ m!^ (?:\e[^\a]+\a)? - (?:\Q$mutt_contenttype\E) message/rfc822 + (?:\Q$mutt_contenttype\E) (?:message/rfc822|multipart/alternative) !ox) { $x += 2; @@ -634,36 +634,44 @@ sub process_msg { # Remove signature: if (scalar(@$lines)) { my $sn = 0; + my $chk_empty = 1; + my $empty = 0; + for ($x = $#$lines; $x>=0; $x--) { - if ((!$vrb[$x]) && $$lines[$x] =~ /^-- $/) { - if ($diff) { - for (my $i=1; $x+$i+1$lsig))) { - if ($lsig && !$sig) { - unshift(@sig, "[---=| Overlong signature removed by $0: " . - (scalar(@$lines)-$x) . " lines snipped |=---]\n"); + if ($sig || ($lsig && ($#$lines-$x-$empty>$lsig))) { + if ($lsig && !$sig) { + unshift(@sig, "[---=| Overlong signature removed by $0: " . + (scalar(@$lines)-$x) . " lines snipped |=---]\n"); + } + splice(@$lines, $x); } - splice(@$lines, $x); - } - else { - unshift(@sig, @$lines[$x..$#$lines]); - splice(@$lines, $x); + else { + unshift(@sig, @$lines[$x..$#$lines]); + splice(@$lines, $x); + } + if (defined($sign) && ++$sn==$sign) { last; } else { next; } } - if (defined($sign) && ++$sn==$sign) { last; } else { next; } + # any trailing newlines? + elsif ($chk_empty && $$lines[$x] =~ /^\s*$/) { $empty++; } + elsif ($chk_empty) { $chk_empty = 0; } } } }