mimecut.pl
changeset 21 82b4870b7412
parent 19 a583222ef68e
child 22 c95686cde1a6
equal deleted inserted replaced
20:aed81618f8db 21:82b4870b7412
    75 	        or die "can't read $CONFDIR/vips.conf!\n";
    75 	        or die "can't read $CONFDIR/vips.conf!\n";
    76 	    $vips = qr{@{[join "|", map { chomp; "(?:".quotemeta($_).")" } grep !/(?:^\s*#|^\s*$)/, <$fh>]}};
    76 	    $vips = qr{@{[join "|", map { chomp; "(?:".quotemeta($_).")" } grep !/(?:^\s*#|^\s*$)/, <$fh>]}};
    77 		
    77 		
    78 		foreach my $h (qw(from to cc bcc)) {
    78 		foreach my $h (qw(from to cc bcc)) {
    79 			if ($header{$h}) {
    79 			if ($header{$h}) {
    80 				if ($header{$h} =~ /$vips/) {
    80 				if ($header{$h} =~ /$vips/i) {
    81 					print $header;
    81 					print $header;
    82 					local $/ = \10240;
    82 					local $/ = \10240;
    83 					print while <$m>;
    83 					print while <$m>;
    84 					return;
    84 					return;
    85 				}
    85 				}
   142         if (!$re) {
   142         if (!$re) {
   143             open(my $fh, "<$CONFDIR/mimes.conf")
   143             open(my $fh, "<$CONFDIR/mimes.conf")
   144                 or die "can't read $CONFDIR/mimes.conf!\n";
   144                 or die "can't read $CONFDIR/mimes.conf!\n";
   145             $re = qr{@{[join "|", map { chomp; "(?:".quotemeta($_).")" } grep !/(?:^\s*#|^\s*$)/, <$fh>]}};
   145             $re = qr{@{[join "|", map { chomp; "(?:".quotemeta($_).")" } grep !/(?:^\s*#|^\s*$)/, <$fh>]}};
   146         }
   146         }
   147         return $type =~ /$re/;
   147         return $type =~ /$re/i;
   148     }
   148     }
   149 }
   149 }
   150 
   150 
   151 sub read_message() {
   151 sub read_message() {
   152     my $tmp = tempfile();
   152     my $tmp = tempfile();