From ef4831eaf089392e710a48df1693581afa9d4d34 Mon Sep 17 00:00:00 2001 From: Koren He Date: Wed, 6 Jun 2018 17:21:17 +0800 Subject: [PATCH] Fix wrong folder name when syncing inbox folder As muttrc provides a shortcut 'o' for syncing inbox folders, different mailboxes may not have the same folder name, we should overridden this command in each account's muttrc file. Otherwise, a mailbox which has 'INBOX' as its inbox folder will see this error: ERROR: Account qq: no folder to sync (folderfilter issue?) *** Finished account 'qq' in 0:06 ERROR: Exceptions occurred during the run! ERROR: Account qq: no folder to sync (folderfilter issue?) This patch fix this problem. --- mutt-wizard.sh | 4 +++- muttrc | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mutt-wizard.sh b/mutt-wizard.sh index 01322ba..ba6c81f 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -82,7 +82,8 @@ detectMailboxes() { \ sed -i "/^mailboxes\|^set spoolfile\|^set record\|^set postponed/d" "$muttdir"accounts/$1.muttrc echo mailboxes $oneline >> "$muttdir"accounts/$1.muttrc sed -i "/^macro index,pager g/d" "$muttdir"accounts/$1.muttrc - grep -vi /tmp/$1_boxes -e "trash\|drafts\|sent\|trash\|spam\|junk\|archive\|chat\|old\|new\|gmail\|sms\|call\|delete" | sort -n | sed 1q | formatShortcut i inbox $1 + inbox=$(grep -vi /tmp/$1_boxes -e "trash\|drafts\|sent\|trash\|spam\|junk\|archive\|chat\|old\|new\|gmail\|sms\|call\|delete" | sort -n | sed 1q | sed -e 's/=//g') + echo $inbox | formatShortcut i inbox $1 grep -i /tmp/$1_boxes -e sent | sed 1q | formatShortcut s sent $1 grep -i /tmp/$1_boxes -e draft | sed 1q | formatShortcut d drafts $1 grep -i /tmp/$1_boxes -e trash | sed 1q | formatShortcut t trash $1 @@ -92,6 +93,7 @@ detectMailboxes() { \ record=$(grep -i /tmp/$1_boxes -e sent | sed -e 's/=/+/g' | sed 1q) postponed=$(grep -i /tmp/$1_boxes -e draft | sed -e 's/=/+/g' | sed 1q) trash=$(grep -i /tmp/$1_boxes -e trash | sed -e 's/=/+/g' | sed 1q) + echo "macro index o \"offlineimap -qf $inbox -a $1\" \"run offlineimap to sync inbox\"" >> "$muttdir"accounts/$1.muttrc echo "set spoolfile = \"$spoolfile\"" >> "$muttdir"accounts/$1.muttrc echo "set record = \"$record\"" >> "$muttdir"accounts/$1.muttrc echo "set postponed = \"$postponed\"" >> "$muttdir"accounts/$1.muttrc diff --git a/muttrc b/muttrc index 2d160ab..e2c3250 100644 --- a/muttrc +++ b/muttrc @@ -56,6 +56,7 @@ macro index \Cr "T~UN." "ma #sync email macro index O "offlineimap" "run offlineimap to sync all mail" +#this will be overridden by each accout's .muttrc macro index o "offlineimap -qf INBOX" "run offlineimap to sync inbox" #copy/move dialogs