dialog --title "Mailbox detect requirement" --yesno "In order for the mailbox detection system to work, you must have
1) already have added the email account with this wizard, and
2) already have run offlineimap at least once to synchronize your mail.
This detection system only works if you already have begun your first sync. If you have, press 'yes' to continue." 12 70 ;}
detectSuccess() { dialog --title "Mailbox detect complete." --msgbox "The script has now smartly detected your different mailboxes and has enabled them in the sidebar and given you keyboard shortcuts as below:
gi for move to the Inbox.
gs for move to Sent Mail.
gd for move to Drafts
gS for move to Spam
ga for move to the Archive.
gj for move to Junk
gt for move to Trash
These shortcuts will only work if your email system does have that particular folder (i.e. if your email system has a Junk folder, but not a Trash folder, 'gt' will not work, etc." 20 60 ;}
formatShortcut() { \
while read data; do
echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"Go to $2.\"" >> "$muttdir"accounts/$3.muttrc
done ;}
detectMailboxes() { \
find ~/.mail/$1 -maxdepth 1 -mindepth 1 -type d | sed -e "s/.*\///g;s/^/=/g" > /tmp/$1_boxes
oneline=$(cat /tmp/$1_boxes | tr "\n" " ")
sed -i "/^mailboxes/d" "$muttdir"accounts/$1.muttrc
sed -i "/^mailboxes\|^set spoolfile\|^set record\|^set postponed/d" "$muttdir"accounts/$1.muttrc
$(grep ~/.offlineimaprc -e "^accounts =" | sed 's/accounts =//g')
" 6 60;;
1) addChosen;;
2) inventory && for i in $userchoices; do detectMailboxes $1 ; done &&exit;;
2) detectWarning && inventory && for i in $userchoices; do detectMailboxes $i ; done && detectSuccess;;
3) inventory && for i in $userchoices; do removeAccount $i ; done;;
4) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;;