X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/acf0c6e13383bef83c288fd44dcf885b0ac69ebe..553f2f2c99c5d46754cbc7c1628181e7fbc9525a:/docs/contrib/replyfilter diff --git a/docs/contrib/replyfilter b/docs/contrib/replyfilter index 2e987946..c7d46439 100755 --- a/docs/contrib/replyfilter +++ b/docs/contrib/replyfilter @@ -10,11 +10,16 @@ # # - Put the path to this program in your .mh_profile under formatproc: # -# formatproc: replyfilter +# formatproc: replyfilter # -# - Create a mhl reply filter that consists of the following line: +# or invoke repl with "-fmtproc replyfilter". # -# body:nocomponent,format,nowrap,formatarg="%(trim{content-type})%(putstr)",formatarg="%(trim{content-transfer-encoding})%(putstr)",formatarg=">" +# - Create an mhl reply filter that consists of the following line: +# +# body:nocomponent,format,nowrap,formatarg="%(trim{content-type})%(putstr)",formatarg="%(trim{content-transfer-encoding})%(putstr)",formatarg=">" +# +# By default, repl will look for the mhl reply filter by the name +# "mhl.reply", but it will look elsewhere if the -filter switch is given. # # To decode this a bit: # @@ -23,8 +28,8 @@ # component prefix of ">" as a quote character, but we're # going to have replyfilter do that). # nowrap - Don't wrap lines if they exceed the column width -# formatarg - Arguments to fmtproc. The first argument is the value of -# the Content-type header; the second is the value of the +# formatarg - Arguments to formatproc. The first argument is the value +# of the Content-type header; the second is the value of the # Content-Transfer-Encoding header. The last "formatarg" # is used as your quoting prefix. Replace it with whatever # you want. @@ -68,11 +73,11 @@ $outcharset = 'utf-8'; $maxcolwidth = 78; # -# Out HTML converter program & arguments +# Out HTML converter program & arguments. charset will be appended # @htmlconv = ('w3m', '-dump', '-cols', $maxcolwidth - 2, '-T', 'text/html', - '-O', $outcharset); + '-O', $outcharset, '-I'); die "Usage: $0 Content-type content-transfer-encoding quote-prefix\n" @@ -193,7 +198,7 @@ sub process_text (*$$;$) binmode($input, ':encoding(us-ascii)'); - $decoder = find_decoder($encoding); + $decoder = find_decoder(lc($encoding)); if (! defined $decoder) { return 'EOF'; } @@ -348,7 +353,7 @@ sub process_html (*$$;$) my $filterpid, $prefixpid, $finread, $finwrite; my $foutread, $foutwrite, $decoder, $ret; - if (! defined($decoder = find_decoder($encoding))) { + if (! defined($decoder = find_decoder(lc($encoding)))) { return 'EOF'; } @@ -400,7 +405,8 @@ sub process_html (*$$;$) # Exec our converter # - exec (@htmlconv) || + my @conv = (@htmlconv, $charset); + exec (@conv) || die "Unable to exec $filterprogram: $!\n"; } else { die "Fork for $htmlconv[0] failed: $!\n"; @@ -535,7 +541,7 @@ sub process_multipart ($$$) $charset = 'us-ascii'; } - $encoding = defined $cte ? $cte->param('_') : '7bit'; + $encoding = defined $cte ? lc($cte->param('_')) : '7bit'; $name = defined $cdispo ? $cdispo->param('filename') : undef; # @@ -661,15 +667,15 @@ sub null_decoder ($) sub match_boundary($$) { - my ($_, $boundary) = @_; + my ($line, $boundary) = @_; return if ! defined $boundary; - if (substr($_, 0, 2) eq '--') { - s/[ \t\r\n]+\Z//; - if ($_ eq "--$boundary") { + if (substr($line, 0, 2) eq '--') { + $line =~ s/[ \t\r\n]+\Z//; + if ($line eq "--$boundary") { return 'EOP'; - } elsif ($_ eq "--$boundary--") { + } elsif ($line eq "--$boundary--") { return 'EOM'; } }