From: martin f. krafft Date: Tue, 8 Dec 2020 21:02:33 +0000 (+1300) Subject: mailcap handler for containers X-Git-Url: https://git.madduck.net/etc/mutt.git/commitdiff_plain/7cc6ed072e7c6b3128e121609e0279d95760363c mailcap handler for containers --- diff --git a/.gitignore.d/mutt b/.gitignore.d/mutt index 55ea528..329c30c 100644 --- a/.gitignore.d/mutt +++ b/.gitignore.d/mutt @@ -11,6 +11,7 @@ !/.mutt/bgview-fifo !/.mutt/colours !/.mutt/confvars +!/.mutt/container-extractor !/.mutt/edit-header !/.mutt/filter-proxy !/.mutt/get-timestamp @@ -23,6 +24,7 @@ !/.mutt/list-mailboxes !/.mutt/lists !/.mutt/mailcap.backgrounding +!/.mutt/mailcap.containers !/.mutt/mailcap.editing !/.mutt/mailcap.htmldump !/.mutt/mailcap.icalendar @@ -46,7 +48,6 @@ !/.mutt/sidebar !/.mutt/spam !/.mutt/supersede-header -!/.mutt/tnef-extractor !/.mutt/viewmailattachments !/.var/mutt/.gitignore !/.var/mutt/header_cache/.gitignore diff --git a/.mutt/confvars b/.mutt/confvars index e7d713b..6c5883e 100644 --- a/.mutt/confvars +++ b/.mutt/confvars @@ -2018,7 +2018,7 @@ set mail_check_stats=yes # This variable specifies which files to consult when attempting to display MIME # bodies not directly supported by Mutt. # -set mailcap_path="$my_confdir/mailcap.tnef:$my_confdir/mailcap.icalendar:$my_confdir/mailcap.backgrounding:$my_confdir/mailcap.htmldump" +set mailcap_path="$my_confdir/mailcap.containers:$my_confdir/mailcap.icalendar:$my_confdir/mailcap.backgrounding:$my_confdir/mailcap.htmldump" # 3.139. mailcap_sanitize diff --git a/.mutt/tnef-extractor b/.mutt/container-extractor similarity index 74% rename from .mutt/tnef-extractor rename to .mutt/container-extractor index d11d25f..e8dec52 100755 --- a/.mutt/tnef-extractor +++ b/.mutt/container-extractor @@ -13,7 +13,7 @@ for i in $LOGNAME volatile; do fi done export TMPDIR -TMPDIR=$(mktemp -dp "$TMPDIR" tnef.XXXXXXXXXX) +TMPDIR=$(mktemp -dp "$TMPDIR" cont.XXXXXXXXXX) cleanup() { cd / && rm -r "$TMPDIR" @@ -23,7 +23,12 @@ cleanup() trap cleanup 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 cd "$TMPDIR" -tnef -v + +case "$1" in + (application/ms-tnef) tnef;; + (application/x-zip-compressed) unzip /dev/stdin;; + (application/zip) unzip /dev/stdin;; +esac nfiles=$(ls -1 | wc -l) if [ $nfiles -eq 1 ]; then diff --git a/.mutt/mailcap.containers b/.mutt/mailcap.containers new file mode 100644 index 0000000..3006186 --- /dev/null +++ b/.mutt/mailcap.containers @@ -0,0 +1,7 @@ +# +# Mutt mailcap for dumping HTML to text +# + +application/ms-tnef; ~/.mutt/container-extractor '%t'; description=Microsoft NIH TNEF +application/x-zip-compressed; ~/.mutt/container-extractor '%t'; description=Compressed ZIP files +application/zip; ~/.mutt/container-extractor '%t'; description=Compressed ZIP files