jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

commit e13c885909310c075620dcaf9eeb4e35c6425235
parent d8beab6d05574d3bcdf6d21320fc4e19923ecb66
Author: Jaromil <jaromil@dyne.org>
Date:   Fri, 21 Feb 2014 14:04:29 +0100

fixes for usage on ubuntu with system-wide tools

Diffstat:
Msrc/jaro | 19+++++++++++++------
Msrc/zlibs/filters | 20+++++++++++++++-----
Msrc/zlibs/helpers | 2+-
3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/src/jaro b/src/jaro @@ -72,7 +72,7 @@ typeset -al maildirs typeset -h formail_cache # global variable for mutt binary -typeset -h mutt +typeset -h mutt pgpewrap dotlock # global variable for exit code typeset exitcode @@ -181,7 +181,7 @@ else fi # temporary directory -TMPDIR="$MAILDIRS/tmp" +TMPDIR="$MAILDIRS/tmp/jaromil.$USER" case $OS in GNU) touch /dev/shm/jaromail.test.tmp > /dev/null @@ -253,7 +253,7 @@ GNOMEKEY=0 cleanexit() { func "Clean exit procedures" - + sleep 3 unset name login host protocol port password auth folders accountopt # security check @@ -307,7 +307,7 @@ TRAPINT() { { test $CLEANEXIT = 1 } && { error "Forced removal of locks" - cleanexit } + cleanexit & } if [ "$DEBUG" = "1" ]; then return 1 else exit 1; fi @@ -344,9 +344,16 @@ check_bin() { # which mutt binary to use if command -v mutt-jaro > /dev/null; then - mutt="mutt-jaro" + # in-house compiled + mutt=mutt-jaro + pgpewrap=pgpewrap + dotlock=dotlock elif command -v mutt > /dev/null; then + # system-wite mutt="mutt" + # TODO: check if this is also the location on Fedora + pgpewrap="/usr/lib/mutt/pgpewrap" + dotlock="mutt_dotlock" else error "Cannot find Mutt. Please install it." exit 1 @@ -681,5 +688,5 @@ main() if [ "$1" != "source" ]; then check_bin; fi main $@ -{ test "$CLEANEXIT" = "1" } && { cleanexit } +{ test "$CLEANEXIT" = "1" } && { cleanexit & } return $exitcode diff --git a/src/zlibs/filters b/src/zlibs/filters @@ -48,6 +48,10 @@ update() { ###### # MUTT + act "configuring Mutt's environment" + func "binary: $mutt" + func "pgpewrap: $pgpewrap" + func "lock: $dotlock" ${=mkdir} $MUTTDIR ${=mkdir} $MUTTDIR/cache rm -f $MUTTDIR/rc @@ -89,6 +93,11 @@ EOF { test -r $MAILDIRS/Mutt.txt } && { print "source '$MAILDIRS/Mutt.txt'" >> $MUTTDIR/rc } + + +##################### +# helper applications +act "configuring helper applications" cat <<EOF >> $MUTTDIR/rc ## end of Jaro Mail generated muttrc #################################### @@ -116,7 +125,8 @@ EOF text/html; lynx -dump -assume_charset=%{charset} %s; nametemplate=%s.html; copiousoutput EOF fi - apptypes=`cat ${WORKDIR}/Applications.txt` + + apptypes=`cat ${MAILDIRS}/Applications.txt` for t in ${(f)apptypes}; do eval `print $t | awk ' { print "_type=" $1 "; _app=" $2 ";" }'` @@ -142,7 +152,7 @@ EOF ####### # SIEVE - act "generating sieve filters" + act "generating procmail and sieve filter rules" id=$datestamp.$RANDOM sieve=$MAILDIRS/Filters.sieve lock $sieve @@ -191,7 +201,6 @@ EOF ########## # PROCMAIL - act "generating procmail filters" ${=mkdir} $PROCMAILDIR rm -f $PROCMAILDIR/rc touch $PROCMAILDIR/rc @@ -231,6 +240,7 @@ zz.bounces/ EOF ####### + act "compiling rules for mailinglists" print "# filters generated from Filters.txt" >> $PROCMAILDIR/rc typeset -alU filter_from @@ -313,7 +323,7 @@ EOF #### SIEVE - +act "compiling whitelist rules from addressbook" func "generating whitelist for sieve filters" cat <<EOF >> $sieve # whitelist @@ -384,7 +394,7 @@ EOF if header :contains "To" [ EOF typeset -alU recv - for f in `${=find} $WORKDIR/Accounts/ -type f | grep -v 'smtp'`; do + for f in `${=find} $MAILDIRS/Accounts/ -type f | grep -v 'smtp'`; do for addr in `cat $f | awk ' /^email/ { print $2 } /^alias/ { print $2 } diff --git a/src/zlibs/helpers b/src/zlibs/helpers @@ -96,7 +96,7 @@ jarovim() { edit_file() { { test ${EDITOR} } && { _editor="${EDITOR}" } { test ${JARO_EDITOR} } && { _editor="$JARO_EDITOR" } - + { test "$_editor" = "" } && { _editor=vim } case $_editor in # refine settings for email vi|vim) jarovim "${PARAM}"; return $? ;;