diff --git a/bin/mw b/bin/mw index 8712bf0..c28b2cd 100755 --- a/bin/mw +++ b/bin/mw @@ -76,6 +76,32 @@ MaxMessages $maxmes # End profile " +mbsync_protonmail_profile="IMAPStore $title-remote +Host $imap +Port $iport +User $login +PassCmd \"pass mutt-wizard-$title\" +SSLType $ssltype +AuthMechs LOGIN +CertificateFile $sslcert + +MaildirStore $title-local +Subfolders Verbatim +Path ~/.local/share/mail/$title/ +Inbox ~/.local/share/mail/$title/INBOX +Flatten . + +Channel $title +Expunge Both +Master :$title-remote: +Slave :$title-local: +Patterns * !\"[Gmail]/All Mail\" +Create Both +SyncState * +MaxMessages $maxmes +# End profile +" + if [ "$accounttype" = "offline" ]; then mutt_profile="# vim: filetype=neomuttrc # muttrc file for account $title @@ -181,11 +207,11 @@ EOF [ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc" echo "$msmtp_profile" >> "$msmtprc" command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null + echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" case "$service" in protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;; + *) echo "$mbsync_profile" >> "$mbsyncrc" esac - echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" - echo "$mbsync_profile" >> "$mbsyncrc" notmuchauto [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." ! grep "^source.*mutt-wizard.muttrc" "$muttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$muttrc" @@ -194,8 +220,9 @@ EOF } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" - fingerprint="$(msmtp --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off)" || return 1 + fingerprint="$(msmtp --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off|grep SHA256:|awk '{print $2}')" || return 1 sed -ibu "s/account $title/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu + echo "$mbsync_protonmail_profile" >> "$mbsyncrc" } getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1