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 573a7b70570d2391181a4fa114a6fe927e64b047
parent 76f64f5c0748d46c6243fdf00f696395c9993f90
Author: Jaromil <jaromil@dyne.org>
Date:   Sun, 19 Mar 2017 23:58:40 +0100

more cleanups of old PARAM var

Diffstat:
Msrc/jaro | 16++++++++--------
Msrc/zlibs/email | 2+-
Msrc/zlibs/parse | 21+++++++++++++--------
3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/jaro b/src/jaro @@ -586,7 +586,7 @@ main() { exitcode=$? ;; - queue) stdin_queue ${PARAM} + queue) stdin_queue ${option_params} exitcode=$? ;; @@ -617,7 +617,7 @@ main() { ;; update|init) - [[ "$PARAM" = "" ]] || { + [[ "$option_params" = "" ]] || { for p in $option_params; do [[ "$p" = "." ]] && p=$PWD [[ -d $p ]] && MAILDIRS=$p @@ -650,8 +650,8 @@ main() { alot) alot_search ${option_params} ;; notmuch) - notice "Command: notmuch ${PARAM}" - nm ${PARAM} | save_replay $subcommand + notice "Command: notmuch ${option_params}" + nm ${option_params} | save_replay $subcommand exitcode=$? ;; @@ -729,12 +729,12 @@ main() { ;; passwd) read_account $account - host=${PARAM:-$imap} + host=${option_params:-$imap} new_password ;; # cert) cert ${option_params} ;; # was checking is_online - isonline) is_online ${=PARAM}; exitcode=$? ;; + isonline) is_online ${option_params}; exitcode=$? ;; publish) @@ -849,10 +849,10 @@ EOF func "subcommand: $subcommand" if [[ "$subcommand" = "__empty" ]]; then # open folder - if [[ "$PARAM" = "" ]]; then + if [[ "$option_params" = "" ]]; then x_mutt -Z else - x_mutt -f "$PARAM" + x_mutt -f "$option_params" fi fi exitcode=$? diff --git a/src/zlibs/email b/src/zlibs/email @@ -57,7 +57,7 @@ stdin_compose() { act "subject: $subject" cat <<EOF | x_mutt -s "${subject// /_}" -i $ztmpfile ${=_files} -- ${=_addrs} EOF - # _mutt -H <(print "To: ${PARAM[@]}") + # _mutt -H <(print "To: ${option_params}") return $? } diff --git a/src/zlibs/parse b/src/zlibs/parse @@ -25,6 +25,8 @@ # extract all addresses found in a list of email files from stdin extract_mails() { + fn extract_mails $* + mailpaths=( ${=stdin} ) _tot=${#mailpaths} @@ -84,6 +86,11 @@ extract_mails() { # extract all addresses found into a maildir extract_maildir() { + fn extract_maildir $* + md="$1" + req=(md) + ckreq || return 1 + ## first arg is a directory md="$1" func "extract maildir: $md" @@ -109,7 +116,7 @@ extract_maildir() { } read_stdin() { # fills global stdin - fn read_stdin + fn read_stdin $* stdin="" stdin=`cat` @@ -132,7 +139,7 @@ read_stdin() { # fills global stdin } stdin_is_muttpipe() { - fn stdin_is_muttpipe + fn stdin_is_muttpipe $* req=(stdin) ckreq || return 1 @@ -144,7 +151,7 @@ stdin_is_muttpipe() { } stdin_is_pathlist() { - fn stdin_is_pathlist + fn stdin_is_pathlist $* req=(stdin) ckreq || return 1 @@ -158,15 +165,13 @@ stdin_is_pathlist() { # extract all entries in addressbook or all addresses in a pgp keyring # or all signatures on a pgp key (even without importing it) extract_addresses() { - func "extract_addresses() $PARAM" + fn extract_addresses $* # without arguments just list all entries in the active list # default is whitelist arg=${1} - func "extract() arg: $arg (param: $PARAM)" - # no arg means parse from stdin stdin=0 [[ "$arg" = "" ]] && stdin=1 @@ -376,7 +381,7 @@ BEGIN { newcard=0; c=0; name=""; email=""; } # final fallback # if no file is recognized, use string as search query - error "cannot extract any address from $PARAM" + error "cannot extract any address from $option_params" [[ "$_magic" = "" ]] || { error "file format not supported: ${_magic[(ws@:@)2]}" } return 1 @@ -384,7 +389,7 @@ BEGIN { newcard=0; c=0; name=""; email=""; } extract_headers() { - fn extract_headers + fn extract_headers $* # use cat directly, faster than read_stdin for i in `cat`; do [[ -r "$i" ]] || {