diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-07-30 16:15:20 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-07-30 16:15:20 +0200 |
commit | 3e96aaa793e6bccc89006d55b0b6f49ac56907ec (patch) | |
tree | b2fa75cdadf112b5b6a6def3809d2b04ae162881 | |
parent | e88ade983fca58fc5b5592be4ad7734ae0bb121f (diff) |
sfeed_maildir: initial version, needs more work
-rw-r--r-- | procmailrc.example | 17 | ||||
-rwxr-xr-x | sfeed_maildir | 21 |
2 files changed, 38 insertions, 0 deletions
diff --git a/procmailrc.example b/procmailrc.example new file mode 100644 index 0000000..5f0e517 --- /dev/null +++ b/procmailrc.example @@ -0,0 +1,17 @@ +# Example for use with sfeed_maildir. +# The header X-Feedname is used to split into separate maildirs. It is assumes +# this name is sane. + +MAILDIR="$HOME/feeds/" + +:0 +* ^X-Feedname: \/.* +{ + FEED="$MATCH" + + :0 Wh: "msgid_$FEED.lock" + | formail -D 1024000 ".cache/msgid_$FEED.cache" + + :0 + "$FEED"/ +} diff --git a/sfeed_maildir b/sfeed_maildir new file mode 100755 index 0000000..099bc13 --- /dev/null +++ b/sfeed_maildir @@ -0,0 +1,21 @@ +#!/bin/sh +# Uses procmail to format mbox to maildir, see procmailrc.example. +# Copy procmailrc.example to $procmailconfig (see below). +# Depends on: procmail, formail, sfeed_mbox. + +maildir="$HOME/feeds" +feedsdir="$HOME/.sfeed/feeds" +procmailconfig="$HOME/.sfeed/procmailrc" + +# message-id cache to prevent duplicates. +mkdir -p "${maildir}/.cache" + +find "${feedsdir}" -type f -exec printf '%s\n' {} \; | while read -r d; do + (name=$(basename "${d}") + mkdir -p "${maildir}/${name}/cur" + mkdir -p "${maildir}/${name}/new" + mkdir -p "${maildir}/${name}/tmp" + printf 'Mailbox %s\n' "${name}" + sfeed_mbox "${d}" | formail -s procmail "${procmailconfig}") & +done +wait |