From 3a39cdcdbee17eeb15d4bed19ded8e2046812e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Sat, 12 Nov 2022 13:46:50 +0100 Subject: some mail cleanups --- bin/tagmail | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/tagmail b/bin/tagmail index febbdd5..af1c939 100755 --- a/bin/tagmail +++ b/bin/tagmail @@ -176,8 +176,8 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@" (define (clear-inbox options ffi-db) (display "[Inbox]\n") - (let* ((my-emails (list "hi@oscarnajera.com" "hello@oscarnajera.com" "najera.oscar@gmail.com")) - (sent (format #f "(~{from:~a~^ OR ~}) AND NOT (~:*~{to:~a~^ OR ~})" my-emails))) + (let ((sent (format #f "(~{from:~a~^ OR ~}) AND NOT (~:*~{to:~a~^ OR ~})" + (assq-ref options 'my-emails)))) (map (notmuch-tag options ffi-db #t) `(("+sent" ,sent "Emails I have sent") ("+inbox" "*" "Inbox for the rest"))))) @@ -187,19 +187,19 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@" (let* ((mail-repo (string-append (passwd:dir (getpwuid (geteuid))) "/.mail/" )) + (my-emails (list "hi@oscarnajera.com" "hello@oscarnajera.com" "najera.oscar@gmail.com")) (option-spec '((version (single-char #\V) (value #f)) (help (single-char #\h) (value #f)) (all (value #f)) (dry-run (single-char #\n) (value #f)))) - (options (cons (cons 'mail-repo mail-repo) + (options (append (list (cons 'mail-repo mail-repo) + (cons 'my-emails my-emails)) (getopt-long args option-spec))) (account (assq-ref options '()) )) (delete-email-files! options) - (when (or (and (null? '()) - (access? (string-append mail-repo "hi_pers") W_OK)) - (and (string? account) - (string=? account "hi_pers"))) + (when (and (or (null? account) (and (string? account) (string=? account "hi_pers"))) + (access? (string-append mail-repo "hi_pers") W_OK)) (move-mail! options "hi_pers" "tag:spam" "Inbox" "Junk")) @@ -210,7 +210,7 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@" (system "notmuch new")) (with-nm-database - (ffi-db (assq-ref options 'mail-repo) 1) + (ffi-db mail-repo 'NOTMUCH_DATABASE_MODE_READ_WRITE) (let ((new (not (option-ref options 'all #f)))) (display "[TAG rules]\n") (map (notmuch-tag options ffi-db new) tag-rules) -- cgit v1.2.3