From: martin f. krafft Date: Tue, 20 Nov 2007 17:34:22 +0000 (+0100) Subject: factor out recording of delayed delivery X-Git-Url: https://git.madduck.net/etc/mailfilter.git/commitdiff_plain/a3ee3c50317dcb2aa2b0041ee8c050d35220ff8b?hp=fa4ece019ddd60666d6b438c3d27d2e53f6c3d64 factor out recording of delayed delivery --- diff --git a/procmail/delay-delivery b/procmail/delay-delivery index c1ca0c0..3caf9f2 100644 --- a/procmail/delay-delivery +++ b/procmail/delay-delivery @@ -1,6 +1,3 @@ -# create table messages (msgid text unique not null, filename text -# primary key not null unique, release_ts integer not null); - #TODO: create config/delay-(disabled|tonight|weekend) :0 @@ -28,20 +25,12 @@ LOG="delay: delay delivery of $MSGID until $RELEASE_TIME$NL" - DELAYED_QUEUE_DB=$PMVAR/delayed-queue.sqlite - DO_QUERY="$SQLITE $DELAYED_QUEUE_DB" - - DATA="$MSGID" - INCLUDERC=$PMDIR/sql-escape - - Q="insert into messages values - ($DATA, '\\'\$DESTFILE\\'', $RELEASE_TS)" - TRAP="$TRAP; $DO_QUERY '$Q'" - :0 fw |$FORMAIL -I "X-Delayed: $RELEASE_TS ($RELEASE_TIME)" :0 $DELAYED_QUEUE + + INCLUDERC=$PMDIR/record-delayed-mail } } diff --git a/procmail/record-delayed-mail b/procmail/record-delayed-mail new file mode 100644 index 0000000..e83391b --- /dev/null +++ b/procmail/record-delayed-mail @@ -0,0 +1,18 @@ +# create table messages (msgid text unique not null, filename text +# primary key not null unique, release_ts integer not null); + +DELAYED_QUEUE_DB=$PMVAR/delayed-queue.sqlite + +DO_QUERY="$SQLITE $DELAYED_QUEUE_DB" + +DATA="$MSGID" +INCLUDERC=$PMDIR/sql-escape + +QUERY="insert into messages values + ($DATA, '\\'\$DESTFILE\\'', $RELEASE_TS)" +TRAP="$TRAP; $DO_QUERY '$QUERY'" + +QUERY +DATA +DO_QUERY +DELAYED_QUEUE_DB