mimecut.pl
changeset 24 02c6b4c97bd0
parent 23 82cb1c6e2274
equal deleted inserted replaced
23:82cb1c6e2274 24:02c6b4c97bd0
    91     if ($header{"content-type"}) {
    91     if ($header{"content-type"}) {
    92         ($type) = ($header{"content-type"} =~ /^([^;]*)/);
    92         ($type) = ($header{"content-type"} =~ /^([^;]*)/);
    93         (undef, $boundary)
    93         (undef, $boundary)
    94             = ($header{"content-type"} =~ /boundary=(['"])(.*?)\1/);
    94             = ($header{"content-type"} =~ /boundary=(['"])(.*?)\1/);
    95         ### h{content-type}:  $header{"content-type"}
    95         ### h{content-type}:  $header{"content-type"}
    96         ### type:	      $type
    96         ### type:         $type
    97         ### bound:            $boundary
    97         ### bound:            $boundary
    98     }
    98     }
    99     $boundary ||= $arg{boundary};
    99     $boundary ||= $arg{boundary};
   100     if (not $type or pass_mime($type)) {
   100     if (not $type or pass_mime($type)) {
   101 
   101 
   119 
   119 
   120     my ($eol) = ($header =~ /(\s*)$/);
   120     my ($eol) = ($header =~ /(\s*)$/);
   121     $header =~ s/\s*$//;
   121     $header =~ s/\s*$//;
   122     $header =~ s/^/-- /gm;
   122     $header =~ s/^/-- /gm;
   123 
   123 
   124     print "Content-Type: text/plain"
   124     print "Content-Type: text/plain$eol"
   125         . $eol x 2
   125         . "Content-Disposition: inline$eol"
       
   126         . $eol
   126         . "Content removed ("
   127         . "Content removed ("
   127         . localtime() . ")$eol"
   128         . localtime() . ")$eol"
   128         . $header
   129         . $header
   129         . $eol;
   130         . $eol;
   130 
   131 
   160     chmod 0400, $tmp or die "Can't fchmod on tmpfile: $!\n";
   161     chmod 0400, $tmp or die "Can't fchmod on tmpfile: $!\n";
   161 
   162 
   162     return $tmp;
   163     return $tmp;
   163 }
   164 }
   164 
   165 
   165 # in:	current message file handle
   166 # in:   current message file handle
   166 # out:	($orignal_header, %parsed_header)
   167 # out:  ($orignal_header, %parsed_header)
   167 sub read_header(*) {
   168 sub read_header(*) {
   168     my ($msg) = @_;
   169     my ($msg) = @_;
   169     my $h = "";
   170     my $h = "";
   170 
   171 
   171     while (<$msg>) {
   172     while (<$msg>) {
   183     return ($h,
   184     return ($h,
   184             map { ($a = $_) =~ s/\s*$//; $a }
   185             map { ($a = $_) =~ s/\s*$//; $a }
   185                 ":unix_from:" => split(/^(\S+):\s*/m, $_));
   186                 ":unix_from:" => split(/^(\S+):\s*/m, $_));
   186 }
   187 }
   187 __END__
   188 __END__
   188 # vim:ts=4
   189 # vim:ts=4 et: