| 作者 | SHA1 | 備註 | 提交日期 |
|---|---|---|---|
|
|
b7b7f21d69
|
-x option fixed, fix #1014 | 1 年之前 |
|
|
0f9cf65e10
|
properly create imapnotify dir | 1 年之前 |
|
|
40ff0fc93f
|
Merge pull request #1012 from czardien/fix
Fix unary operator expected error |
1 年之前 |
|
|
d0dfcc3c27 |
Fix unary operator expected error
On my system running any `mw` command after a fresh install from the AUR, I get: ``` /usr/bin/mw: line 37: [: 1.5: unary operator expected ``` Now the script doesn't error per-se but it does set the `master` and `slave` variables to wrong values. I'm also not sure how this wasn't raised before; maybe that's a new bash version thing? I'm on 5.2.37. Anyway I faffed around trying to fix this, in particular with the `-gt` operator but it turned out that properly comparing float numbers is a pain in the butt in bash. I found solutions using `bc` which I thought were weird. To keep things simple I ended up doing a little substitution on the dot `.` character and turned these nasty floats into integers, along with using the `-gt` operator which did the trick on my system. May be unorthodox so feedback is more than welcome. Thank you for the great software by the way, lots of gratitude for your work. |
1 年之前 |
|
|
943b45340c
|
Revert "fix #993"
This reverts commit
|
1 年之前 |
|
|
883e570d6d
|
fix #993 | 1 年之前 |
|
|
cfc06f891d
|
more robust mbsync check, close #956 | 1 年之前 |
|
|
31589ada92
|
use lmdb if available, close #950 | 1 年之前 |
|
|
213afe1e8f
|
Merge pull request #976 from ivan-boikov/master
No mailsync with locked GPG key in non-interactive shells |
1 年之前 |
|
|
5300aa7f72
|
Merge pull request #924 from CarlosLoboxyz/master
Add goimapnotify for push notifications |
1 年之前 |
|
|
650794bb1d
|
Merge branch 'master' into master | 1 年之前 |
|
|
05fcf7b3e1
|
Merge pull request #1003 from staticssleever668/fix_dash_subject
fix(mailsync): delimit notification text from flags |
1 年之前 |
|
|
06e82c8a10
|
Merge pull request #967 from appeasementPolitik/patch-1
Fix notify-send not coming through with goimapnotify |
1 年之前 |
|
|
ed946ef98b
|
Merge branch 'master' into patch-1 | 1 年之前 |
|
|
1d6dc7b8f6
|
Merge pull request #1004 from alx-sychev/fix_man_mw_P_option_formatting
fix -P option description formatting in mw.1 |
1 年之前 |
|
|
ea8fef3438
|
Merge pull request #999 from jdujava/fix-multiline-subjects
Fix notifications for mails with multiline subject |
1 年之前 |
|
|
8cb5f9d2e4
|
Merge pull request #1000 from jdujava/fix-plural
Fix usages of mail/mails |
1 年之前 |
|
|
0a95e2cb9b | fix -P option description formatting in mw.1 | 1 年之前 |
|
|
824feedc68
|
fix(mailsync): delimit notification text from flags
Fixes text being interpreted as flags when it starts with a dash. Try sending yourself a letter with subject starting with '-'. E.g. if subject is '-10%' fixes error: > Unknown option -10% |
1 年之前 |
|
|
8e35e474c5
|
Fix usages of mail/mails
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com> |
1 年之前 |
|
|
43eceb5536
|
Fix notifications for mails with multiline subject
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com> |
1 年之前 |
|
|
f8ffab3a11 | No mailsync with locked GPG key in non-interactive shells | 2 年之前 |
|
|
532332b8df
|
Fix notify-send not coming through | 2 年之前 |
|
|
058fc42c21 | Add goimapnotify for push notifications | 3 年之前 |
| @@ -4,7 +4,7 @@ https://muttwizard.com/ | |||||
| Get this great stuff without effort: | Get this great stuff without effort: | ||||
| - A full-featured and autoconfigured email client on the terminal with neomutt | |||||
| - A full-featured and autoconfigured email client on the terminal wibuiltth neomutt | |||||
| - Mail stored offline enabling the ability to: | - Mail stored offline enabling the ability to: | ||||
| * view and write emails while you're away from | * view and write emails while you're away from | ||||
| the internet | the internet | ||||
| @@ -54,6 +54,8 @@ A user of Arch-based distros can also install the current mutt-wizard release fr | |||||
| ### Optional Dependencies | ### Optional Dependencies | ||||
| - `goimapnotify` - required for push notifications. | |||||
| [Check here for reference](https://wiki.archlinux.org/title/Isync#With_imapnotify). | |||||
| - `pam-gnupg` - Automatically logs you into your GPG key on login so you will | - `pam-gnupg` - Automatically logs you into your GPG key on login so you will | ||||
| never need to input your password once logged on to your system. Check the | never need to input your password once logged on to your system. Check the | ||||
| repo and directions out [here](https://github.com/cruegge/pam-gnupg). | repo and directions out [here](https://github.com/cruegge/pam-gnupg). | ||||
| @@ -134,6 +136,12 @@ To give you an example of the interface, here's an idea: | |||||
| - <kbd>ctrl-b</kbd> - open a menu to select a URL you want to open in your browser. | - <kbd>ctrl-b</kbd> - open a menu to select a URL you want to open in your browser. | ||||
| - <kbd>p</kbd> - encrypt/sign your message (in compose view, before sending the email). | - <kbd>p</kbd> - encrypt/sign your message (in compose view, before sending the email). | ||||
| ## Enable push notifications per mail | |||||
| **Note**: Replace the `fulladdrs` with your actual email address. You have to do this for each new mail you want to setup instant notifications. | |||||
| ```bash | |||||
| systemctl enable --user goimapnotify@fulladdrs.service | |||||
| ``` | |||||
| ## Additional functionality | ## Additional functionality | ||||
| - `pam-gnupg` - Automatically logs you into your GPG key on login, so you will | - `pam-gnupg` - Automatically logs you into your GPG key on login, so you will | ||||
| @@ -24,6 +24,9 @@ eval "$(grep -h -- \ | |||||
| "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ | "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ | ||||
| "$HOME/.pam_environment" 2>/dev/null)" | "$HOME/.pam_environment" 2>/dev/null)" | ||||
| # For non-interactive shell (e.g. cron job) run only when the GPG key (in $GNUPGHOME or pass --homedir) is unlocked | |||||
| tty -s || (echo "dummy" | gpg --sign --batch --pinentry-mode error -o /dev/null > /dev/null 2>&1) || exit | |||||
| export GPG_TTY="$(tty)" | export GPG_TTY="$(tty)" | ||||
| [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" | [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" | ||||
| @@ -45,7 +48,7 @@ case "$(uname)" in | |||||
| notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do | notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do | ||||
| export DISPLAY="$x" | export DISPLAY="$x" | ||||
| notify-send --app-name="mutt-wizard" "$1" "$2" | |||||
| notify-send --app-name="mutt-wizard" -- "$1" "$2" | |||||
| done ;} | done ;} | ||||
| ;; | ;; | ||||
| esac | esac | ||||
| @@ -63,16 +66,17 @@ syncandnotify() { | |||||
| newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) | newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) | ||||
| case 1 in | case 1 in | ||||
| $((newcount > 5)) ) | $((newcount > 5)) ) | ||||
| echo "$newcount new mail for $2." | |||||
| [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mail(s) in \`$2\` account." | |||||
| echo "$newcount new mails for $2." >/dev/tty | |||||
| [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mails in \`$2\` account." | |||||
| ;; | ;; | ||||
| $((newcount > 0)) ) | $((newcount > 0)) ) | ||||
| echo "$newcount new mail for $2." | |||||
| echo "$newcount new mail(s) for $2." >/dev/tty | |||||
| [ -z "$MAILSYNC_MUTE" ] && | [ -z "$MAILSYNC_MUTE" ] && | ||||
| for file in $new; do | for file in $new; do | ||||
| # Extract and decode subject and sender from mail. | |||||
| subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" | | |||||
| perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | |||||
| # Extract and decode subject and sender from mail. | |||||
| subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 | | |||||
| perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | | |||||
| sed 's/^Subject: //' | tr -d '\n\t') | |||||
| from="$(sed -n "/^From:/ s|From: *|| p" "$file" | | from="$(sed -n "/^From:/ s|From: *|| p" "$file" | | ||||
| perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | ||||
| from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" | from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" | ||||
| @@ -1,4 +1,4 @@ | |||||
| #!/bin/sh | |||||
| #!/bin/bash | |||||
| set -a | set -a | ||||
| @@ -12,12 +12,14 @@ msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" | |||||
| msmtplog="${XDG_STATE_HOME:-$HOME/.local/state}/msmtp/msmtp.log" | msmtplog="${XDG_STATE_HOME:-$HOME/.local/state}/msmtp/msmtp.log" | ||||
| mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" | mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" | ||||
| mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" | mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" | ||||
| imapnotify="${XDG_CONFIG_HOME:-$HOME/.config}/imapnotify" | |||||
| mpoptemp="$muttshare/mpop-temp" | mpoptemp="$muttshare/mpop-temp" | ||||
| mbsynctemp="$muttshare/mbsync-temp" | mbsynctemp="$muttshare/mbsync-temp" | ||||
| mutttemp="$muttshare/mutt-temp" | mutttemp="$muttshare/mutt-temp" | ||||
| msmtptemp="$muttshare/msmtp-temp" | msmtptemp="$muttshare/msmtp-temp" | ||||
| onlinetemp="$muttshare/online-temp" | onlinetemp="$muttshare/online-temp" | ||||
| notmuchtemp="$muttshare/notmuch-temp" | notmuchtemp="$muttshare/notmuch-temp" | ||||
| imapnotifytemp="$muttshare/imapnotify-temp" | |||||
| # With the use of templates, it's impossible to use parameter substitution. | # With the use of templates, it's impossible to use parameter substitution. | ||||
| # Therefore, some default variables that might be otherwise overwritten are set | # Therefore, some default variables that might be otherwise overwritten are set | ||||
| # here. | # here. | ||||
| @@ -29,14 +31,19 @@ maxmes="0" | |||||
| alias mbsync='mbsync -c "$mbsyncrc"' | alias mbsync='mbsync -c "$mbsyncrc"' | ||||
| # mbsync now requires "Far/Near" rather than "Master/Slave", but Ubuntu/Debian | |||||
| # have the older version. | |||||
| if command -V apt-get >/dev/null 2>&1; then | |||||
| master="Master" | |||||
| slave="Slave" | |||||
| else | |||||
| # mbsync >=1.4.0 requires "Far/Near" rather than "Master/Slave." | |||||
| mbver="$(mbsync -v)" | |||||
| mbver="${mbver#* }" | |||||
| mbver="${mbver%.*}" | |||||
| # Comparing two float numbers in bash is a pain in the butt, so we get rid of | |||||
| # dots and turn them into nice integers | |||||
| mbver="${mbver/\./}" | |||||
| if [ "${mbver}" -gt 14 ]; then | |||||
| master="Far" | master="Far" | ||||
| slave="Near" | slave="Near" | ||||
| else | |||||
| master="Master" | |||||
| slave="Slave" | |||||
| fi | fi | ||||
| for x in "/etc/ssl/certs/ca-certificates.crt" \ | for x in "/etc/ssl/certs/ca-certificates.crt" \ | ||||
| @@ -78,6 +85,10 @@ prepmpop() { | |||||
| envsubst <"$mpoptemp" >>"$mpoprc" | envsubst <"$mpoptemp" >>"$mpoprc" | ||||
| } | } | ||||
| prepimapnotify() { | |||||
| mkdir -p "$imapnotify" ; envsubst < "$imapnotifytemp" >> "$imapnotify/$fulladdr.conf" | |||||
| } | |||||
| prepmutt() { | prepmutt() { | ||||
| mkdir -p "${muttrc%/*}" "$accdir" | mkdir -p "${muttrc%/*}" "$accdir" | ||||
| envsubst <"$mutttemp" >"$accdir/$fulladdr.muttrc" | envsubst <"$mutttemp" >"$accdir/$fulladdr.muttrc" | ||||
| @@ -85,6 +96,7 @@ prepmutt() { | |||||
| ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >>"$muttrc" | ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >>"$muttrc" | ||||
| ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >>"$muttrc" | ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >>"$muttrc" | ||||
| echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\"" >>"$muttrc" | echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\"" >>"$muttrc" | ||||
| neomutt -v | grep -q lmdb && ! grep -q "^set header_cache_backend.*lmdb" "$muttrc" && echo "set header_cache_backend = \"lmdb\"" >>"$muttrc" | |||||
| } | } | ||||
| getprofiles() { | getprofiles() { | ||||
| @@ -106,6 +118,7 @@ getprofiles() { | |||||
| prepmsmtp | prepmsmtp | ||||
| prepmutt | prepmutt | ||||
| prepnotmuch | prepnotmuch | ||||
| prepimapnotify | |||||
| } | } | ||||
| parsedomains() { | parsedomains() { | ||||
| @@ -181,7 +194,7 @@ askinfo() { | |||||
| } | } | ||||
| insertpass() { | insertpass() { | ||||
| printf "%s" "$password" | pass insert -fe "$PASSWORD_STORE_DIR/$passprefix$fulladdr" | |||||
| printf "%s" "$password" | pass insert -fe "$passprefix$fulladdr" | |||||
| } | } | ||||
| errorexit() { | errorexit() { | ||||
| @@ -70,6 +70,7 @@ SMTP server port (assumed to be 465 if not specified) | |||||
| .TP | .TP | ||||
| .B -x | .B -x | ||||
| Account password. You will be prompted for the password interactively if this option is not given. | Account password. You will be prompted for the password interactively if this option is not given. | ||||
| .TP | |||||
| .B -P | .B -P | ||||
| Pass Prefix. The password will be stored using pass at <passprefix><email> | Pass Prefix. The password will be stored using pass at <passprefix><email> | ||||
| .SH OTHER OPTIONS | .SH OTHER OPTIONS | ||||
| @@ -0,0 +1,15 @@ | |||||
| { | |||||
| "host": "$imap", | |||||
| "port": $iport, | |||||
| "tls": true, | |||||
| "tlsOptions": { | |||||
| "rejectUnauthorized": false | |||||
| }, | |||||
| "username": "$login", | |||||
| "password": "", | |||||
| "passwordCmd": "pass $passprefix$fulladdr", | |||||
| "onNewMail": "mailsync", | |||||
| "onNewMailPost": "", | |||||
| "boxes": [ "INBOX" ] | |||||
| } | |||||