sfeed_mbox: add fdm and procmail examples from README to test sfeed_mbox - sfeed_tests - sfeed tests and RSS and Atom files
HTML git clone git://git.codemadness.org/sfeed_tests
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit d2b1fd533cb76b9d553f5d331ccf46108410e2c9
DIR parent d283a18f897a8c185dea4adecfa8629cdb841c2b
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 23 Dec 2025 14:57:58 +0100
sfeed_mbox: add fdm and procmail examples from README to test sfeed_mbox
Diffstat:
A input/sfeed_mbox/fdm/fdm.conf | 29 +++++++++++++++++++++++++++++
A input/sfeed_mbox/fdm/run.sh | 7 +++++++
A input/sfeed_mbox/procmail/procmail… | 23 +++++++++++++++++++++++
A input/sfeed_mbox/procmail/procmail… | 17 +++++++++++++++++
4 files changed, 76 insertions(+), 0 deletions(-)
---
DIR diff --git a/input/sfeed_mbox/fdm/fdm.conf b/input/sfeed_mbox/fdm/fdm.conf
@@ -0,0 +1,29 @@
+set unmatched-mail keep
+
+account "sfeed" mbox "%[home]/p/sfeed_tests/input/sfeed_mbox/fdm/mbox"
+ $cachepath = "%[home]/p/sfeed_tests/input/sfeed_mbox/fdm/fdm.cache"
+ cache "${cachepath}"
+ $maildir = "%[home]/p/sfeed_tests/input/sfeed_mbox/fdm/maildir/"
+
+ # Check if message is in the cache by Message-ID.
+ match case "^Message-ID: (.*)" in headers
+ action {
+ tag "msgid" value "%1"
+ }
+ continue
+
+ # If it is in the cache, stop.
+ match matched and in-cache "${cachepath}" key "%[msgid]"
+ action {
+ keep
+ }
+
+ # Not in the cache, process it and add to cache.
+ match case "^X-Feedname: (.*)" in headers
+ action {
+ # Store to local maildir.
+ maildir "${maildir}%1"
+
+ add-to-cache "${cachepath}" key "%[msgid]"
+ keep
+ }
DIR diff --git a/input/sfeed_mbox/fdm/run.sh b/input/sfeed_mbox/fdm/run.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+sfeed_mbox ~/.sfeed/feeds/* > mbox
+fdm -v -f fdm.conf fetch
+
+# cleanup
+#rm -f fdm.cache mbox
+#rm -rf maildir
DIR diff --git a/input/sfeed_mbox/procmail/procmail_maildirs.sh b/input/sfeed_mbox/procmail/procmail_maildirs.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+maildir="$(pwd)/maildir"
+feedsdir="$HOME/.sfeed/feeds"
+procmailconfig="$(pwd)/procmailrc"
+
+# message-id cache to prevent duplicates.
+mkdir -p "${maildir}/.cache"
+
+if ! test -r "${procmailconfig}"; then
+ printf "Procmail configuration file \"%s\" does not exist or is not readable.\n" "${procmailconfig}" >&2
+ echo "See procmailrc.example for an example." >&2
+ exit 1
+fi
+
+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
DIR diff --git a/input/sfeed_mbox/procmail/procmailrc b/input/sfeed_mbox/procmail/procmailrc
@@ -0,0 +1,17 @@
+# Example for use with sfeed_mbox(1).
+# The header X-Feedname is used to split into separate maildirs. It is
+# assumed this name is sane.
+
+MAILDIR="$HOME/p/sfeed_tests/input/sfeed_mbox/procmail/maildir/"
+
+:0
+* ^X-Feedname: \/.*
+{
+ FEED="$MATCH"
+
+ :0 Wh: "msgid_$FEED.lock"
+ | formail -D 1024000 ".cache/msgid_$FEED.cache"
+
+ :0
+ "$FEED"/
+}