| @@ -32,9 +32,6 @@ mwgetmaildir=$mwconfigdir/getmail # POP3 | |||||
| mwmsmtprc="$mwconfigdir/msmtp/config" | mwmsmtprc="$mwconfigdir/msmtp/config" | ||||
| mwsharerc="$mwshare/$_MW_.muttrc" | mwsharerc="$mwshare/$_MW_.muttrc" | ||||
| mwcachedir="${XDG_CACHE_HOME:-$HOME/.cache}/$_MW_" | mwcachedir="${XDG_CACHE_HOME:-$HOME/.cache}/$_MW_" | ||||
| mwmbsyncbin="$prefix/bin/mbsync -c $mwmbsyncrc" | |||||
| mwgetmailbin="$prefix/bin/getmail" | |||||
| msmtpbin="$prefix/bin/msmtp" | |||||
| _mwtakeaddr(){ | _mwtakeaddr(){ | ||||
| mwaccmaildir="$mwmaildir/$mwaddr" # mail dir is $MAILDIR/email | mwaccmaildir="$mwmaildir/$mwaddr" # mail dir is $MAILDIR/email | ||||
| @@ -89,7 +86,7 @@ _mwasktype() { | |||||
| done | done | ||||
| fi | fi | ||||
| if [ "$mwtype" == "offline" ]; then | if [ "$mwtype" == "offline" ]; then | ||||
| ! type "$prefix/bin/msmtp" >/dev/null && printf "\033[31m\`msmtp\` must be installed. You can do that afterwards.\\n\033[0m" | |||||
| ! type "msmtp" >/dev/null && printf "\033[31m\`msmtp\` must be installed. You can do that afterwards.\\n\033[0m" | |||||
| else | else | ||||
| ! ( type mutt >/dev/null || type neomutt >/dev/null ) && printf "\033[31m\`mutt\` must be installed. You can do that afterwards.\\n\033[0m" | ! ( type mutt >/dev/null || type neomutt >/dev/null ) && printf "\033[31m\`mutt\` must be installed. You can do that afterwards.\\n\033[0m" | ||||
| fi | fi | ||||
| @@ -196,7 +193,7 @@ EOF | |||||
| _mwprotonfinger() { | _mwprotonfinger() { | ||||
| printf "Getting Protonmail bridge fingerprint...\\n" | printf "Getting Protonmail bridge fingerprint...\\n" | ||||
| mwfingerprint="$($msmtpbin --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off)" || return 1 | |||||
| mwfingerprint="$(msmtp --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off)" || return 1 | |||||
| sed -i "s/account $mwaddr/&\ntls_trust_file\ntls_fingerprint $mwfingerprint/" "$mwmsmtprc" &>/dev/null | sed -i "s/account $mwaddr/&\ntls_trust_file\ntls_fingerprint $mwfingerprint/" "$mwmsmtprc" &>/dev/null | ||||
| } | } | ||||
| @@ -261,10 +258,10 @@ _mwprofiles() { | |||||
| if [ "$mwtype" = "offline" ]; then # not online, actually outside mutt | if [ "$mwtype" = "offline" ]; then # not online, actually outside mutt | ||||
| if [ "${mwkind::3}" = "pop" ]; then | if [ "${mwkind::3}" = "pop" ]; then | ||||
| ! type "$prefix/bin/getmail" >/dev/null && printf "\033[31mFor POP3 \`getmail\` must be installed to use \`mw\`. You can do that afterwards.\\n\033[0m" | |||||
| ! type getmail >/dev/null && printf "\033[31mFor POP3 \`getmail\` must be installed to use \`mw\`. You can do that afterwards.\\n\033[0m" | |||||
| _mwpop | _mwpop | ||||
| else | else | ||||
| ! type "$prefix/bin/mbsync" >/dev/null && printf "\033[31mFor IMAP \`mbsync\` must be installed to use \`mw\`. You can do that afterwards.\\n\033[0m" | |||||
| ! type mbsync >/dev/null && printf "\033[31mFor IMAP \`mbsync\` must be installed to use \`mw\`. You can do that afterwards.\\n\033[0m" | |||||
| _mwmbsync | _mwmbsync | ||||
| fi | fi | ||||
| _mwsmtp | _mwsmtp | ||||
| @@ -285,7 +282,6 @@ _mwtryconnect() { | |||||
| grep "+OK" && mwmailboxes="INBOX" | grep "+OK" && mwmailboxes="INBOX" | ||||
| else | else | ||||
| # for online do without mbsync, i.e. don't require it for mail setup, either | # for online do without mbsync, i.e. don't require it for mail setup, either | ||||
| # mwmailboxes="$($mwmbsyncbin -l $mwaddr | sed 's/\//./')" >/dev/null 2>&1 | |||||
| [ "$mwport" = "143" ] && mwi="IMAP4" || mwi="IMAP4_SSL" | [ "$mwport" = "143" ] && mwi="IMAP4" || mwi="IMAP4_SSL" | ||||
| mwpw="$(pass $mwpass)" | mwpw="$(pass $mwpass)" | ||||
| mwmailboxes="$(python -c "from imaplib import $mwi;m=$mwi('$mwurl');m.login('$mwlogin','$mwpw');b=m.list()[1];print('\n'.join(e.split(b' \"/\" ')[-1].strip(b'\"').decode() for e in b if all(x not in e for x in [b'[Gmail]/All Mail',b'Noselect',b'HasChildren'])));m.logout()")" | mwmailboxes="$(python -c "from imaplib import $mwi;m=$mwi('$mwurl');m.login('$mwlogin','$mwpw');b=m.list()[1];print('\n'.join(e.split(b' \"/\" ')[-1].strip(b'\"').decode() for e in b if all(x not in e for x in [b'[Gmail]/All Mail',b'Noselect',b'HasChildren'])));m.logout()")" | ||||
| @@ -501,7 +497,7 @@ macro index gm "<shell-escape>mw $mwaddr<enter>" "sync mail $mwaddr" | |||||
| set folder = "$mwaccmaildir" | set folder = "$mwaccmaildir" | ||||
| folder-hook \$folder '$mwmuttsync' | folder-hook \$folder '$mwmuttsync' | ||||
| set sendmail = "/usr/bin/msmtp -a \$from" | |||||
| set sendmail = "msmtp -a \$from" | |||||
| EOF | EOF | ||||
| else # online | else # online | ||||
| @@ -643,9 +639,9 @@ _mwgatheremails() { | |||||
| _mwsyncandnotify() { | _mwsyncandnotify() { | ||||
| mwaccmaildir="$mwmaildir/$mwaddr" | mwaccmaildir="$mwmaildir/$mwaddr" | ||||
| if [ -f "$mwgetmaildir/$mwaddr" ]; then | if [ -f "$mwgetmaildir/$mwaddr" ]; then | ||||
| $mwgetmailbin --rcfile=$mwaddr --getmaildir=$mwgetmaildir | |||||
| getmail --rcfile=$mwaddr --getmaildir=$mwgetmaildir | |||||
| else | else | ||||
| $mwmbsyncbin $mwaddr | |||||
| mbsync -c $mwmbsyncrc $mwaddr | |||||
| fi | fi | ||||
| [ -n "$mwnono" ] && return | [ -n "$mwnono" ] && return | ||||
| mwlastrun="$mwaccmaildir/.mw.lastrun" | mwlastrun="$mwaccmaildir/.mw.lastrun" | ||||