summaryrefslogtreecommitdiffhomepage
path: root/plugins/weblog/procmail
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-30 16:35:44 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-30 16:35:44 +0200
commit092c3cc12a7092032c77ecfb75b7c6baec1da3cb (patch)
tree6477e6ad419e24abdb509147ce5eb091f9f3bc7c /plugins/weblog/procmail
parent735d011a6cccf94eebe8bed1a6f539828a7b75e6 (diff)
Debian packaging
Diffstat (limited to 'plugins/weblog/procmail')
-rwxr-xr-xplugins/weblog/procmail/procmail.sh29
1 files changed, 15 insertions, 14 deletions
diff --git a/plugins/weblog/procmail/procmail.sh b/plugins/weblog/procmail/procmail.sh
index bafe889..44fa68f 100755
--- a/plugins/weblog/procmail/procmail.sh
+++ b/plugins/weblog/procmail/procmail.sh
@@ -46,18 +46,6 @@ if echo "$ADDR" | grep -q "weblog-bloginput" ; then
exit 1
fi
-#if grep -q "^pitch " inmail ; then
-# PITCH=`grep "^pitch " inmail|head -n1|sed -e 's/^pitch \([+-]\?[0-9]\+\(\.[0-9]\+\)\?\).*/\1/'`
-# if echo "$PITCH" | grep -q "^pitch " ; then
-# # no pitch match
-# ERRORMSG="Bad pitch syntax."
-# exit 1
-# fi
-# USERLOG="pitch $PITCH"
-#else
-# PITCH=0
-#fi
-
ALLLINES=`wc -l inmail | cut -f1 -d" "`
HEADERLINES=`cat inmail | (n=0; while read i ; do
@@ -77,12 +65,25 @@ echo "$BODY" > /home/weblog-bloginput/body.txt
SUBJECT=`echo "$HEADER" | mimedecode`
SUBJECT_PATH=`echo "$SUBJECT" | sed -e 's/[^a-zA-Z0-9]/_/g'`
-ARTICLEDIR="$BLOGDIR/`date +%Y/%Y%m%d_%H%M`_$SUBJECT_PATH"
+ARTICLEDIR="$BLOGDIR/`date +%Y/%Y%m%d`_$SUBJECT_PATH"
mkdir -p $ARTICLEDIR
echo "Subject: $SUBJECT" >> $ARTICLEDIR/article.data
echo "" >> $ARTICLEDIR/article.data
-echo "$BODY" >> $ARTICLEDIR/article.data
+
+# get attachments
+munpack -C $ARTICLEDIR `pwd`/inmail >/dev/null || true
+
+DATANAME="`ls $ARTICLEDIR/*.desc || true`" 2>/dev/null
+if [ "$DATANAME" = "" ] ; then
+ echo "$BODY" >> $ARTICLEDIR/article.data
+else
+ cat "$DATANAME" >> $ARTICLEDIR/article.data
+ rm "$DATANAME"
+fi
+
+chmod -R a+r $ARTICLEDIR
+chmod a+x $ARTICLEDIR
echo "Processed successfully." | mutt -s "Bloginput: $SUBJECT_PATH" -- "$ADDR" >> ~/log 2>&1