madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

handle tnef attachments
authormartin f. krafft <madduck@madduck.net>
Tue, 10 Mar 2020 19:02:01 +0000 (20:02 +0100)
committermartin f. krafft <madduck@madduck.net>
Tue, 10 Mar 2020 19:02:01 +0000 (20:02 +0100)
.gitignore.d/mutt
.mutt/confvars
.mutt/tnef-extractor [new file with mode: 0755]

index a6f0ff540c28e8bafc5a062bea4c0a4faac89392..55ea528cd699eb014d1e4cba3018243a3e00d77d 100644 (file)
@@ -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
index e18f3097bff618afb6c06d0a8c661e2e027d27eb..d07933adefbbd2994636deb943302130caa43225 100644 (file)
@@ -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 (executable)
index 0000000..d11d25f
--- /dev/null
@@ -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