|
|
@@ -127,11 +127,11 @@ set from = \"$mwaddr\" |
|
|
|
set sendmail = \"$msmtpbin -a $mwaccount\" |
|
|
|
alias me $mwname <$mwaddr> |
|
|
|
set folder = \"imaps://$mwaddr@$mwimap:$mwiport\" |
|
|
|
set header_cache = $mwcachedir/$mwaccount |
|
|
|
set message_cachedir = $mwcachedir/$mwaccount |
|
|
|
set imap_user = \"$mwlogin\" |
|
|
|
set header_cache = $mwcachedir/$mwaccount/headers |
|
|
|
set message_cachedir = $mwcachedir/$mwaccount/bodies |
|
|
|
set imap_pass = \"\`pass $mwpass\`\" |
|
|
|
account-hook \$folder 'set imap_user=\$imap_user imap_pass=\$imap_pass' |
|
|
|
account-hook \$folder 'set imap_user=\"$mwlogin\" imap_pass=\"\`pass $mwpass\`\"' |
|
|
|
|
|
|
|
set mbox_type = Maildir |
|
|
|
set ssl_starttls = yes |
|
|
@@ -195,9 +195,7 @@ EOF |
|
|
|
getpass |
|
|
|
fi |
|
|
|
getprofiles |
|
|
|
mkdir -p "$mwmuttdir" "$mwaccdir" "$mwcachedir/$mwaccount/bodies" "$mwconfigdir/msmtp" |
|
|
|
getaccounts |
|
|
|
for x in $(seq 1 9); do echo "$accounts" | grep "$x": >/dev/null 2>&1 || { export idnum="$x"; break ;}; done |
|
|
|
mkdir -p "$mwmuttdir" "$mwaccdir" "$mwcachedir/$mwaccount" "$mwconfigdir/msmtp" |
|
|
|
[ ! -f "$mwmsmtprc" ] && echo "$msmtp_header" > "$mwmsmtprc" |
|
|
|
echo "$msmtp_profile" >> "$mwmsmtprc" |
|
|
|
case "$mwservice" in |
|
|
@@ -205,17 +203,16 @@ EOF |
|
|
|
esac |
|
|
|
mkdir -p ${mwmbsyncrc%/*} |
|
|
|
echo "$mbsync_profile" >> "$mwmbsyncrc" |
|
|
|
mwaccrc=$mwaccdir/$idnum-$mwaccount.muttrc |
|
|
|
getaccounts |
|
|
|
for x in $(seq 1 9); do echo "$accounts" | grep "$x": >/dev/null 2>&1 || { export idnum="$x"; break ;}; done |
|
|
|
mwaccrc="$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
echo "$mutt_profile" > "$mwaccrc" |
|
|
|
[ ! -f "$mwmuttrc" ] && echo "# vim: filetype=neomuttrc" > "$mwmuttrc" && echo "muttrc created." |
|
|
|
! grep "source.*mutt-wizard.muttrc" "$mwmuttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$mwmuttrc" |
|
|
|
if [ "$mwtype" = "offline" ]; then |
|
|
|
! grep "^macro .* gM .*" "$mwmuttrc" >/dev/null && echo "macro index gM '<shell-escape>mailsync -Va<enter>' \"sync all mail\" # mw-autogenerated" >> "$mwmuttrc" |
|
|
|
fi |
|
|
|
muttsync="<sync-mailbox><enter-command>source $mwaccrc<enter><change-folder>\!<enter>;<check-stats>" |
|
|
|
! grep "^source.*$idnum-$mwaccount.muttrc" "$mwmuttrc" >/dev/null && echo "source $mwaccrc # mw-autogenerated" >> "$mwmuttrc" |
|
|
|
! grep "^folder-hook.*$idnum-$mwaccount.muttrc" "$mwmuttrc" >/dev/null && echo "folder-hook \$folder '$muttsync' # mw-autogenerated" >> "$mwmuttrc" |
|
|
|
! grep "^macro .* i$idnum .*" "$mwmuttrc" >/dev/null && echo "macro index,pager i$idnum '$muttsync' \"switch to $mwaddr\" # mw-autogenerated" >> "$mwmuttrc" |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
@@ -274,6 +271,10 @@ finalize() { |
|
|
|
echo "$boxes" | grep -i spam | head -n 1 | formatShortcut S spam |
|
|
|
echo "$boxes" | grep -i junk | head -n 1 | formatShortcut j junk |
|
|
|
echo "$boxes" | grep -i archive | head -n 1 | formatShortcut a archive |
|
|
|
idnum=${mwaccrc%%-*} |
|
|
|
muttsync="<sync-mailbox><enter-command>source $mwaccrc<enter><change-folder>\!<enter>;<check-stats>" |
|
|
|
echo "folder-hook \$folder '$muttsync' # mw-autogenerated" >> "$mwaccrc" |
|
|
|
echo "macro index,pager i$idnum $muttsync \"switch to $mwaddr\" # mw-autogenerated" >> "$mwaccrc" |
|
|
|
[ "$mwtype" = "offline" ] && printf "All done.\\n\033[33mYou can now run \`\033[32mmailsync [%s]\033[33m\` to sync your mail.\033[0m\\n" "$mwaccount" |
|
|
|
command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" |
|
|
|
return 0 |
|
|
@@ -297,7 +298,7 @@ mwpick() { |
|
|
|
|
|
|
|
mwdelete() { |
|
|
|
sed -i "/IMAPStore $mwaccount-remote$/,/# End profile/d" "$mwmbsyncrc" |
|
|
|
rm -rf "${mwcachedir:?}/${mwaccount:?}" |
|
|
|
rm -rf "$mwcachedir/$mwaccount" |
|
|
|
rm -rf "$mwaccdir/"[1-9]"-$mwaccount.muttrc" |
|
|
|
sed -i "/[0-9]-$mwaccount.muttrc/d" "$mwmuttrc" |
|
|
|
sed -i "/account $mwaccount/,/^\(\s*$\|account\)/d" "$mwmsmtprc" |
|
|
|