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

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:

fix up ourdate variables
[etc/mailfilter.git] / procmail / delay-delivery
1 # create table messages (msgid text unique not null, filename text
2 # primary key not null unique, release_ts integer not null);
3
4 :0
5 * DELAY ?? .
6 * ! DELAYED ?? .
7 {
8   #TODO: for tickling, use header date
9   RELEASE="`date -d \"now + $DELAY\" +'%s %c'`"
10   :0
11   *$ RELEASE ?? ^\/${RE_NOT_SPACE}+
12   { RELEASE_TS=$MATCH }
13   :0
14   *$ RELEASE ?? ^[0-9]+${RE_SPACE}+\/.+
15   { RELEASE_TIME="$MATCH" }
16
17   LOG="delay:       delay delivery of $MSGID until $RELEASE_TIME$NL"
18
19   DELAYED_QUEUE_DB=$PMVAR/delayed-queue.sqlite
20   DO_QUERY="$SQLITE $DELAYED_QUEUE_DB"
21
22   DATA="$MSGID"
23   INCLUDERC=$PMDIR/sql-escape
24
25   Q="insert into messages values
26      ($DATA, '\\'\$DESTFILE\\'', $RELEASE_TS)"
27   TRAP="$TRAP; $DO_QUERY '$Q'"
28
29   :0 fw
30   |$FORMAIL -I "X-Delayed: $RELEASE_TS ($RELEASE_TIME)"
31
32   :0
33   $DELAYED_QUEUE
34 }