@@ -30,6 +30,7 @@ export GPG_TTY="$(tty)" | |||||
[ -n "$MPOPRC" ] || MPOPRC="$HOME/.config/mpop/config" | [ -n "$MPOPRC" ] || MPOPRC="$HOME/.config/mpop/config" | ||||
lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" | lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" | ||||
hidelist="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/hidelist" | |||||
# Settings are different for MacOS (Darwin) systems. | # Settings are different for MacOS (Darwin) systems. | ||||
case "$(uname)" in | case "$(uname)" in | ||||
@@ -75,8 +76,21 @@ syncandnotify() { | |||||
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | ||||
from="$(sed -n "/^From:/ s|From: *|| p" "$file" | | from="$(sed -n "/^From:/ s|From: *|| p" "$file" | | ||||
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | ||||
from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" | |||||
notify "📧$from:" "$subject" | |||||
fromaddr="${from#*<}" fromaddr="${fromaddr%*>}" | |||||
# Hide email notifications for sender address patterns in hidelist file | |||||
while IFS= read -r pattern; do | |||||
echo "$fromaddr" | grep -q "^$pattern$" && break | |||||
done <<-EOT | |||||
$(sed 's/#.*//' "$hidelist") | |||||
EOT | |||||
[ "$?" = 0 ] && notify "New Mail!" "📬 1 new mail in \`$2\` account." || | |||||
{ fromperson="${from% *}" | |||||
fromperson="${fromperson%\"}" | |||||
fromperson="${fromperson#\"}"; | |||||
notify "📧$fromperson:" "$subject"; } | |||||
done | done | ||||
;; | ;; | ||||
*) echo "No new mail for $2." ;; | *) echo "No new mail for $2." ;; | ||||
@@ -7,6 +7,7 @@ maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" | |||||
muttshare="$prefix/share/mutt-wizard" | muttshare="$prefix/share/mutt-wizard" | ||||
cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" | cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" | ||||
muttrc="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc" | muttrc="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc" | ||||
hidelist="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/hidelist" | |||||
accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts" | accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts" | ||||
msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" | msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" | ||||
msmtplog="${XDG_STATE_HOME:-$HOME/.local/state}/msmtp/msmtp.log" | msmtplog="${XDG_STATE_HOME:-$HOME/.local/state}/msmtp/msmtp.log" | ||||
@@ -87,6 +88,10 @@ prepmutt() { | |||||
echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\"" >>"$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" | ||||
} | } | ||||
prephidelist() { | |||||
[ ! -f "$hidelist" ] && echo "# For all sender email address patterns in this file, the sender and the message will not be shown in notifications.\n#\n# Example entries:\n#\n# test@example.com\n# .*@example.com\n# test@.*\.com" >"$hidelist" | |||||
} | |||||
getprofiles() { | getprofiles() { | ||||
safename="$(echo $fulladdr | sed 's/@/_/g')" | safename="$(echo $fulladdr | sed 's/@/_/g')" | ||||
case "$type" in | case "$type" in | ||||
@@ -106,6 +111,7 @@ getprofiles() { | |||||
prepmsmtp | prepmsmtp | ||||
prepmutt | prepmutt | ||||
prepnotmuch | prepnotmuch | ||||
prephidelist | |||||
} | } | ||||
parsedomains() { | parsedomains() { | ||||