summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/mailsync21
-rw-r--r--share/domains.csv1
-rw-r--r--share/mutt-wizard.muttrc1
3 files changed, 19 insertions, 4 deletions
diff --git a/bin/mailsync b/bin/mailsync
index d33ec23..801aaeb 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -19,7 +19,7 @@ pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;}
# files for variable assignments. This is ugly, but there are few options that
# will work on the maximum number of machines.
eval "$(grep -h -- \
- "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\|MAILSYNC_MUTE\)=" \
+ "^\s*\(export \)\?\(MBSYNCRC\|MPOPRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\|MAILSYNC_MUTE\)=" \
"$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \
"$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \
"$HOME/.pam_environment" 2>/dev/null)"
@@ -27,6 +27,7 @@ eval "$(grep -h -- \
export GPG_TTY="$(tty)"
[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc"
+[ -n "$MPOPRC" ] || MPOPRC="$HOME/.config/mpop/config"
lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun"
@@ -35,7 +36,7 @@ lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun"
[ -z "$MAILSYNC_MUTE" ] && notify="$(uname)" || notify="mute"
case "$notify" in
mute)
- notify() { echo "notifications disabled" >/dev/null ;}
+ notify() { : ;}
;;
Darwin)
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
@@ -57,7 +58,13 @@ esac
# Check account for new mail. Notify if there is new content.
syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")"
- if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
+ if [ "$1" = "pop" ]; then
+ # Handle POP
+ mpop "$acc"
+ else
+ # Handle IMAP
+ if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
+ fi
new=$(find\
"$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/new/\
"$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/cur/\
@@ -75,11 +82,17 @@ if [ "$#" -gt "0" ]; then
done
accounts=$*
fi
+# TODO handle account passed from argument
[ -z "$accounts" ] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
+[ -z "$pop_accounts" ] && pop_accounts="$(awk '/^account/ {print $2}' "$MPOPRC")"
# Parallelize multiple accounts
for account in $accounts; do
- syncandnotify &
+ syncandnotify "imap" &
+done
+
+for account in $pop_accounts; do
+ syncandnotify "pop" &
done
wait
diff --git a/share/domains.csv b/share/domains.csv
index 08a3a95..0ac67cb 100644
--- a/share/domains.csv
+++ b/share/domains.csv
@@ -294,6 +294,7 @@ uclive.ac.nz,outlook.office365.com,993,smtp.office365.com,587
ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587
ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587
ukr.net,imap.ukr.net,993,smtp.ukr.net,465
+umbc.edu,imap.gmail.com,993,smtp.gmail.com,587
uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465
uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587
uni.edu.pe,imap.gmail.com,993,smtp.gmail.com,587
diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc
index 4df16a4..9d9d12a 100644
--- a/share/mutt-wizard.muttrc
+++ b/share/mutt-wizard.muttrc
@@ -3,6 +3,7 @@
# mutt-wizard will have this file sourced from your muttrc.
# In the interest of seamless updating, do not edit this file.
# If you want to override any settings, set those in your muttrc.
+set send_charset="us-ascii:utf-8"
set mailcap_path = $HOME/.config/mutt/mailcap:/usr/local/share/mutt-wizard/mailcap:$mailcap_path
set mime_type_query_command = "file --mime-type -b %s"
set date_format="%y/%m/%d %I:%M%p"