X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/7047e6e0505152b6aa2242e1975340a99f5e57e3..16ee21e5712f3cbce244a07eb0691cabc3e0406f:/procmail/tickle diff --git a/procmail/tickle b/procmail/tickle index 71edef6..8ad5ac9 100644 --- a/procmail/tickle +++ b/procmail/tickle @@ -1,21 +1,48 @@ :0 -* ORIGINAL_TO ?? ^[0-9]+@tickle\.madduck\.net$ -* ORIGINAL_TO ?? ^\/[0-9]+ +* ORIGINAL_TO ?? ^.+@tickle\.madduck\.net$ +* ORIGINAL_TO ?? ^\/[^@]+ { - TICKLEDIR=$BASE/.tickle.$MATCH - + STAMP :0 - * ? test ! -d $TICKLEDIR/cur - { - LOG="tickle: received message outside tickle range: $MATCH$NL" + * MATCH ?? ^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$ + { STAMP="$MATCH (`/bin/date -d @$MATCH +%c`)" } + + :0 E + * MATCH ?? ^[0-9]+m$ + * MATCH ?? ^\/[^m]+ + { DATESTR="$DATE + $MATCH months 00:00" } + + :0 E + * MATCH ?? ^[0-9]+w$ + * MATCH ?? ^\/[^w]+ + { DATESTR="$DATE + $MATCH weeks 00:00" } + + :0 E + * MATCH ?? ^[0-9]+d?$ + * MATCH ?? ^\/[^d]+ + { DATESTR="$DATE + $MATCH days 00:00" } - :0 - $DISCARD + :0 E + * MATCH ?? ^[0-9]+h$ + * MATCH ?? ^\/[^h]+ + { DATESTR="$DATE + $MATCH hours" } + + :0 E + { + LOG="tickle: invalid date string: $MATCH$NL" + EXITCODE=69 + HOST } - LOG="tickle: file message and tickle in $MATCH day(s)$NL" + :0 + * ! STAMP ?? . + { STAMP=`/bin/date +'%s (%c)' -d "$DATESTR"` } + + LOG="tickle: stamping message $MSGID with $STAMP$NL" + + :0 fw + |$FORMAIL -i "X-Tickle: $STAMP" :0 - $TICKLEDIR/ - TICKLEDIR + $BASE/.tickler/ }