From: martin f. krafft Date: Sun, 26 Aug 2007 18:27:22 +0000 (+0200) Subject: add first version of tickle stamp header maker X-Git-Url: https://git.madduck.net/etc/mutt.git/commitdiff_plain/507c9dd0be73010ae4112850bd86d5387298914f?hp=4678ce164323608901041c44f2229cfadbccd677 add first version of tickle stamp header maker --- diff --git a/add-tickle-stamp b/add-tickle-stamp new file mode 100755 index 0000000..c712f61 --- /dev/null +++ b/add-tickle-stamp @@ -0,0 +1,46 @@ +#!/bin/sh +set -eu + +file=/dev/stdin +if [ -r "${1:-}" ] && [ -w "${1:-}" ]; then + file="$1" + shift +fi + +date= +arg="${1:-}" +args="$*" +if [ -z "$arg" ]; then + read -p 'When should I tickle you about this message? ' args + arg="${args%% *}" +fi + +if [ "$arg" = '-d' ] || [ $# -gt 1 ]; then + shift + date="$args" +else + case "$arg" in + *[0-9]w) date="now + ${arg%w} weeks 00:00";; + *[0-9]m) date="now + ${arg%m} months 00:00";; + *[0-9]h) date="now + ${arg%h} hours";; + *[0-9]d) date="now + ${arg%d} days 00:00";; + *' '*) date="$args";; + *[!0-9]*) + echo "E: invalid argument: $arg" >&2 + exit 1 + ;; + *) date="now + $arg days 00:00";; + esac +fi + +tickle=$(date +'%s (%c)' -d "$date") + +TMPFILE="$(tempfile -d /tmp -p tickle)" +trap "rm -f $TMPFILE" 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 + +formail -i "X-Tickle: $tickle" < $file > $TMPFILE + +[ -w "$file" ] && mv $TMPFILE $file + +rm -f $TMPFILE +trap - 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 diff --git a/headers b/headers index c0e146e..892048f 100644 --- a/headers +++ b/headers @@ -13,6 +13,7 @@ hdr_order x-trained-as x-crm114-autotrain hdr_order user-agent x-mailer x-newsreader hdr_order x-justme hdr_order x-autoreplied +hdr_order x-tickle ignore * unignore date @@ -29,5 +30,6 @@ unignore x-spam: #unignore user-agent x-mailer x-newsreader unignore x-justme unignore x-autoreplied +unignore x-tickle # vim:ft=muttrc