gpgemail=$( dialog --title "Luke's mutt/offlineIMAP password wizard" --inputbox "Insert the email address with which you originally created your GPG key pair. This is NOT necessarily the email you want to configure."1060 3>&1 1>&2 2>&3 3>&- )
dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the new password for the \"$1\" account."1060 2> /tmp/$1
gpg2 -r $gpgemail --encrypt /tmp/$1||(dialog --title "GPG decryption failed." --msgbox "GPG decryption failed. This is either because you do not have a GPG key pair or because your distro uses GPG1 and you thus need to symlink /usr/bin/gpg2 to /usr/bin/gpg."760&&break)
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 ;}
addloop(){fulladdr=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Insert the full email address for the account you want to configure."1060 3>&1 1>&2 2>&3 3>&- )
realname=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Enter the full name you'd like to be identified by on this email account."1060 3>&1 1>&2 2>&3 3>&- )
title=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Give a short, one-word name for this email account that will differentiate it from other email accounts."1060 3>&1 1>&2 2>&3 3>&- )
gpg2 -r $gpgemail --encrypt /tmp/$title||(dialog --title "GPG decryption failed." --msgbox "GPG decryption failed. This is either because you do not have a GPG key pair or because your distro uses GPG1 and you thus need to symlink /usr/bin/gpg2 to /usr/bin/gpg."760&&break)
dialog --title "Finalizing your account." --msgbox "The account \"$title\" has been added. Now to finalize installation, do the following:
1) Run offlineimap to start the sync. This will start your mail sync.
2) After or while running offlineimap, choose the \"autodetect mailboxes\" option, which will finalize your config files based on the directory structure of the downloaded mailbox.
After that, you will be able to open neomutt to your email account." 13 80 ;}
gpgemail=$( dialog --title "Luke's mutt/offlineIMAP password wizard" --inputbox "Insert the email address with which you originally created your GPG key pair. This is NOT necessarily the email you want to configure."1060 3>&1 1>&2 2>&3 3>&- )
3) inventory &&for i in $userchoices;do changePassword $i;done;;
4) inventory &&for i in $userchoices;do removeAccount $i;done;;
5)(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?"660&& wipe);;