fulladdr=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Insert the full email address for the account you want to configure." 10 60 3>&1 1>&2 2>&3 3>&- ) || userexit
while ! echo "$fulladdr" | grep "emailre" >/dev/null; do
fulladdr=$(dialog --no-cancel --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "That's not a valid email address. Please input the entire address." 10 60 3>&1 1>&2 2>&3 3>&1) || userexit
imap="$( dialog --inputbox "Insert the IMAP server for your email provider (excluding the port number)" 10 60 3>&1 1>&2 2>&3 3>&- )"
iport="$(dialog --inputbox "What is your server's IMAP port number? (Usually 993)" 10 60 3>&1 1>&2 2>&3 3>&-)"
smtp="$(dialog --inputbox "Insert the SMTP server for your email provider (excluding the port number)" 10 60 3>&1 1>&2 2>&3 3>&- )"
sport="$(dialog --inputbox "What is your server's SMTP port number? (Usually 587 or 465)" 10 60 3>&1 1>&2 2>&3 3>&- )"
else
IFS=, read service imap iport smtp sport <<EOF
$serverinfo
EOF
fi
realname=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Enter the full name you'd like to be identified by on this email account." 10 60 3>&1 1>&2 2>&3 3>&- ) || userexit
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." 10 60 3>&1 1>&2 2>&3 3>&1) || userexit
while ! echo "$title" | grep "$namere" >/dev/null; do
title=$(dialog --no-cancel --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Account title not valid. Give a username beginning with a letter, with only lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1) || userexit
done
login=$(dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "If you have a username for the \"$title\" account which is different from your email address, enter it here. Otherwise leave this prompt blank." 10 60 3>&1 1>&2 2>&3 3>&- ) || userexit
gpgemail=$(dialog --title "Luke's mutt/offlineIMAP wizard" --inputbox "To safely encrypt passwords, mutt-wizard requires that you have a GPG public/private key pair.\n\nPlease insert the email address for your key pair here, or generate one first with \`$GPG --full-gen-key\` and come back." 12 60 3>&1 1>&2 2>&3 3>&- ) || userexit
while ! echo "$gpgemail" | grep "$emailre"; do
gpgemail=$(dialog --title "Luke's mutt/offlineIMAP wizard" --inputbox "That's not a valid email address. Please input the entire address." 10 60 3>&1 1>&2 2>&3 3>&1) || userexit
done
if "$GPG" -K | grep "<$gpgemail>"; then
echo "$gpgemail" > "$creddir/gpgemail"
else
dialog --title "Luke's mutt/offlineIMAP wizard" --msgbox "You do not appear to have a private key with that email address.\n\nPlease be sure to create your key with \`$GPG --full-gen-key\` and come back." 8 70
clear; exit
fi
}
formatShortcut() { \
while read data; do { echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"Go to $2.\" # autogenerated"
echo "macro index,pager M$1 \"<save-message>$data<enter>\" \"Move mail to $2.\" # autogenerated"
echo "macro index,pager C$1 \"<copy-message>$data<enter>\" \"Copy mail to $2.\" # autogenerated"; } >> "$muttdir/accounts/$3.muttrc"
done ;}
gen_delim() { \
delim="="
for i in $(seq $(( $1 - 1 )))
do
delim="$delim-"
done
echo $delim ;}
detectMailboxes() { \
ls -d "$maildir/$1/"* | sed "s/.*\///;s/^/=/" > "$tmpdir/$1_boxes"
0) dialog --title "Accounts detected" --msgbox "The following accounts have been detected:
$(grep ~/.offlineimaprc -e "^accounts =" | sed 's/accounts =//g')
" 6 60;;
1) chooseadd ;;
2) detectWarning && chooseDetect;;
3) inventory && for i in $userchoices; do getpass "$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?" 6 60 && wipe) ;;
6) askgpg ;;
7) clear && break ;;
*) echo "Error. Are you sure you have dialog installed?" >&2; exit 2