]> 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:

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