summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mailsync7
-rwxr-xr-xbin/mw21
2 files changed, 8 insertions, 20 deletions
diff --git a/bin/mailsync b/bin/mailsync
index 0d2983f..17cb9f3 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -66,14 +66,13 @@ syncandnotify() {
}
# Sync accounts passed as argument or all.
-if [ "$#" -eq "0" ]; then
- accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
-else
+if [ "$#" -gt "0" ]; then
for arg in "$@"; do
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
done
accounts=$*
fi
+[ -z "$accounts" ] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
# Parallelize multiple accounts
for account in $accounts; do
@@ -82,7 +81,7 @@ done
wait
-notmuch new 2>/dev/null
+notmuch new --quiet
#Create a touch file that indicates the time of the last run of mailsync
touch "$lastrun"
diff --git a/bin/mw b/bin/mw
index 04361fc..c71d662 100755
--- a/bin/mw
+++ b/bin/mw
@@ -224,7 +224,7 @@ getboxes() { if [ -n "${force+x}" ] ; then
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" | sort -u; echo 0); do
+ 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
@@ -262,7 +262,7 @@ togglecron() { cron="$(mktemp)"
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"
+ echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync -q" >> "$cron"
fi &&
crontab "$cron"; rm -f "$cron" ;}
@@ -297,8 +297,7 @@ Options allowed with -a:
-s SMTP server address
-S SMTP server port
-x Password for account (recommended to be in double quotes)
- -p Install for a Protonmail account.
- -P Add for a POP server instead of IMAP.
+ -p Add for a POP server instead of IMAP.
-X Delete an account's local email too when deleting.
-o Configure address, but keep mail online.
-f Assume typical English mailboxes without attempting log-on.
@@ -333,7 +332,7 @@ reorder() {
' "$tempfile" >> "$muttrc"
}
-while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in
+while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in
l) setact list || exit 1 ;;
r) setact reorder || exit 1 ;;
d) setact delete || exit 1 ;;
@@ -349,22 +348,12 @@ while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in
n) setact add || exit 1 ; realname="$OPTARG" ;;
m) setact add || exit 1 ; maxmes="$OPTARG" ;;
o) setact add || exit 1 ; type="online" ;;
- P) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;;
+ p) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;;
f) setact add || exit 1 ; force=True ;;
x) setact add || exit 1 ; password="$OPTARG" ;;
X) setact delete || exit 1 ; purge=True ;;
t) setact toggle || exit 1 ; cronmin="$OPTARG" ;;
T) setact toggle || exit 1 ;;
- p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work."
- protocol="imap"
- imap="127.0.0.1"
- iport="1143"
- smtp="127.0.0.1"
- sport="1025"
- auth="login"
- tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | sed -n '/SHA256:/ s/^\s*SHA256:\s*// p')"
- setact add || exit 1
- ;;
*) mwinfo; exit 1 ;;
esac done