summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2013-12-26 13:30:06 (GMT)
committer Jaromil <jaromil@dyne.org>2013-12-26 13:42:27 (GMT)
commitf0fb63ae5e3947450fd69172e59da11c53900618 (patch)
treecbad7f0f9aa6c4c795060d975403a0d61668dc54
parent47d8c83b76ca510c272a499e3de45432b24990f0 (diff)
more fixes for new path refactoringmixmaster
-rw-r--r--src/zlibs/email45
-rw-r--r--src/zlibs/maildirs19
2 files changed, 34 insertions, 30 deletions
diff --git a/src/zlibs/email b/src/zlibs/email
index 29a8472..3ec2106 100644
--- a/src/zlibs/email
+++ b/src/zlibs/email
@@ -22,7 +22,7 @@
compose() {
# no args, open in compose mode
- tmp="${WORKDIR}/tmp/compose.$datestamp.$RANDOM"
+ tmp="${TMPDIR}/compose.$datestamp.$RANDOM"
_res=0;
echo "To: ${PARAM[@]}" > $tmp
${=mutt} -F $MUTTDIR/rc -H $tmp
@@ -176,17 +176,19 @@ fetch() {
esac
# archive old procmail log
- if [ -r $WORKDIR/log/procmail.log ]; then
- newlock $WORKDIR/log/procmail-${datestamp}.log
- cat $WORKDIR/log/procmail.log \
- >> $WORKDIR/log/procmail-${datestamp}.log
- rm -f $WORKDIR/log/procmail.log
- unlock $WORKDIR/log/procmail-${datestamp}.log
+ if [ -r $MAILDIRS/logs/procmail.log ]; then
+ newlock $MAILDIRS/logs/procmail-${datestamp}.log
+ cat $MAILDIRS/logs/procmail.log \
+ >> $MAILDIRS/logs/procmail-${datestamp}.log
+ rm -f $MAILDIRS/logs/procmail.log
+ unlock $MAILDIRS/logs/procmail-${datestamp}.log
fi
# copy addressbook in RAM for speedup
- newlock $addressbook_tmp
- cp $WORKDIR/addressbook $addressbook_tmp
+ # TODO: check if we really have ramdisk
+ # newlock $addressbook_tmp
+ # cp $WORKDIR/addressbook $addressbook_tmp
+ # unlink $addressbook_tmp
act "please wait while downloading mails..."
@@ -194,10 +196,10 @@ fetch() {
unset $fmconf
- unlink $addressbook_tmp
- total=`mailstat -k $WORKDIR/log/procmail.log | tail -n1 | awk '{print $2}'`
- briefing=`mailstat -kt $WORKDIR/log/procmail.log |awk '!/procmail/ { print " " $2 "\t" $3 }'|sort -nr`
+
+ total=`mailstat -k $MAILDIRS/logs/procmail.log | tail -n1 | awk '{print $2}'`
+ briefing=`mailstat -kt $MAILDIRS/logs/procmail.log |awk '!/procmail/ { print " " $2 "\t" $3 }'|sort -nr`
notice "$total emails fetched"
print "${briefing}"
@@ -256,27 +258,28 @@ port ${port}
tls on
tls_starttls on
tls_certcheck off
-logfile ${WORKDIR}/log/msmtp.log
+logfile ${MAILDIRS}/logs/msmtp.log
auth ${auth}
password ${password}
EOF
unset password
- for mail in `${=find} $MAILDIRS/outbox -name "*.mail"`; do
- smtp=`print ${mail} | sed -e 's/mail/msmtp/'`
- lock ${smtp}
- recipients="`cat ${smtp}`"
+ _outq=`${=find} $MAILDIRS/outbox -name '*.mail'`
+ for mail in ${(f)_outq}; do
+ smtp=`print "${mail}" | sed -e 's/mail/msmtp/'`
+ lock "$smtp"
+ recipients=`cat "${smtp}"`
act "To: ${recipients}"
msmtp -C $tmp -- ${=recipients} < "${mail}"
if [ $? != 0 ]; then
error "Error sending mail, skipped"
- unlock ${smtp}
+ unlock "$smtp"
else
act "Mail sent succesfully"
# whitelist those to whom we send mails
- cat ${mail} | $WORKDIR/bin/jaro -q learn recipient
- unlink ${smtp}
- ${=rm} ${mail}
+ cat "$mail" | $WORKDIR/bin/jaro -q learn recipient
+ unlink "$smtp"
+ ${=rm} "$mail"
fi
done
unlink $tmp
diff --git a/src/zlibs/maildirs b/src/zlibs/maildirs
index c134155..53a8e4b 100644
--- a/src/zlibs/maildirs
+++ b/src/zlibs/maildirs
@@ -84,7 +84,8 @@ rmdupes() {
{ test "$1" = "lastlog" } && {
# gather a list of destinations for last filtering operation
typeset -alU dests prio lasts
- for d in `cat ${WORKDIR}/log/procmail.log|awk '/Folder:/ {print $2}' | cut -d/ -f1`; do
+ _folders="`cat ${WORKDIR}/log/procmail.log|awk '/Folder:/ {print $2}' | cut -d/ -f1`"
+ for d in ${(f)_folders}; do
# skip procmail glitch
{ test "$d" = "procmail" } && { continue }
# put filtered to last
@@ -202,12 +203,12 @@ filter() {
update # update all filters
# archive old procmail log
- { test -r "$WORKDIR/log/procmail.log" } && {
- newlock $WORKDIR/log/procmail-${datestamp}.log
- cat $WORKDIR/log/procmail.log \
- >> $WORKDIR/log/procmail-${datestamp}.log
- ${=rm} $WORKDIR/log/procmail.log
- unlock $WORKDIR/log/procmail-${datestamp}.log
+ { test -r "$MAILDIRS/logs/procmail.log" } && {
+ newlock $MAILDIRS/logs/procmail-${datestamp}.log
+ cat $MAILDIRS/logs/procmail.log \
+ >> $MAILDIRS/logs/procmail-${datestamp}.log
+ ${=rm} $MAILDIRS/logs/procmail.log
+ unlock $MAILDIRS/logs/procmail-${datestamp}.log
}
prc=$PROCMAILDIR/rc
@@ -243,8 +244,8 @@ filter() {
unset fall
- total=`mailstat -k $WORKDIR/log/procmail.log | tail -n1 | awk '{print $2}'`
- briefing=`mailstat -kt $WORKDIR/log/procmail.log |awk '!/procmail/ { print " " $2 "\t" $3 }'|sort -nr`
+ total=`mailstat -k $MAILDIRS/logs/procmail.log | tail -n1 | awk '{print $2}'`
+ briefing=`mailstat -kt $MAILDIRS/logs/procmail.log |awk '!/procmail/ { print " " $2 "\t" $3 }'|sort -nr`
echo "${briefing}"