From 587b1c0f9fef77dd52c9d7db5a483851e10aa7a1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 21 Mar 2018 12:04:40 -0400 Subject: mail filters --- .config/maildirproc/default.rc | 46 +++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc index e264cc3..2b6e3c8 100644 --- a/.config/maildirproc/default.rc +++ b/.config/maildirproc/default.rc @@ -104,6 +104,17 @@ def is_to_or_from(mail, address): return any(match_glob(addr, address) for addr in all_addresses(mail)) def is_to_or_from_re(mail, address): return any(match_re(addr, address) for addr in all_addresses(mail)) + + +def is_me(address): + return any(match_glob(address, glob) for glob in ["@lukeshu.com", + "lukeshu@sbcglobal.net", + "lukeshu@parabola.nu", + "lukeshu@purdue.edu", + "shumakl@purdue.edu"]) +def is_to_me(mail): + return any(is_me(addr) for addr in destination_addresses(mail)) + # # bogofilter utilites @@ -142,6 +153,7 @@ def my_whitelist(mail): return ( False or is_to_or_from(mail, "opengroup.org") + or is_to_or_from(mail, "reproducible-builds.org") or is_to_or_from(mail, "purestorage.com") or is_to_or_from(mail, "sourceware.org") or is_to_or_from(mail, "vger.kernel.org") @@ -149,8 +161,13 @@ def my_whitelist(mail): or is_to_or_from(mail, "cacnedcomms@gmail.com") or is_to_or_from(mail, "fsf.org") or is_to_or_from(mail, "gnu.org") + or is_to_or_from(mail, "nongnu.org") or is_to_or_from(mail, "parabola.nu") or is_to_or_from(mail, "parabolagnulinux.org") + or is_from(mail, "schwab.com") + or is_from(mail, "redhat.com") + or is_from(mail, "linkedin.com") + or is_from(mail, "guru.com") or is_from(mail, "3174451635@mms.att.net") or is_from(mail, "MAILER-DAEMON@yahoo.com") or is_from(mail, "careereco.com") @@ -167,7 +184,6 @@ def my_whitelist(mail): or is_from(mail, "mail.scribd.com") or is_from(mail, "massdrop.com") or is_from(mail, "msdlt.k12.in.us") - or is_from(mail, "parabola.nu") or is_from(mail, "post.oreilly.com") or is_from(mail, "scouting.org") or is_from(mail, "solutionsinplastic.com") @@ -193,6 +209,10 @@ def my_filters(mail): if mail["From"].contains("Parabola Website Notification "): move_ham(mail, ".software.parabola.dev.web-notif") return + if is_to_me(mail) and mail["List-Id"] != "" and mail['Cc'] != "": + if not is_from(mail, "notifications@github.com") and not is_from(mail, "gerrit2@projects.savoirfairelinux.com"): + move_ham(mail, ".mailinglist-dup") + return # .software.POSIX (custom mlm, I think) if is_to_or_from(mail, "austin-group-l@opengroup.org"): @@ -203,6 +223,7 @@ def my_filters(mail): [ 'archlinux.org' , 'archlinux' ], # @sbcglobal.net and @lukeshu.com ; problems delivering to Yahoo! [ 'gnome.org' , 'gnome' ], # https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@lukeshu.com [ 'gnu.org' , 'gnu' ], # https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@lukeshu.com + [ 'listas.trisquel.info' , 'trisquel' ], [ 'lists.arthurdejong.org' , 'arthurdejong' ], [ 'lists.fedorahosted.org' , 'fedorahosted' ], [ 'lists.freedesktop.org' , 'freedesktop' ], # https://lists.freedesktop.org/mailman/options/systemd-devel/lukeshu@lukeshu.com @@ -210,8 +231,8 @@ def my_filters(mail): [ 'lists.reproducible-builds.org' , 'reproducible-builds' ], # https://lists.reproducible-builds.org/options/rb-general/lukeshu@lukeshu.com [ 'nongnu.org' , 'nongnu' ], # https://lists.nongnu.org/mailman/options/gnu-linux-libre/lukeshu@lukeshu.com [ 'redhat.com' , 'redhat' ], # https://www.redhat.com/mailman/options/pam-list/lukeshu@lukeshu.com - [ 'lists.stanford.edu' , 'stanford' ], - [ 'mailman.stanford.edu' , 'stanford' ], + [ 'lists.stanford.edu' , 'stanford' ], # https://mailman.stanford.edu/mailman/options/liberationtech-jobs/lukeshu@lukeshu.com + [ 'mailman.stanford.edu' , 'stanford' ], ]: list = mailman_domain(mail, pair[0]) @@ -239,17 +260,21 @@ def my_filters(mail): # .software.parabola if ( False + or is_to_or_from(mail, "1984.is") or is_to_or_from(mail, "ceata.org") - or is_to_or_from(mail, "kiwwwi.com.ar") or is_to_or_from(mail, "endefensadelsl.org") + or is_to_or_from(mail, "hyperbola.info") + or is_to_or_from(mail, "kiwwwi.com.ar") or is_to_or_from(mail, "parabola.nu") or is_to_or_from(mail, "parabolagnulinux.org") or is_to_or_from(mail, "xylon.me.uk") or False + or is_to_or_from(mail, "bill-auger@peers.community") + or is_to_or_from(mail, "eliotime3000@openmailbox.org") or is_to_or_from(mail, "g4jc@openmailbox.org") or is_to_or_from(mail, "jon@whiteheat.org.uk") + or is_to_or_from(mail, "parabola@openmailbox.org") or is_to_or_from(mail, "srw@openmailbox.org") - or is_to_or_from(mail, "eliotime3000@openmailbox.org") ): move_ham(mail, ".software.parabola") return @@ -274,8 +299,11 @@ def my_filters(mail): "gnu.org", "ietf.org", "kde.org", + "kernel.org", + "launchpad.net", "mozilla.org", "nongnu.org", + "savoirfairelinux.com", "sourceforge.com", "thyrsus.com", ]: @@ -448,6 +476,9 @@ def my_filters(mail): if is_from(mail, "ebay.com"): move_ham(mail, ".misc.ebay") return + if is_from(mail, "paypal.com"): + move_ham(mail, ".misc.paypal") + return if ( False or is_to_or_from(mail, "margieshu@sbcglobal.net") @@ -545,9 +576,10 @@ def handle_incoming_unknown(mail): processor.maildir_base = "~/Maildir" processor.auto_reload_rcfile = True handle_mapping = { - "REMOTES/ATT/Inbox": handle_incoming_unknown, - "REMOTES/ATT/Bulk Mail": handle_incoming_unknown, # fucking Yahoo! +# "REMOTES/ATT/Inbox": handle_incoming_unknown, +# "REMOTES/ATT/Bulk Mail": handle_incoming_unknown, # fucking Yahoo! "REMOTES/lukeshu/INBOX": handle_incoming_unknown, + "QUEUES/Unknown": handle_incoming_unknown, "QUEUES/Spam": handle_incoming_spam_training, "QUEUES/Ham": handle_incoming_ham_training, } -- cgit v1.2.3