summaryrefslogtreecommitdiffhomepage
path: root/plugins/weblog
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/weblog')
-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