]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/tickle

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:

remove verbose output
[etc/mailfilter.git] / procmail / tickle
1 :0
2 * ! DEST ?? .
3 * ! TICKLE_DELIVERED ?? .
4 * ORIGINAL_TO ?? ^.+@tickle\.madduck\.net$
5 * ORIGINAL_TO ?? ^\/[^@]+
6 {
7   BIN_DATE=/bin/date
8   DELIVERY_TIME=04:20
9   STAMP
10
11   :0
12   * MATCH ?? ^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$
13   { STAMP="$MATCH (`$BIN_DATE -d @$MATCH +%c`)" }
14
15   :0 E
16   * MATCH ?? ^[0-9]+h$
17   * MATCH ?? ^\/[^h]+
18   { DATESTR="$DATE + $MATCH hours" }
19
20   JUST_DATE="`$BIN_DATE -d \"$DATE\" +%x`"
21
22   :0 E
23   * MATCH ?? ^[0-9]+m$
24   * MATCH ?? ^\/[^m]+
25   { DATESTR="$JUST_DATE + $MATCH months $DELIVERY_TIME" }
26
27   :0 E
28   * MATCH ?? ^[0-9]+w$
29   * MATCH ?? ^\/[^w]+
30   { DATESTR="$JUST_DATE + $MATCH weeks $DELIVERY_TIME" }
31
32   :0 E
33   * MATCH ?? ^[0-9]+d?$
34   * MATCH ?? ^\/[^d]+
35   { DATESTR="$JUST_DATE + $MATCH days $DELIVERY_TIME" }
36
37   JUST_DATE
38   DELIVERY_TIME
39
40   :0 E
41   {
42     LOG="tickle:      invalid date string: $MATCH$NL"
43     EXITCODE=69
44     HOST
45   }
46
47   :0
48   * ! STAMP ?? .
49   { STAMP=`$BIN_DATE +'%s (%c)' -d "$DATESTR"` }
50
51   :0
52   * ! STAMP ?? ^[0-9]+ \([A-Za-z ]+ [0-9 :]+\)$
53   {
54     LOG="tickle:      error creating timestamp ($STAMP), using \$now$NL"
55     STAMP="`$BIN_DATE +%s` (ERROR: original stamp '$STAMP' invalid)"
56   }
57
58   :0 E
59   { LOG="tickle:      stamping message $MSGID with $STAMP$NL" }
60
61   :0 fw
62   |$FORMAIL -i "X-Tickle: $STAMP"
63
64   :0
65   { DEST=$TICKLER_QUEUE }
66
67   BIN_DATE
68 }
69
70 # vim:ft=procmail