summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/mw522
1 files changed, 261 insertions, 261 deletions
diff --git a/bin/mw b/bin/mw
index 44086be..0cb7809 100755
--- a/bin/mw
+++ b/bin/mw
@@ -22,7 +22,7 @@ notmuchtemp="$muttshare/notmuch-temp"
# Therefore, some default variables that might be otherwise overwritten are set
# here.
iport="993"
-sport="465"
+sport="587"
imapssl="IMAPS"
tlsline="tls_starttls off"
maxmes="0"
@@ -32,29 +32,29 @@ alias mbsync='mbsync -c "$mbsyncrc"'
# mbsync now requires "Far/Near" rather than "Master/Slave", but Ubuntu/Debian
# have the older version.
if command -V apt-get >/dev/null 2>&1; then
- master="Master"
- slave="Slave"
+ master="Master"
+ slave="Slave"
else
- master="Far"
- slave="Near"
+ master="Far"
+ slave="Near"
fi
for x in "/etc/ssl/certs/ca-certificates.crt" \
- "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/cert.pem" \
- "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" \
- "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" \
- "/usr/local/share/ca-certificates/"; do
- [ -f "$x" ] && sslcert="$x" && break
+ "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/cert.pem" \
+ "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" \
+ "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" \
+ "/usr/local/share/ca-certificates/"; do
+ [ -f "$x" ] && sslcert="$x" && break
done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1; }
checkbasics() {
- command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2"
- PASSWORD_STORE_DIR="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
- [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] || {
- echo "First run \`pass init <yourgpgemail>\` to set up a password archive."
- echo "(If you don't already have a GPG key pair, first run \`$GPG --full-generate-key\`.)"
- exit 1
- }
+ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2"
+ PASSWORD_STORE_DIR="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
+ [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] || {
+ echo "First run \`pass init <yourgpgemail>\` to set up a password archive."
+ echo "(If you don't already have a GPG key pair, first run \`$GPG --full-generate-key\`.)"
+ exit 1
+ }
}
getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S*.muttrc" | sed "s|.*/\([0-9]-\)*||;s/\.muttrc$//" | nl)"; }
@@ -62,207 +62,207 @@ getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S*
list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1; }
prepmsmtp() {
- mkdir -p "${msmtprc%/*}" "${msmtplog%/*}"
- ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null
- envsubst <"$msmtptemp" >>"$msmtprc"
+ mkdir -p "${msmtprc%/*}" "${msmtplog%/*}"
+ ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null
+ envsubst <"$msmtptemp" >>"$msmtprc"
}
prepmbsync() {
- mkdir -p "${mbsyncrc%/*}"
- [ -f "$mbsyncrc" ] && echo >>"$mbsyncrc"
- envsubst <"$mbsynctemp" >>"$mbsyncrc"
+ mkdir -p "${mbsyncrc%/*}"
+ [ -f "$mbsyncrc" ] && echo >>"$mbsyncrc"
+ envsubst <"$mbsynctemp" >>"$mbsyncrc"
}
prepmpop() {
- mkdir -p "${mpoprc%/*}"
- envsubst <"$mpoptemp" >>"$mpoprc"
+ mkdir -p "${mpoprc%/*}"
+ envsubst <"$mpoptemp" >>"$mpoprc"
}
prepmutt() {
- mkdir -p "${muttrc%/*}" "$accdir"
- envsubst <"$mutttemp" >"$accdir/$fulladdr.muttrc"
- [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" >"$muttrc"
- ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >>"$muttrc"
- ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >>"$muttrc"
- echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\"" >>"$muttrc"
+ mkdir -p "${muttrc%/*}" "$accdir"
+ envsubst <"$mutttemp" >"$accdir/$fulladdr.muttrc"
+ [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" >"$muttrc"
+ ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >>"$muttrc"
+ ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >>"$muttrc"
+ echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\"" >>"$muttrc"
}
getprofiles() {
- safename="$(echo $fulladdr | sed 's/@/_/g')"
- case "$type" in
- online)
- folder="imaps://$login@$imap:$iport"
- extra="$(envsubst <"$onlinetemp")"
- ;;
- pop) prepmpop ;;
- *)
- case "$iport" in
- 1143) imapssl=None ;;
- 143) imapssl=STARTTLS ;;
- esac
- prepmbsync
- ;;
- esac
- prepmsmtp
- prepmutt
- prepnotmuch
+ safename="$(echo $fulladdr | sed 's/@/_/g')"
+ case "$type" in
+ online)
+ folder="imaps://$login@$imap:$iport"
+ extra="$(envsubst <"$onlinetemp")"
+ ;;
+ pop) prepmpop ;;
+ *)
+ case "$iport" in
+ 1143) imapssl=None ;;
+ 143) imapssl=STARTTLS ;;
+ esac
+ prepmbsync
+ ;;
+ esac
+ prepmsmtp
+ prepmutt
+ prepnotmuch
}
parsedomains() {
- serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)"
+ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)"
- [ -z "$serverinfo" ] && serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)"
+ [ -z "$serverinfo" ] && serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)"
- IFS=, read -r service imapsugg iportsugg smtpsugg sportsugg <<EOF
+ IFS=, read -r service imapsugg iportsugg smtpsugg sportsugg <<EOF
$serverinfo
EOF
- imap="${imap:-$imapsugg}"
- smtp="${smtp:-$smtpsugg}"
- sport="${sport:-$sportsugg}"
- iport="${iport:-$iportsugg}"
+ imap="${imap:-$imapsugg}"
+ smtp="${smtp:-$smtpsugg}"
+ sport="${sport:-$sportsugg}"
+ iport="${iport:-$iportsugg}"
}
delete() {
- if [ -z "${fulladdr+x}" ]; then
- echo "Select the account you would like to delete (by number):"
- list || exit 1
- read -r input
- match="^\s*$input\s\+"
- else
- match="\s\+$fulladdr$"
- getaccounts
- fi
-
- fulladdr="$(echo "$accounts" | grep "$match" | grep -o "\S*@\S*")"
-
- [ -z "$fulladdr" ] && echo "$fulladdr is not a valid account name." && return 1
-
- sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null
- rm -f "$mbsyncrc"bu
- rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/$fulladdr.muttrc" "$accdir/"[0-9]-"$fulladdr.muttrc"
- sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null
- rm -f "$muttrc"bu
- sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null
- rm -f "$msmtprc"bu
- sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null
- rm -f "$mpoprc"bu
- pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1
- [ -n "${purge+x}" ] && safename="$(echo $fulladdr | sed 's/@/_/g')" && rm -rf "${cachedir:?}/${safename:?}" "${maildir:?}/${fulladdr:?}"
+ if [ -z "${fulladdr+x}" ]; then
+ echo "Select the account you would like to delete (by number):"
+ list || exit 1
+ read -r input
+ match="^\s*$input\s\+"
+ else
+ match="\s\+$fulladdr$"
+ getaccounts
+ fi
+
+ fulladdr="$(echo "$accounts" | grep "$match" | grep -o "\S*@\S*")"
+
+ [ -z "$fulladdr" ] && echo "$fulladdr is not a valid account name." && return 1
+
+ sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null
+ rm -f "$mbsyncrc"bu
+ rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/$fulladdr.muttrc" "$accdir/"[0-9]-"$fulladdr.muttrc"
+ sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null
+ rm -f "$muttrc"bu
+ sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null
+ rm -f "$msmtprc"bu
+ sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null
+ rm -f "$mpoprc"bu
+ pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1
+ [ -n "${purge+x}" ] && safename="$(echo $fulladdr | sed 's/@/_/g')" && rm -rf "${cachedir:?}/${safename:?}" "${maildir:?}/${fulladdr:?}"
}
askinfo() {
- [ -z "$fulladdr" ] && echo "Give the full email address to add:" &&
- read -r fulladdr
- while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-Za-z]+$"; do
- echo "$fulladdr is not a valid email address. Please retype the address:"
- read -r fulladdr
- done
- folder="$maildir/$fulladdr"
- getaccounts
- echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null &&
- { echo "$fulladdr has already been added" && exit 1; }
- { [ -z "$imap" ] || [ -z "$smtp" ]; } && parsedomains
- [ -z "$imap" ] && echo "Give your email server's IMAP address (excluding the port number):" &&
- read -r imap
- [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" &&
- read -r smtp
- case $sport in
- 587) tlsline="# tls_starttls" ;;
- esac
- [ -z "$realname" ] && realname="${fulladdr%%@*}"
- [ -z "$passprefix" ] && passprefix=""
- hostname="${fulladdr#*@}"
- login="${login:-$fulladdr}"
- if [ -n "${password+x}" ] && [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then
- insertpass
- elif [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then
- getpass
- fi
+ [ -z "$fulladdr" ] && echo "Give the full email address to add:" &&
+ read -r fulladdr
+ while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-Za-z]+$"; do
+ echo "$fulladdr is not a valid email address. Please retype the address:"
+ read -r fulladdr
+ done
+ folder="$maildir/$fulladdr"
+ getaccounts
+ echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null &&
+ { echo "$fulladdr has already been added" && exit 1; }
+ { [ -z "$imap" ] || [ -z "$smtp" ]; } && parsedomains
+ [ -z "$imap" ] && echo "Give your email server's IMAP address (excluding the port number):" &&
+ read -r imap
+ [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" &&
+ read -r smtp
+ case $sport in
+ 587) tlsline="# tls_starttls" ;;
+ esac
+ [ -z "$realname" ] && realname="${fulladdr%%@*}"
+ [ -z "$passprefix" ] && passprefix=""
+ hostname="${fulladdr#*@}"
+ login="${login:-$fulladdr}"
+ if [ -n "${password+x}" ] && [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then
+ insertpass
+ elif [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then
+ getpass
+ fi
}
insertpass() {
- printf "%s" "$password" | pass insert -fe "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
+ printf "%s" "$password" | pass insert -fe "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
}
errorexit() {
- echo "Log-on not successful."
- case "$imap" in
- imap.gmail.com)
- echo "This account with $service is using Google's Gmail servers, which disable all third-party applications without an application-specific password.
+ echo "Log-on not successful."
+ case "$imap" in
+ imap.gmail.com)
+ echo "This account with $service is using Google's Gmail servers, which disable all third-party applications without an application-specific password.
Please be sure you are using OAUTH with your Gmail account, or better yet, stop using Gmail."
- ;;
- imap.mail.me.com)
- echo "This account with $service is using Apple's iCloud servers, which disable all non-Apple applications by default.
+ ;;
+ imap.mail.me.com)
+ echo "This account with $service is using Apple's iCloud servers, which disable all non-Apple applications by default.
Please be sure you either enable third-party applications, or create an app-specific password, or best of all, stop using Apple."
- ;;
- esac
- exit 1
+ ;;
+ esac
+ exit 1
}
getpass() { while :; do
- pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1
- pass insert -f "$passprefix$fulladdr" && break
+ pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1
+ pass insert -f "$passprefix$fulladdr" && break
done; }
getboxes() {
- if [ -n "${force+x}" ]; then
- mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")"
- else
- info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")"
- [ -z "$info" ] && errorexit
- mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')"
- fi
- [ "$type" = "pop" ] && mailboxes="INBOX"
- for x in $(
- sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" 2>/dev/null | sort -u
- echo 0
- ); do
- idnum=$((idnum + 1))
- [ "$idnum" -eq "$x" ] || break
- done
- toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' -)"
+ if [ -n "${force+x}" ]; then
+ mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")"
+ else
+ info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")"
+ [ -z "$info" ] && errorexit
+ mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')"
+ fi
+ [ "$type" = "pop" ] && mailboxes="INBOX"
+ for x in $(
+ sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" 2>/dev/null | sort -u
+ echo 0
+ ); do
+ idnum=$((idnum + 1))
+ [ "$idnum" -eq "$x" ] || break
+ done
+ toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' -)"
}
finalize() {
- echo "$toappend" >>"$accdir/$fulladdr.muttrc"
- [ "$type" != "online" ] && echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new"
- mkdir -p "$cachedir/$safename/bodies"
- echo "$fulladdr (account #$idnum) added successfully."
- command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" >"$HOME/.urlview"
- return 0
+ echo "$toappend" >>"$accdir/$fulladdr.muttrc"
+ [ "$type" != "online" ] && echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new"
+ mkdir -p "$cachedir/$safename/bodies"
+ echo "$fulladdr (account #$idnum) added successfully."
+ command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" >"$HOME/.urlview"
+ return 0
}
prepnotmuch() {
- [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config"
- [ -f "$NOTMUCH_CONFIG" ] && return 0
- envsubst <"$notmuchtemp" >"$NOTMUCH_CONFIG"
+ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config"
+ [ -f "$NOTMUCH_CONFIG" ] && return 0
+ envsubst <"$notmuchtemp" >"$NOTMUCH_CONFIG"
}
togglecron() {
- cron="$(mktemp)"
- crontab -l >"$cron"
- if grep -q mailsync "$cron"; then
- echo "Removing automatic mailsync..."
- sed -ibu /mailsync/d "$cron"
- rm -f "$cron"bu
- else
- echo "Adding automatic mailsync every ${cronmin:-10} minutes..."
- echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync" >>"$cron"
- fi &&
- crontab "$cron"
- rm -f "$cron"
+ cron="$(mktemp)"
+ crontab -l >"$cron"
+ if grep -q mailsync "$cron"; then
+ echo "Removing automatic mailsync..."
+ sed -ibu /mailsync/d "$cron"
+ rm -f "$cron"bu
+ else
+ echo "Adding automatic mailsync every ${cronmin:-10} minutes..."
+ echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync" >>"$cron"
+ fi &&
+ crontab "$cron"
+ rm -f "$cron"
}
setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then
- echo "Running $1 with $action..."
- echo "Incompatible options given. Only one action may be specified per run."
- exit 1
+ echo "Running $1 with $action..."
+ echo "Incompatible options given. Only one action may be specified per run."
+ exit 1
else
- action="$1"
+ action="$1"
fi; }
mwinfo() {
- cat <<EOF
+ cat <<EOF
mw: mutt-wizard, auto-configure email accounts for mutt
including downloadable mail with \`isync\`.
@@ -297,23 +297,23 @@ EOF
}
reorder() {
- tempfile="$(mktemp -u)"
- trap 'rm -f $tempfile' HUP INT QUIT TERM PWR EXIT
- echo "# Carefully reorder these accounts with the desired numbers in the first column.
+ tempfile="$(mktemp -u)"
+ trap 'rm -f $tempfile' HUP INT QUIT TERM PWR EXIT
+ echo "# Carefully reorder these accounts with the desired numbers in the first column.
# DO NOT reorder rows or rename the accounts in the second column." >"$tempfile"
- sed -n "
+ sed -n "
/ i[0-9] / s?\(.* i\|'<sync.*/\|\.muttrc.*\)??g p
" "$muttrc" >>"$tempfile"
- ${EDITOR:-vim} "$tempfile" || exit 1
- sed -i -e 's/#.*//' -e '/^$/d' "$tempfile"
- default="$(sort -n "$tempfile" | head -n 1)"
- default="${default#* }"
- sed -ibu "
+ ${EDITOR:-vim} "$tempfile" || exit 1
+ sed -i -e 's/#.*//' -e '/^$/d' "$tempfile"
+ default="$(sort -n "$tempfile" | head -n 1)"
+ default="${default#* }"
+ sed -ibu "
/.* i[0-9] .*.muttrc/d
/^source.*accounts.*.muttrc/d
" "$muttrc" 2>/dev/null
- rm -f "$muttrc"bu
- awk -v a="$accdir" -v d="$default" ' BEGIN { print "source "a"/"d".muttrc" }
+ rm -f "$muttrc"bu
+ awk -v a="$accdir" -v d="$default" ' BEGIN { print "source "a"/"d".muttrc" }
{
print "macro index,pager i"$1" '\''<sync-mailbox><enter-command>source "a"/"$2".muttrc<enter><change-folder>!<enter>;<check-stats>'\'' \"switch to "$2"\""
}
@@ -321,87 +321,87 @@ reorder() {
}
while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in
- l) setact list ;;
- r) setact reorder ;;
- d) setact delete ;;
- D)
- setact delete
- fulladdr="$OPTARG"
- ;;
- y)
- setact sync
- fulladdr="$OPTARG"
- ;;
- Y) setact sync ;;
- a)
- setact add
- fulladdr="$OPTARG"
- ;;
- i)
- setact add
- imap="$OPTARG"
- ;;
- I)
- setact add
- iport="$OPTARG"
- ;;
- s)
- setact add
- smtp="$OPTARG"
- ;;
- S)
- setact add
- sport="$OPTARG"
- ;;
- u)
- setact add
- login="$OPTARG"
- ;;
- n)
- setact add
- realname="$OPTARG"
- ;;
- P)
- setact add
- passprefix="$OPTARG"
- ;;
- m)
- setact add
- maxmes="$OPTARG"
- ;;
- o)
- setact add
- type="online"
- ;;
- p)
- setact add
- type="pop"
- protocol="pop3s"
- iport="${iport:-995}"
- ;;
- f)
- setact add
- force=True
- ;;
- x)
- setact add
- password="$OPTARG"
- ;;
- X)
- setact delete
- purge=True
- ;;
- t)
- setact toggle
- cronmin="$OPTARG"
- ;;
- T) setact toggle ;;
- h) setact info ;;
- \?)
- echo "See \`$(basename $0) -h\` for possible options and help."
- exit 1
- ;;
- esac done
+ l) setact list ;;
+ r) setact reorder ;;
+ d) setact delete ;;
+ D)
+ setact delete
+ fulladdr="$OPTARG"
+ ;;
+ y)
+ setact sync
+ fulladdr="$OPTARG"
+ ;;
+ Y) setact sync ;;
+ a)
+ setact add
+ fulladdr="$OPTARG"
+ ;;
+ i)
+ setact add
+ imap="$OPTARG"
+ ;;
+ I)
+ setact add
+ iport="$OPTARG"
+ ;;
+ s)
+ setact add
+ smtp="$OPTARG"
+ ;;
+ S)
+ setact add
+ sport="$OPTARG"
+ ;;
+ u)
+ setact add
+ login="$OPTARG"
+ ;;
+ n)
+ setact add
+ realname="$OPTARG"
+ ;;
+ P)
+ setact add
+ passprefix="$OPTARG"
+ ;;
+ m)
+ setact add
+ maxmes="$OPTARG"
+ ;;
+ o)
+ setact add
+ type="online"
+ ;;
+ p)
+ setact add
+ type="pop"
+ protocol="pop3s"
+ iport="${iport:-995}"
+ ;;
+ f)
+ setact add
+ force=True
+ ;;
+ x)
+ setact add
+ password="$OPTARG"
+ ;;
+ X)
+ setact delete
+ purge=True
+ ;;
+ t)
+ setact toggle
+ cronmin="$OPTARG"
+ ;;
+ T) setact toggle ;;
+ h) setact info ;;
+ \?)
+ echo "See \`$(basename $0) -h\` for possible options and help."
+ exit 1
+ ;;
+ esac done
[ -z "$action" ] && action="info"
@@ -410,13 +410,13 @@ list) list ;;
add) checkbasics && askinfo && getboxes && getprofiles && finalize ;;
delete) delete ;;
sync)
- echo "\`mw -y\` and \`mw -Y\` are now deprecated and will be removed in a future update. Please switch to using \`mailsync\`."
- mailsync $fulladdr
- ;;
+ echo "\`mw -y\` and \`mw -Y\` are now deprecated and will be removed in a future update. Please switch to using \`mailsync\`."
+ mailsync $fulladdr
+ ;;
toggle) togglecron ;;
reorder) reorder ;;
info)
- mwinfo
- exit 1
- ;;
+ mwinfo
+ exit 1
+ ;;
esac