commit a5cd1e594e096dc3b35c629e16a2fcabaa478a8c
parent 9dc1837d6295ef0d443163d751835c0fe105f3ad
Author: Jaromil <jaromil@dyne.org>
Date:   Fri, 31 Aug 2012 16:35:32 +0200
small fix to account selection
Diffstat:
2 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/jaro b/src/jaro
@@ -52,7 +52,7 @@ typeset -A global_opts
 typeset -A opts
 
 # global variable for account selection
-typeset -h account
+typeset -h account account_type
 # account=default
 typeset -h list
 list=whitelist
@@ -233,7 +233,7 @@ TRAPINT() {
 
 check_bin() {
     # check for required programs
-    for req in pinentry fetchmail procmail mutt; do
+    for req in pinentry fetchmail procmail; do
 	which $req >/dev/null
 	{ test $? != 0 } && {
 	    error "Cannot find $req. Please install it."
diff --git a/src/zlibs/email b/src/zlibs/email
@@ -65,33 +65,26 @@ fetchall() {
     res=0
     for i in `find $WORKDIR/Accounts -type f | grep -v README`; do
 	account=`basename $i`
-	type=`print $account | cut -d. -f1`
+	account_type=`print $account | cut -d. -f1`
 	account=`print $account | cut -d. -f2`
-	fetch $type $account
+	fetch
 	if [ $? != 0 ]; then res=1; fi
 	# returns an error if just one of the accounts did
     done
     return $res
 }
 fetch() {
-
-    func "Fetch account ${@}"
-    # recursion here
-    { test ${#@} = 0 } && { fetchall; return $? }
-
-    adir=$WORKDIR/Accounts
-
-    typeset -al all
-
-    read_account ${=@}
-
+    { test "$account" = "" } && {
+	fetchall; return $? }
+	
+    read_account ${account_type} ${account}
     { test  $? != 0 } && {
-	error "Account configuration not found, or broken. Aborting operation."
+	error "Error on account entry: $account_type $account"
 	return 1
     }
 
     # fetch works with imap and pop, skip smtp
-    { test "$type" = "smtp" } && { return 0 }
+    { test "$account_type" = "smtp" } && { return 0 }
 
     if ! [ -r $PROCMAILDIR/rc ]; then
 	act "updating procmail configuration"