Parcourir la source

tests and fixes

pull/276/head
Roland Puntaier il y a 6 ans
Parent
révision
9e88c2d632
4 fichiers modifiés avec 15 ajouts et 10 suppressions
  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 Voir le fichier

@@ -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. 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. - 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. 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: ## Watch out for these things:




+ 10
- 8
bin/mw Voir le fichier

@@ -196,20 +196,22 @@ EOF
getprofiles getprofiles
mkdir -p "$mwmuttdir" "$mwaccdir" "$mwcachedir/$mwaccount/bodies" "$mwconfigdir/msmtp" mkdir -p "$mwmuttdir" "$mwaccdir" "$mwcachedir/$mwaccount/bodies" "$mwconfigdir/msmtp"
getaccounts 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" [ ! -f "$mwmsmtprc" ] && echo "$msmtp_header" > "$mwmsmtprc"
echo "$msmtp_profile" >> "$mwmsmtprc" echo "$msmtp_profile" >> "$mwmsmtprc"
case "$mwservice" in case "$mwservice" in
protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;; protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;;
esac esac
echo "$mutt_profile" > "$mwaccdir/$idnum-$mwaccount.muttrc"
mkdir -p ${mwmbsyncrc%/*} mkdir -p ${mwmbsyncrc%/*}
echo "$mbsync_profile" >> "$mwmbsyncrc" echo "$mbsync_profile" >> "$mwmbsyncrc"
echo "$mutt_profile" > "$mwaccdir/$idnum-$mwaccount.muttrc"
[ ! -f "$mwmuttrc" ] && echo "# vim: filetype=neomuttrc" > "$mwmuttrc" && echo "muttrc created." [ ! -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 return 0
} }


@@ -257,8 +259,8 @@ finalize() {
trash=$(echo "$boxes" | grep -i -m 1 trash | sed 's/=/+/g') 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" 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 "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" printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n"
sed -i "/# mw-autogenerated/d" "$mwaccdir/$idnum-$mwaccount.muttrc" sed -i "/# mw-autogenerated/d" "$mwaccdir/$idnum-$mwaccount.muttrc"
echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox


+ 1
- 0
share/mutt-wizard.muttrc Voir le fichier

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


+ 2
- 2
test/dotests Voir le fichier

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


echo "= manual test 1 =" echo "= manual test 1 ="
mwtype=online mw add 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 mw purge
rm -rf $mwmaildir/$mwaddr rm -rf $mwmaildir/$mwaddr


echo "= manual test 2 =" echo "= manual test 2 ="
mwtype=offline mw add mwtype=offline mw add
mailsync 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" echo "=> In mutt press gm and gM, to start mailsync"
mw purge mw purge
rm -rf $mwmaildir/$mwaddr rm -rf $mwmaildir/$mwaddr


Chargement…
Annuler
Enregistrer