From 2f0b628b422e7a543878f73857ded199becbb972 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 20:02:01 +0100 Subject: [PATCH 1/1] handle tnef attachments --- .gitignore.d/mutt | 3 ++- .mutt/confvars | 2 +- .mutt/tnef-extractor | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100755 .mutt/tnef-extractor diff --git a/.gitignore.d/mutt b/.gitignore.d/mutt index a6f0ff5..55ea528 100644 --- a/.gitignore.d/mutt +++ b/.gitignore.d/mutt @@ -1,7 +1,6 @@ * !/.crontab.d/mutt !/.gitignore.d/mutt -!/.lbdbrc !/.mutt/ack-recipients !/.mutt/alternates !/.mutt/append-header @@ -27,6 +26,7 @@ !/.mutt/mailcap.editing !/.mutt/mailcap.htmldump !/.mutt/mailcap.icalendar +!/.mutt/markdown2html !/.mutt/mkconf !/.mutt/multipart-alternative !/.mutt/muttrc @@ -46,6 +46,7 @@ !/.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 e18f309..d07933a 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.icalendar:$my_confdir/mailcap.backgrounding:$my_confdir/mailcap.htmldump" +set mailcap_path="$my_confdir/mailcap.tnef:$my_confdir/mailcap.icalendar:$my_confdir/mailcap.backgrounding:$my_confdir/mailcap.htmldump" # 3.139. mailcap_sanitize diff --git a/.mutt/tnef-extractor b/.mutt/tnef-extractor new file mode 100755 index 0000000..d11d25f --- /dev/null +++ b/.mutt/tnef-extractor @@ -0,0 +1,41 @@ +#!/bin/sh +set -eu + +SELF="${0##*/}" + +if [ -z "${TMPDIR:-}" ]; then + TMPDIR=/tmp +fi +for i in $LOGNAME volatile; do + if [ -d "${TMPDIR}/$i" ]; then + TMPDIR="${TMPDIR}/$i" + break + fi +done +export TMPDIR +TMPDIR=$(mktemp -dp "$TMPDIR" tnef.XXXXXXXXXX) +cleanup() +{ + cd / && rm -r "$TMPDIR" + [ ! -t 0 ] || stty echo + trap - 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 +} +trap cleanup 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 + +cd "$TMPDIR" +tnef -v + +nfiles=$(ls -1 | wc -l) +if [ $nfiles -eq 1 ]; then + + set -x + setsid run-mailcap * & + PID=$! + ZSH_PREFILL_CMD="mv '$(echo -n *)' " x-terminal-emulator + perl -e "kill '-TERM', $PID" + +else + + ZSH_RUN_ON_LOAD="ls -l" x-terminal-emulator + +fi -- 2.39.5