| @@ -160,7 +160,7 @@ EOF | |||||
| echo "$msmtp_profile" >> "$HOME/.config/msmtp/config" | echo "$msmtp_profile" >> "$HOME/.config/msmtp/config" | ||||
| echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" | echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" | ||||
| echo "$mbsync_profile" >> "$mbsyncrc" | echo "$mbsync_profile" >> "$mbsyncrc" | ||||
| ! grep "^source.*.muttrc" "$muttrc" | grep -v "$mwconfig" >/dev/null && echo "source $accdir/$title.muttrc # mw-autogenerated" >> "$muttrc" | |||||
| ! grep "^source.*.muttrc" "$muttrc" | grep -v "$mwconfig" >/dev/null && echo "source $accdir/$idnum-$title.muttrc # mw-autogenerated" >> "$muttrc" | |||||
| echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$idnum-$title.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\" # mw-autogenerated" >> "$muttrc" | echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$idnum-$title.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\" # mw-autogenerated" >> "$muttrc" | ||||
| } | } | ||||
| @@ -170,7 +170,7 @@ getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1 | |||||
| formatShortcut() { \ | formatShortcut() { \ | ||||
| while read -r data; do { echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"go to $2\" # mw-autogenerated" | 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 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"; } >> "$accdir/$3.muttrc" | |||||
| echo "macro index,pager C$1 \"<copy-message>$data<enter>\" \"copy mail to $2\" # mw-autogenerated"; } >> "$accdir/$idnum-$title.muttrc" | |||||
| done ;} | done ;} | ||||
| tryconnect() { mkdir -p "$maildir/$title" | tryconnect() { mkdir -p "$maildir/$title" | ||||
| @@ -198,18 +198,18 @@ finalize() { \ | |||||
| record=$(grep -i -m 1 "$tmpdir/title_boxes" -e sent | sed -e 's/=/+/g') | record=$(grep -i -m 1 "$tmpdir/title_boxes" -e sent | sed -e 's/=/+/g') | ||||
| postponed=$(grep -i -m 1 "$tmpdir/title_boxes" -e draft | sed -e 's/=/+/g') | postponed=$(grep -i -m 1 "$tmpdir/title_boxes" -e draft | sed -e 's/=/+/g') | ||||
| trash=$(grep -i -m 1 "$tmpdir/title_boxes" -e trash | sed -e 's/=/+/g') | trash=$(grep -i -m 1 "$tmpdir/title_boxes" -e trash | sed -e 's/=/+/g') | ||||
| sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$accdir/$title.muttrc" | |||||
| { echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$accdir/$title.muttrc" | |||||
| echo mailboxes "$oneline" >> "$accdir/$title.muttrc" | |||||
| sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$accdir/$idnum-$title.muttrc" | |||||
| { echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$accdir/$idnum-$title.muttrc" | |||||
| echo mailboxes "$oneline" >> "$accdir/$idnum-$title.muttrc" | |||||
| printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" | printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" | ||||
| sed -i "/# mw-autogenerated/d" "$accdir/$title.muttrc" | |||||
| grep -i -m 1 inbox "$tmpdir/title_boxes" | formatShortcut i inbox "$title" | |||||
| grep -i -m 1 sent "$tmpdir/title_boxes" | formatShortcut s sent "$title" | |||||
| grep -i -m 1 draft "$tmpdir/title_boxes" | formatShortcut d drafts "$title" | |||||
| grep -i -m 1 trash "$tmpdir/title_boxes" | formatShortcut t trash "$title" | |||||
| grep -i -m 1 spam "$tmpdir/title_boxes" | formatShortcut S spam "$title" | |||||
| grep -i -m 1 junk "$tmpdir/title_boxes" | formatShortcut j junk "$title" | |||||
| grep -i -m 1 archive "$tmpdir/title_boxes" | formatShortcut a archive "$title" | |||||
| sed -i "/# mw-autogenerated/d" "$accdir/$idnum-$title.muttrc" | |||||
| grep -i -m 1 inbox "$tmpdir/title_boxes" | formatShortcut i inbox | |||||
| grep -i -m 1 sent "$tmpdir/title_boxes" | formatShortcut s sent | |||||
| grep -i -m 1 draft "$tmpdir/title_boxes" | formatShortcut d drafts | |||||
| grep -i -m 1 trash "$tmpdir/title_boxes" | formatShortcut t trash | |||||
| grep -i -m 1 spam "$tmpdir/title_boxes" | formatShortcut S spam | |||||
| grep -i -m 1 junk "$tmpdir/title_boxes" | formatShortcut j junk | |||||
| grep -i -m 1 archive "$tmpdir/title_boxes" | formatShortcut a archive | |||||
| [ "$accounttype" = "offline" ] && printf "All done.\\n\033[33mYou should now be able to run \`\033[32mmbsync %s\033[33m\` to begin to download your mail.\033[0m\\n" "$title" | [ "$accounttype" = "offline" ] && printf "All done.\\n\033[33mYou should now be able to run \`\033[32mmbsync %s\033[33m\` to begin to download your mail.\033[0m\\n" "$title" | ||||
| } | } | ||||
| @@ -227,7 +227,7 @@ pick() { printf "Select an accounts to %s:\\n" "$1" | |||||
| delete() { sed -i "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" | delete() { sed -i "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" | ||||
| rm -rf "${accdir:?}/${title:?}" "$accdir/[1-9]-$title.muttrc" | rm -rf "${accdir:?}/${title:?}" "$accdir/[1-9]-$title.muttrc" | ||||
| sed -i "/$title.muttrc/d" "$muttrc" | |||||
| sed -i "/[0-9]-$title.muttrc/d" "$muttrc" | |||||
| sed -i "/account $title/,/^\(\s*$\|account\)/d" "$HOME/.config/msmtp/config" | sed -i "/account $title/,/^\(\s*$\|account\)/d" "$HOME/.config/msmtp/config" | ||||
| } | } | ||||