|
|
@@ -131,6 +131,7 @@ 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' |
|
|
|
|
|
|
|
set mbox_type = Maildir |
|
|
|
set ssl_starttls = yes |
|
|
@@ -204,14 +205,17 @@ EOF |
|
|
|
esac |
|
|
|
mkdir -p ${mwmbsyncrc%/*} |
|
|
|
echo "$mbsync_profile" >> "$mwmbsyncrc" |
|
|
|
echo "$mutt_profile" > "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
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" |
|
|
|
! grep "^source.*$idnum-$mwaccount.muttrc" "$mwmuttrc" >/dev/null && echo "source $mwaccdir/$idnum-$mwaccount.muttrc # mw-autogenerated" >> "$mwmuttrc" |
|
|
|
! grep "^macro .* i$idnum .*" "$mwmuttrc" >/dev/null && echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $mwaccdir/$idnum-$mwaccount.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $mwaddr\" # 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 |
|
|
|
} |
|
|
|
|
|
|
@@ -228,7 +232,7 @@ getpass() { |
|
|
|
formatShortcut() { |
|
|
|
while read -r data; do { echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"go to $2\" # mw-autogenerated" |
|
|
|
echo "macro index,pager M$1 \"<save-message>$data<enter>\" \"move mail to $2\" # mw-autogenerated" |
|
|
|
echo "macro index,pager C$1 \"<copy-message>$data<enter>\" \"copy mail to $2\" # mw-autogenerated"; } >> "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
echo "macro index,pager C$1 \"<copy-message>$data<enter>\" \"copy mail to $2\" # mw-autogenerated"; } >> "$mwaccrc" |
|
|
|
done |
|
|
|
} |
|
|
|
|
|
|
@@ -257,12 +261,12 @@ finalize() { |
|
|
|
record=$(echo "$boxes" | grep -i -m 1 sent | sed 's/=/+/g') |
|
|
|
postponed=$(echo "$boxes" | grep -i -m 1 draft | sed 's/=/+/g') |
|
|
|
trash=$(echo "$boxes" | grep -i -m 1 trash | sed 's/=/+/g') |
|
|
|
sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
{ echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$mwaccrc" |
|
|
|
{ echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$mwaccrc" |
|
|
|
mwaccount_="${mwaccount//[.@]/_}" |
|
|
|
echo "mailboxes =${mwaccount_%_*} ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
echo "mailboxes =${mwaccount_%_*} ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$mwaccrc" |
|
|
|
printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" |
|
|
|
sed -i "/# mw-autogenerated/d" "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
sed -i "/# mw-autogenerated/d" "$mwaccrc" |
|
|
|
echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox |
|
|
|
echo "$boxes" | grep -i sent | head -n 1 | formatShortcut s sent |
|
|
|
echo "$boxes" | grep -i draft | head -n 1 | formatShortcut d drafts |
|
|
|