|
|
@@ -196,20 +196,22 @@ EOF |
|
|
|
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 |
|
|
|
for x in $(seq 1 9); do echo "$accounts" | grep "$x": >/dev/null 2>&1 || { export idnum="$x"; break ;}; done |
|
|
|
[ ! -f "$mwmsmtprc" ] && echo "$msmtp_header" > "$mwmsmtprc" |
|
|
|
echo "$msmtp_profile" >> "$mwmsmtprc" |
|
|
|
case "$mwservice" in |
|
|
|
protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;; |
|
|
|
esac |
|
|
|
echo "$mutt_profile" > "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
mkdir -p ${mwmbsyncrc%/*} |
|
|
|
echo "$mbsync_profile" >> "$mwmbsyncrc" |
|
|
|
echo "$mutt_profile" > "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
[ ! -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.*.muttrc" "$mwmuttrc" | grep -v "$mwconfig" >/dev/null && echo "source $mwaccdir/$idnum-$mwaccount.muttrc # mw-autogenerated" >> "$mwmuttrc" |
|
|
|
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" |
|
|
|
[ "$mwtype" = "offline" ] && echo "macro index gM '<shell-escape>mailsync -Va<enter>' \"sync all mail\" # mw-autogenerated" >> "$mwmuttrc" |
|
|
|
! 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 |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
@@ -257,8 +259,8 @@ finalize() { |
|
|
|
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" |
|
|
|
echo "mailboxes =${mwaccount//[.@]/_} ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" |
|
|
|
>> "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
mwaccount_="${mwaccount//[.@]/_}" |
|
|
|
echo "mailboxes =${mwaccount_%_*} ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" |
|
|
|
sed -i "/# mw-autogenerated/d" "$mwaccdir/$idnum-$mwaccount.muttrc" |
|
|
|
echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox |
|
|
|