commit f69dd5996d3be1649f220b55b0634e11ce4968a7
parent 43174c152a006e986c963a366afff8f3bcde49aa
Author: Jaromil <jaromil@dyne.org>
Date:   Tue,  6 Jan 2015 19:59:46 +0100
build/install and other minor fixes
Diffstat:
4 files changed, 51 insertions(+), 50 deletions(-)
diff --git a/build/install-gnu.sh b/build/install-gnu.sh
@@ -15,7 +15,7 @@ mkdir -p $JARO_LIBEXEC
 { test -r doc } && { srcdir=. }
 { test -r install-gnu.sh } && { srcdir=.. }
 
-{ test -r $srcdir/src/fetchdate } || {
+{ test -r $srcdir/src/fetchaddr } || {
     print "Error: first build, then install."; return 1 }
 
 mkdir -p $JARO_SHARE/{.mutt,.stats}
diff --git a/src/jaro b/src/jaro
@@ -594,20 +594,19 @@ main()
     subcommand="__default"
     fi
 
-# QUAA
     if [[ -z ${(k)subcommands_opts[$subcommand]} ]]; then
- # unknown command, pass it to autostart
-    func "unknown command, autostart: $@"
-    autostart ${=@}
-    exitcode=$?
-    { test $exitcode != 0 } && {
-        error "command \"$subcommand\" not recognized"
-        act "try -h for help"
-        CLEANEXIT=0
-    }
-    return $exitcode
+        # unknown command, pass it to autostart
+        func "unknown command, autostart: $@"
+        autostart ${=@}
+        exitcode=$?
+        [[ $exitcode = 0 ]] || {
+            error "command \"$subcommand\" not recognized"
+            act "try -h for help"
+            CLEANEXIT=0
+        }
+        return $exitcode
     fi
-
+    
     argv=(${oldstar})
     unset oldstar
 
diff --git a/src/zlibs/helpers b/src/zlibs/helpers
@@ -102,52 +102,54 @@ refile() {
     [[ $DRYRUN = 0 ]] && mv $src ${dst}/${pos}/
 }
 
-autostart() {
-
-# no argument passed. open first folder with new mail
-    { test -z ${1} } && {
-
-    { test ! -r $MUTTDIR/rc } \
-        && { error "Jaro Mail is not yet configured."
-         error "To configure, edit the files in $MAILDIRS/Accounts"
-         return 1 }
-
-    ${=mutt} -F $MUTTDIR/rc ${=muttflags} -Z
-    return $?
+autostart() {    
+    # no argument passed. open first folder with new mail
+    [[ "$1" = "" ]] && {
+        
+        [[ -r $MUTTDIR/rc ]] || {
+            error "Jaro Mail is not yet configured."
+            error "To configure, edit the files in $MAILDIRS/Accounts"
+            error "Then run 'jaro update' at least once."
+            return 1
+        }
+        
+        ${=mutt} -F $MUTTDIR/rc ${=muttflags} -Z
+        return $?
     }
 
     # argument passed: determine if an email
-    print "${1}" \
-    | tr 'A-Z' 'a-z' \
-    | grep '^[a-zA-Z0-9._%+-]*@[a-zA-Z0-9]*[\.[a-zA-Z0-9]*]*[a-zA-Z0-9]$' \
-    > /dev/null
-    { test $? = 0 } && {
-    notice "Composing message to: ${@}"
-    # its an email, TODO see if we have it in our addressbook
-    ${=mutt} -F $MUTTDIR/rc ${=muttflags} ${=@}
-    return 0
+    isemail "$1"
+    [[ $? = 0 ]] && {
+        notice "Composing message to: ${@}"
+        # its an email, TODO see if we have it in our addressbook
+        ${=mutt} -F $MUTTDIR/rc ${=muttflags} ${=@}
+        return 0
     }
 
     # or a directory of file
-    { test -r "$1" } && {
-    # is it a maildir? then open
-    { maildircheck ${1} } && {
-        ${=mutt} -F $MUTTDIR/rc ${=muttflags} -f ${1}
-        return 0 }
-    # is it a regular file? then attach it
-    { test -f "$1" } && {
-        ${=mutt} -F $MUTTDIR/rc ${=muttflags} -a ${=@}
-        return 0 }
+    [[ -r "$1" ]] && {
+        # is it a maildir? then open
+        maildircheck ${1}
+        [[ $? = 0 ]] && {
+            ${=mutt} -F $MUTTDIR/rc ${=muttflags} -f ${1}
+            return 0
+        }
+        # is it a regular file? then attach it
+        [[ -f "$1" ]] && {
+            ${=mutt} -F $MUTTDIR/rc ${=muttflags} -a ${=@}
+            return 0
+        }
     }
 
     # or the name of a folder in Jaro Mail
-    { maildircheck "$MAILDIRS/$1" } && {
-    notice "Opening folder ${1}"
-    ${=mutt} -F $MUTTDIR/rc ${=muttflags} -f "$MAILDIRS/${1}"
-    return 0
+    maildircheck "$MAILDIRS/$1"
+    [[ $? = 0 ]] && {
+        notice "Opening folder ${1}"
+        ${=mutt} -F $MUTTDIR/rc ${=muttflags} -f "$MAILDIRS/${1}"
+        return 0
     }
 
-    return $?
+    return 1
 }
 
 
diff --git a/src/zlibs/keyring b/src/zlibs/keyring
@@ -97,7 +97,7 @@ ask_password() {
 		{ test "$lookup" = "" } || {
 		    act "Saved password found for $email ($transport on $host)"
 		    notice "Type the password to unlock this keyring entry:"
-		    password="`print $lookup | base64 -d | gpg -d --cipher-algo AES256 --openpgp --no-options`"
+		    password="`print - $lookup | base64 -d | gpg -d --cipher-algo AES256 --openpgp --no-options`"
 		    { test "$?" = 0 } || { error "Incorrect password to unlock local keyring entry, operation aborted."; return 1 }
 		    return 0
 		}
@@ -205,7 +205,7 @@ EOF
 		            func "new pass hash for: $login:$host"
 		            lookup="`lookup_secret ${_hash} rowid`"
 		            notice "Select the password to lock this keyring entry:"
-		            _password="`print $password | gpg -c --cipher-algo AES256 --openpgp --no-options | base64`"
+		            _password="`print - $password | gpg -c --cipher-algo AES256 --openpgp --no-options | base64`"
                                         
 		            if [ "$lookup" = "" ]; then # new entry
 			            cat <<EOF | ${SQL} -batch "$KEYRING"