#!/usr/bin/perl -w
-# $Id: t-prot,v 1.243 2005/05/27 10:00:35 jochen Exp $
+# $Id: t-prot,v 1.248 2006/11/30 14:06:27 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.2';
use constant REV => '';
-use constant REL => q$Revision: 1.243 $=~m/(\d+(?:\.\d+)+)/;
+use constant REL => q$Revision: 1.248 $=~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';
/^(?:\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;
# 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<scalar(@$lines); $i++) {
- if ($$lines[$x+$i] =~ /^-{3}\s+\S/ &&
- $$lines[$x+$i+1] =~ /^\+{3}\s+\S/)
- {
- $sig = 0;
- unshift(@sig, @$lines[$x..$#$lines]);
- splice(@$lines, $x);
- last;
+ if (!$vrb[$x]) {
+ if ($$lines[$x] =~ /^-- $/) {
+ if ($diff) {
+ for (my $i=1; $x+$i+1<scalar(@$lines); $i++) {
+ if ($$lines[$x+$i] =~ /^-{3}\s+\S/ &&
+ $$lines[$x+$i+1] =~ /^\+{3}\s+\S/)
+ {
+ $sig = 0;
+ unshift(@sig, @$lines[$x..$#$lines]);
+ splice(@$lines, $x);
+ last;
+ }
+ }
+ if (scalar(@sig)) {
+ if (defined($sign) && ++$sn==$sign) { last; } else { next; }
}
}
- if (scalar(@sig)) {
- if (defined($sign) && ++$sn==$sign) { last; } else { next; }
- }
- }
- if ($sig || ($lsig && ($#$lines-$x>$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; }
}
}
}
if ($ms) {
# bloat this array if you want more internationalization:
my @tofu = ('Original Message',
+ 'Original-Nachricht',
'Ursprüngliche Nachricht',
'Ursprungliche Nachricht',
'Mensagem original',