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 43a1eafc483e7ff1ad9711bd86788d329fbbad28
parent 46879928b148f37b160cdee7b7562d9b5f1d622f
Author: Jaromil <jaromil@dyne.org>
Date:   Mon,  3 Sep 2012 17:11:15 +0200

fixes to calling mutt binary and optional binaries in general

Diffstat:
Msrc/jaro | 41+++++++++++++++++++++++++++++------------
Msrc/zlibs/email | 2+-
Msrc/zlibs/helpers | 10+++++-----
Msrc/zlibs/search | 2+-
4 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/src/jaro b/src/jaro @@ -36,6 +36,9 @@ CLEANEXIT=1 CALLMUTT=1 TMPRAM=0 +# global variables for binaries called +typeset -h rm mkdir mutt + # which command to use when creating dirs mkdir="`which mkdir` -m 700 -p" # date stamp @@ -96,9 +99,9 @@ act() { fi } -# honor quiet flag as early as possible -echo "${@}" | grep '\-q' > /dev/null # silent -if [ "$?" = 0 ]; then QUIET=1; fi +# honor quiet and debug flags as early as possible +if [[ ${@} == *-q* ]]; then QUIET=1; fi +if [[ ${@} == *-D* ]]; then DEBUG=1; fi # what operating system are we in? use os_detect() @@ -230,9 +233,10 @@ TRAPINT() { else exit 1; fi } - +# binary programs recognition check_bin() { - # check for required programs + + # required programs for req in pinentry fetchmail procmail; do which $req >/dev/null { test $? != 0 } && { @@ -242,13 +246,26 @@ check_bin() { done # which wipe command to use - which wipe > /dev/null - { test $? = 0 } && { - rm="wipe -f -s -q -R /dev/urandom"; return 0 } - which srm > /dev/null - { test $? = 0 } && { - rm="srm -m"; return 0 } - rm="rm -f" + if [ $(which wipe) ]; then + rm="wipe -f -s -q -R /dev/urandom" + elif [ $(which srm) ]; then + rm="srm -m" + else + rm="rm -f" + fi + func "Rm binary: $rm" + + # which mutt binary to use + if [ $(which mutt-jaro) ]; then + mutt="mutt-jaro" + elif [ $(which mutt) ]; then + mutt="mutt" + else + error "Cannot find Mutt. Please install it." + return 1 + fi + func "Mutt binary: $mutt" + return 0 } diff --git a/src/zlibs/email b/src/zlibs/email @@ -315,7 +315,7 @@ EOF cp /dev/null $tmp unlink $tmp ) & - mutt-jaro -F $MUTTDIR/rc -f ${iproto}://${ilogin}@${host}${folder} + ${=mutt} -F $MUTTDIR/rc -f ${iproto}://${ilogin}@${host}${folder} } # DRYRUN return $? diff --git a/src/zlibs/helpers b/src/zlibs/helpers @@ -31,7 +31,7 @@ autostart() { { test ! -r $MUTTDIR/rc } \ && { error "Jaro Mail is not yet configured."; return 1 } - mutt-jaro -F $MUTTDIR/rc ${=muttflags} + ${=mutt} -F $MUTTDIR/rc ${=muttflags} return $? } @@ -43,7 +43,7 @@ autostart() { { test $? = 0 } && { notice "Composing message to: ${@}" # its an email, TODO see if we have it in our addressbook - mutt-jaro -F $MUTTDIR/rc ${=muttflags} ${=@} + ${=mutt} -F $MUTTDIR/rc ${=muttflags} ${=@} return 0 } @@ -51,18 +51,18 @@ autostart() { { test -r "$1" } && { # is it a maildir? then open { maildircheck ${1} } && { - mutt-jaro -F $MUTTDIR/rc ${=muttflags} -f ${1} + ${=mutt} -F $MUTTDIR/rc ${=muttflags} -f ${1} return 0 } # is it a regular file? then attach it { test -f "$1" } && { - mutt-jaro -F $MUTTDIR/rc ${=muttflags} -a ${=@} + ${=mutt} -F $MUTTDIR/rc ${=muttflags} -a ${=@} return 0 } } # or the name of a folder in Jaro Mail { test -r "$MAILDIRS/$1" } && { notice "Opening folder ${1}" - mutt-jaro -F $MUTTDIR/rc ${=muttflags} -f "$MAILDIRS/${1}" + ${=mutt} -F $MUTTDIR/rc ${=muttflags} -f "$MAILDIRS/${1}" return 0 } diff --git a/src/zlibs/search b/src/zlibs/search @@ -151,7 +151,7 @@ EOF if [ $CALLMUTT = 1 ]; then if [ $found != 0 ]; then - mutt -F $MUTTDIR/rc -R -f $TMPDIR/search.result.$id + ${=mutt} -F $MUTTDIR/rc -R -f $TMPDIR/search.result.$id notice "Found $found matches looking for '$expr' in all mail folders" exitcode=0 else error "Nothing found matching '$expr'"; fi