From 8c69131ad3e23373f2abe4a8d569acaaa7f32562 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sun, 21 Jul 2024 21:14:20 +0200 Subject: tag sent earlier --- bin/tagmail | 81 +++++++++++++++++++++++++++++-------------------------------- 1 file changed, 38 insertions(+), 43 deletions(-) (limited to 'bin') diff --git a/bin/tagmail b/bin/tagmail index c0a1a43..95553b7 100755 --- a/bin/tagmail +++ b/bin/tagmail @@ -156,46 +156,39 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@" (format #t " ~a messages added to spam~%"))))))) (define tag-rules - '(("+ci" "from:travis-ci.com or from:travis-ci.org or from:appveyor.com or from:circleci.com or from:mg.gitlab.com and subject:Pipeline") - ("+slack" "from:slack.com") - ("+immonews/communications" "from:nachrichten.immobilienscout24.de or subject:Kontaktaufnahme and tag:immonews") - ("+ingrid" "from:postmaster@oscarnajera.com or from:root@oscarnajera.com" "Reports from ingrid") - ("+Checkm-Alerts" "subject:Check_MK AND from:ingrid") - ("+fail2ban" "subject:Fail2Ban from:oscarnajera.com" "Fail2ban report") - ("+arsmagna +inbox" "to:arsmagna") - - ;; Toastmasters - ("+NBG-toastmasters" "to:nuremberg.toastmasters@googlemail.com OR to:nuremberg.toastmasters@gmail.com") - ("+Isar-Speak" "to:isarspeak@gmail.com") - ("+toastmasters" "toastmaster NOT from:info@meetup.com NOT from:linkedin.com" ) - - ("+iohk" "from:iohk.io" "IOHK Plutus") - ("+sms" "folder:hi_pers/SMS") - ("+calls" "folder:hi_pers/Calls") - ;; clearing up from newsletters - ("+Indie-Hackers" "from:channing@indiehackers.com") - ("+socialnews" "from:facebookmail.com or from:mail.instagram.com") - ("+promotions" "from:newsletter") - ("+linkedin +socialnews" "from:linkedin.com" "Linkedin") - ("+meetups" "from:info@meetup.com or from:info@email.meetup.com" "Meetups info mails") - ("+immonews" "from:immobilienscout24.de") - ("+newsletter" "from:venturebeat.com") - ("+zeihan" "from:zeihan.com") - ("+freecodecamp" "from:freecodecamp.org") - ;; byteplant - ("+support" "to:support@byteplant.com") - ("+admin" "to:admin@byteplant.com") - ("+sent" "from:byteplant.com") - )) - -(define (clear-inbox options ffi-db) - (display "[Inbox]\n") - (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"))))) - + (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))) + `(("+sent" ,sent "Emails I have sent") + ("+ci" "from:travis-ci.com or from:travis-ci.org or from:appveyor.com or from:circleci.com or from:mg.gitlab.com and subject:Pipeline") + ("+slack" "from:slack.com") + ("+immonews/communications" "from:nachrichten.immobilienscout24.de or subject:Kontaktaufnahme and tag:immonews") + ("+ingrid" "from:postmaster@oscarnajera.com or from:root@oscarnajera.com" "Reports from ingrid") + ("+Checkm-Alerts" "subject:Check_MK AND from:ingrid") + ("+fail2ban" "subject:Fail2Ban from:oscarnajera.com" "Fail2ban report") + ("+arsmagna +inbox" "to:arsmagna.xyz") + + ;; Toastmasters + ("+NBG-toastmasters" "to:nuremberg.toastmasters@googlemail.com OR to:nuremberg.toastmasters@gmail.com") + ("+Isar-Speak" "to:isarspeak@gmail.com") + ("+toastmasters" "toastmaster NOT from:info@meetup.com NOT from:linkedin.com" ) + + ("+iohk" "from:iohk.io" "IOHK Plutus") + ("+sms" "folder:hi_pers/SMS") + ("+calls" "folder:hi_pers/Calls") + ;; clearing up from newsletters + ("+Indie-Hackers" "from:channing@indiehackers.com") + ("+socialnews" "from:facebookmail.com or from:mail.instagram.com") + ("+promotions" "from:newsletter") + ("+linkedin +socialnews" "from:linkedin.com" "Linkedin") + ("+meetups" "from:info@meetup.com or from:info@email.meetup.com" "Meetups info mails") + ("+immonews" "from:immobilienscout24.de") + ("+newsletter" "from:venturebeat.com") + ("+zeihan" "from:zeihan.com") + ("+freecodecamp" "from:freecodecamp.org") + ;; byteplant + ("+support" "to:support@byteplant.com") + ("+admin" "to:admin@byteplant.com") + ("+sent" "from:byteplant.com")))) (define (main args) (let* ((mail-repo (string-append @@ -225,11 +218,13 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@" (with-nm-database (ffi-db mail-repo 'NOTMUCH_DATABASE_MODE_READ_WRITE) - (let ((new (not (option-ref options 'all #f)))) + (let* ((new (not (option-ref options 'all #f))) + (tagger (notmuch-tag options ffi-db new))) (display "[TAG rules]\n") - (map (notmuch-tag options ffi-db new) tag-rules) + (map tagger tag-rules) (list-tag options ffi-db new) - (clear-inbox options ffi-db) + (display "[Inbox]\n") + (tagger '("+inbox" "*" "Inbox for the rest")) (tag-spam options ffi-db "tag:inbox"))))) -- cgit v1.2.3