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

rewrite processing of postponed messages
[etc/mailfilter.git] / procmail / tickle
1 # The X-Tickle header has priority over the Original-To address
2 :0
3 *$ ^X-Tickle:${RE_SPACE}+\/${RE_NOT_SPACE}+
4 { TICKLE="$MATCH" }
5
6 :0 E
7 * ! POSTPONED ?? .
8 * ORIGINAL_TO ?? ^.+@tickle\.madduck\.net$
9 * ORIGINAL_TO ?? ^\/[^@]+
10 { TICKLE="$MATCH" }
11
12 :0
13 * TICKLE ?? .
14 * ! DEST ?? .
15 {
16   DAILY_DELIVERY_TIME=04:20
17   JUST_DATE="`$BIN_DATE -d \"$DATE\" +%x`"
18
19   :0
20   * TICKLE ?? ^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$
21   { DELAY="@$TICKLE" }
22
23   :0 E
24   * TICKLE ?? ^[0-9]+h$
25   * TICKLE ?? ^\/[^h]+
26   { DELAY="$DATE + $MATCH hours" }
27
28   :0 E
29   * TICKLE ?? ^[0-9]+m$
30   * TICKLE ?? ^\/[^m]+
31   { DELAY="$JUST_DATE + $MATCH months $DAILY_DELIVERY_TIME" }
32
33   :0 E
34   * TICKLE ?? ^[0-9]+w$
35   * TICKLE ?? ^\/[^w]+
36   { DELAY="$JUST_DATE + $MATCH weeks $DAILY_DELIVERY_TIME" }
37
38   :0 E
39   * TICKLE ?? ^[0-9]+d?$
40   * TICKLE ?? ^\/[^d]+
41   { DELAY="$JUST_DATE + $MATCH days $DAILY_DELIVERY_TIME" }
42
43   :0 E
44   {
45     LOG="tickle:      invalid tickler date string: $TICKLE$NL"
46     EXITCODE=69
47     HOST
48   }
49
50   JUST_DATE
51   DAILY_DELIVERY_TIME
52
53   :0
54   { RELEASE="`$BIN_DATE -d \"$DELAY\" +'%s (%c)'`" }
55
56   LOG="tickle:      delaying message until $RELEASE$NL"
57   DELAYED_QUEUE=$TICKLER_QUEUE
58
59   :0 fw
60   |$FORMAIL -I"X-Tickle: $RELEASE"
61
62   # unset DISABLE_DELAYS to always enable delaying for tickle messages
63   DISABLE_DELAYS
64 }
65
66 TICKLE
67
68 # vim:ft=procmail