# HG changeset patch # User schulze # Date 1189609186 0 # Node ID a583222ef68eb57be3aba5586661aa5c8b24f132 # Parent cd800b3f5a6ecbbda13c1f3445900a71cf35e5f6 - vips.conf wird gelesen und berücksichtigt diff -r cd800b3f5a6e -r a583222ef68e mimecut.pl --- a/mimecut.pl Fri Sep 07 22:16:36 2007 +0000 +++ b/mimecut.pl Wed Sep 12 14:59:46 2007 +0000 @@ -62,12 +62,31 @@ last if $arg{to} and /^--\Q$arg{to}\E/; } } +my $vips; sub process(*;@) { my ($m, %arg) = @_; my ($header, %header) = read_header($m); my ($type, $boundary); + if (!$vips) { + + open(my $fh, "<$CONFDIR/vips.conf") + or die "can't read $CONFDIR/vips.conf!\n"; + $vips = qr{@{[join "|", map { chomp; "(?:".quotemeta($_).")" } grep !/(?:^\s*#|^\s*$)/, <$fh>]}}; + + foreach my $h (qw(from to cc bcc)) { + if ($header{$h}) { + if ($header{$h} =~ /$vips/) { + print $header; + local $/ = \10240; + print while <$m>; + return; + } + } + } + } + if ($header{"content-type"}) { ($type) = ($header{"content-type"} =~ /^([^;]*)/); (undef, $boundary) @@ -76,50 +95,42 @@ ### type: $type ### bound: $boundary } - - $boundary ||= $arg{boundary}; - - if (not $type or pass_mime($type)) { - - #warn "passing: " . ($type ? $type : "no mime type") . "\n"; - print $header; - print_message($m, to => $boundary); - return; - } - - if ($type =~ m{^multipart/}) { - - #warn "forward to next multipart boundary: $boundary\n"; - print $header; - print_message($m, to => $boundary); - - while (not eof($m)) { - process($m, boundary => $boundary); - } + $boundary ||= $arg{boundary}; + if (not $type or pass_mime($type)) { + #warn "passing: " . ($type ? $type : "no mime type") . "\n"; + print $header; + print_message($m, to => $boundary); + return; + } + if ($type =~ m{^multipart/}) { + #warn "forward to next multipart boundary: $boundary\n"; + print $header; + print_message($m, to => $boundary); + while (not eof($m)) { + process($m, boundary => $boundary); + } + return; + } - return; - } + #warn "removed: $type\n"; - #warn "removed: $type\n"; - - my ($eol) = ($header =~ /(\s*)$/); - $header =~ s/\s*$//; - $header =~ s/^/-- /gm; + my ($eol) = ($header =~ /(\s*)$/); + $header =~ s/\s*$//; + $header =~ s/^/-- /gm; - print "Content-Type: text/plain" - . $eol x 2 - . "Content removed (" - . localtime() . ")$eol" - . $header - . $eol; + print "Content-Type: text/plain" + . $eol x 2 + . "Content removed (" + . localtime() . ")$eol" + . $header + . $eol; - while (<$m>) { - if (/^--\Q$boundary\E/) { - print; - last; - } - } - + while (<$m>) { + if (/^--\Q$boundary\E/) { + print; + last; + } + } } { diff -r cd800b3f5a6e -r a583222ef68e vips.conf --- a/vips.conf Fri Sep 07 22:16:36 2007 +0000 +++ b/vips.conf Wed Sep 12 14:59:46 2007 +0000 @@ -2,5 +2,4 @@ # # insert vip addresses who will receive uncut messages # one per line -info@siemens.ch -pitti@platsch.de +mailings@gmx.net