diff options
author | Luke Smith <luke@lukesmith.xyz> | 2021-01-06 21:13:48 -0500 |
---|---|---|
committer | Luke Smith <luke@lukesmith.xyz> | 2021-01-06 21:13:48 -0500 |
commit | ca9f1a12ccbc01889fd2a1257462594e4d2ea272 (patch) | |
tree | 0ae0461396bf9a1787be2fcb733db9ba17e61dc7 /bin/mw | |
parent | 4dbf70e40355b73b16a3b0b010960a0d1a681740 (diff) |
use curl to login
rm mbsync requirement for online storage
Diffstat (limited to 'bin/mw')
-rwxr-xr-x | bin/mw | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -199,9 +199,8 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_ # On Ubuntu/Debian, a link is needed since they use an older version. command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null - # Create the mbsync config file. - mkdir -p "${mbsyncrc%/*}" - echo "$mbsync_profile" >> "$mbsyncrc" + # Create the mbsync config file if local account. + [ -z "${online+x}" ] && mkdir -p "${mbsyncrc%/*}" && echo "$mbsync_profile" >> "$mbsyncrc" # Create a muttrc for viewing mail. echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" @@ -230,14 +229,10 @@ Junk Trash Sent Archive" && return 0 - if mailboxes="$(mbsync -l "$fulladdr" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then - [ -n "${online+x}" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu - return 0 - else - echo "$mailboxes" - echo "Log-on not successful." - return 1 - fi ;} + info="$(curl -s --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" || + { echo "Log-on not successful." ; exit 1 ;} + mailboxes="$(echo "$info" | sed "s/.*\" //" | tr -d '
')" +} finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" sed -ibu "/$marker/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" |