Browse Source

tests and fixes

pull/276/head
Roland Puntaier 5 years ago
parent
commit
9e88c2d632
4 changed files with 15 additions and 10 deletions
  1. +2
    -0
      README.md
  2. +10
    -8
      bin/mw
  3. +1
    -0
      share/mutt-wizard.muttrc
  4. +2
    -2
      test/dotests

+ 2
- 0
README.md View File

@@ -137,6 +137,8 @@ mutt-wizard is free/libre software, licensed under the GPLv3.
You can edit these freely if you want to tinker with settings specific to an account.
- In `/usr/share/mutt-wizard` are several global config files, including `mutt-wizard`'s default settings.
You can overwride this in your `muttrc` if you wish.
To avoid insertion of the line sourcing the default settings,
have a commented `# source /usr/share/mutt-wizard/mutt-wizard.muttrc` in your muttrc.

## Watch out for these things:



+ 10
- 8
bin/mw View File

@@ -196,20 +196,22 @@ EOF
getprofiles
mkdir -p "$mwmuttdir" "$mwaccdir" "$mwcachedir/$mwaccount/bodies" "$mwconfigdir/msmtp"
getaccounts
for x in $(seq 1 9); do echo "$accounts" | grep "$x" >/dev/null 2>&1 || { export idnum="$x"; break ;}; done
for x in $(seq 1 9); do echo "$accounts" | grep "$x": >/dev/null 2>&1 || { export idnum="$x"; break ;}; done
[ ! -f "$mwmsmtprc" ] && echo "$msmtp_header" > "$mwmsmtprc"
echo "$msmtp_profile" >> "$mwmsmtprc"
case "$mwservice" in
protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;;
esac
echo "$mutt_profile" > "$mwaccdir/$idnum-$mwaccount.muttrc"
mkdir -p ${mwmbsyncrc%/*}
echo "$mbsync_profile" >> "$mwmbsyncrc"
echo "$mutt_profile" > "$mwaccdir/$idnum-$mwaccount.muttrc"
[ ! -f "$mwmuttrc" ] && echo "# vim: filetype=neomuttrc" > "$mwmuttrc" && echo "muttrc created."
! grep "^source.*mutt-wizard.muttrc" "$mwmuttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$mwmuttrc"
! grep "^source.*.muttrc" "$mwmuttrc" | grep -v "$mwconfig" >/dev/null && echo "source $mwaccdir/$idnum-$mwaccount.muttrc # mw-autogenerated" >> "$mwmuttrc"
echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $mwaccdir/$idnum-$mwaccount.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $mwaddr\" # mw-autogenerated" >> "$mwmuttrc"
[ "$mwtype" = "offline" ] && echo "macro index gM '<shell-escape>mailsync -Va<enter>' \"sync all mail\" # mw-autogenerated" >> "$mwmuttrc"
! grep "source.*mutt-wizard.muttrc" "$mwmuttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$mwmuttrc"
! grep "^source.*$idnum-$mwaccount.muttrc" "$mwmuttrc" >/dev/null && echo "source $mwaccdir/$idnum-$mwaccount.muttrc # mw-autogenerated" >> "$mwmuttrc"
! grep "^macro .* i$idnum .*" "$mwmuttrc" >/dev/null && echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $mwaccdir/$idnum-$mwaccount.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $mwaddr\" # mw-autogenerated" >> "$mwmuttrc"
if [ "$mwtype" = "offline" ]; then
! grep "^macro .* gM .*" "$mwmuttrc" >/dev/null && echo "macro index gM '<shell-escape>mailsync -Va<enter>' \"sync all mail\" # mw-autogenerated" >> "$mwmuttrc"
fi
return 0
}

@@ -257,8 +259,8 @@ finalize() {
trash=$(echo "$boxes" | grep -i -m 1 trash | sed 's/=/+/g')
sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$mwaccdir/$idnum-$mwaccount.muttrc"
{ echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$mwaccdir/$idnum-$mwaccount.muttrc"
echo "mailboxes =${mwaccount//[.@]/_} ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")"
>> "$mwaccdir/$idnum-$mwaccount.muttrc"
mwaccount_="${mwaccount//[.@]/_}"
echo "mailboxes =${mwaccount_%_*} ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$mwaccdir/$idnum-$mwaccount.muttrc"
printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n"
sed -i "/# mw-autogenerated/d" "$mwaccdir/$idnum-$mwaccount.muttrc"
echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox


+ 1
- 0
share/mutt-wizard.muttrc View File

@@ -78,6 +78,7 @@ set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?'
bind index,pager \Ck sidebar-prev
bind index,pager \Cj sidebar-next
bind index,pager \Co sidebar-open
bind index,pager \Cl sidebar-open
bind index,pager \Cp sidebar-prev-new
bind index,pager \Cn sidebar-next-new
bind index,pager B sidebar-toggle-visible


+ 2
- 2
test/dotests View File

@@ -28,14 +28,14 @@ export mwpass=mutt-wizard-$mwaddr

echo "= manual test 1 ="
mwtype=online mw add
echo "=> In another window, enter mutt and verify that mails are shown"
echo "=> In another window, start mutt and verify that mails are shown"
mw purge
rm -rf $mwmaildir/$mwaddr

echo "= manual test 2 ="
mwtype=offline mw add
mailsync
echo "=> In another window, enter mutt and verify that mails are shown"
echo "=> In another window, start mutt and verify that mails are shown"
echo "=> In mutt press gm and gM, to start mailsync"
mw purge
rm -rf $mwmaildir/$mwaddr


Loading…
Cancel
Save