From c5c39eb8c02c040f077b8a43999e88af40790a42 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 14 Apr 2017 12:21:50 -0400 Subject: update mail filters --- .config/maildirproc/att.rc | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc index 67335e7..f25aa09 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/att.rc @@ -15,12 +15,14 @@ def mailman_domain(mail, domain): m = mail["List-Id"].matches("^(.*<|)([^<]*)\."+re.escape(domain)) if m: return m.group(2) + ret = None for hdr in [ 'To', 'Cc', 'From' ]: m = mail[hdr].matches("((\w|-)*)@"+re.escape(domain)) if m: - if mail["Subject"].contains("["+m.group(1)+"]"): - return m.group(1) - return None + ret = m.group(1) + if mail["Subject"].contains("["+ret+"]"): + return ret + return ret def ezmlm_domain(mail, domain): """ @@ -149,17 +151,19 @@ def my_whitelist(mail): def my_filters(mail): # .software.* (GNU Mailman) - for pair in [ [ 'gnu.org', 'gnu' ], # https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@sbcglobal.net - [ 'nongnu.org', 'nongnu' ], # https://lists.nongnu.org/mailman/options/libreboot/lukeshu@sbcglobal.net - [ 'gnome.org', 'gnome' ], # https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@sbcglobal.net - [ 'archlinux.org', 'archlinux' ], - [ 'lists.freedesktop.org', 'freedesktop' ], - [ 'lists.fedorahosted.org', 'fedorahosted' ], - [ 'lists.arthurdejong.org', 'arthurdejong' ], - [ 'lists.stanford.edu', 'stanford' ], - [ 'mailman.stanford.edu', 'stanford' ], - [ 'lists.parabola.nu', 'parabola' ], - [ 'parabola.nu', 'parabola' ] ]: + for pair in [ + [ '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 + [ 'lists.arthurdejong.org' , 'arthurdejong' ], + [ 'lists.freedesktop.org' , 'freedesktop' ], # https://lists.freedesktop.org/mailman/options/systemd-devel/lukeshu@lukeshu.com + [ 'lists.parabola.nu' , 'parabola' ], # https://lists.parabola.nu/mailman/options/dev/lukeshu@lukeshu.com + [ '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' ], + ]: list = mailman_domain(mail, pair[0]) if list: move_ham(mail, ".software."+pair[1]+"."+list) @@ -182,6 +186,7 @@ def my_filters(mail): or is_to_or_from(mail, "parabolagnulinux.org") or is_to_or_from(mail, "parabola.nu") or is_to_or_from(mail, "kiwwwi.com.ar") + or is_to_or_from(mail, "jon@whiteheat.org.uk") ): move_ham(mail, ".software.parabola") return -- cgit v1.1-4-g5e80