Browse Source

mailbox detect now searches all accounts

tags/v3.1
Luke 6 years ago
parent
commit
b09b3d2249
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      mutt-wizard.sh

+ 10
- 6
mutt-wizard.sh View File

@@ -9,6 +9,8 @@ changePassword() { \
shred -u /tmp/$1
mv /tmp/$1.gpg ~/.config/mutt/credentials/ ;}

chooseDetect() { for x in $(cat ~/.offlineimaprc | grep "^accounts =" | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;'); do detectMailboxes $x; done && detectSuccess ;}

detectWarning() { \
dialog --title "Mailbox detect requirement" --yesno "In order for the mailbox detection system to work, you must have

@@ -53,15 +55,17 @@ detectMailboxes() { \
echo "set record = \"$record\"" >> "$muttdir"accounts/$1.muttrc
echo "set postponed = \"$postponed\"" >> "$muttdir"accounts/$1.muttrc ;}

# Sees what accounts have been generated bny the wizard
# by checking ~/.offlineimap and yields a menu of them.
inventory() { \
# Get all accounts in ~/.offlineimaprc and load into variable `accounts`.
getAccounts() { \
cat ~/.offlineimaprc | grep "^accounts =" | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;' | nl --number-format=ln > /tmp/numbered
accounts=()
while read n s ; do
accounts+=($n "$s" off)
done < /tmp/numbered
done < /tmp/numbered ;}

# Yields a menu of available accounts.
inventory() { \
getAccounts
choices=$(dialog --separate-output --checklist "Choose an email account." 15 40 16 "${accounts[@]}" 2>&1 >/dev/tty)

if [ -z "$choices" ];
@@ -193,10 +197,10 @@ case $choice in
$(grep ~/.offlineimaprc -e "^accounts =" | sed 's/accounts =//g')
" 6 60;;
1) addChosen;;
2) detectWarning && inventory && for i in $userchoices; do detectMailboxes $i ; done && detectSuccess;;
2) detectWarning && chooseDetect ;;
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?" 6 60 && wipe) ;;
6) clear && break
6) clear && break ;;
esac
done

Loading…
Cancel
Save