From 092c3cc12a7092032c77ecfb75b7c6baec1da3cb Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 30 Apr 2020 16:35:44 +0200 Subject: Debian packaging --- plugins/weblog/procmail/procmail.sh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'plugins/weblog/procmail') 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 -- cgit v1.2.3