From 971fb829748b8c1727825c03cfc8b8ef6e3fea35 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Apr 2015 02:58:06 -0400 Subject: maildirproc: work on filters --- .config/maildirproc/att.rc | 152 ++++++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 70 deletions(-) diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc index 7ee5f42..c94ac8d 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/att.rc @@ -89,7 +89,7 @@ def handle_incoming_unknown(mail): or mail["From"].contains("@wolframalpha.com>") or mail["From"].contains("margieshu@sbcglobal.net") or mail["From"].contains("parabolagnulinux.org") - or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre)\.org") + or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre|fedorahosted)\.org") or mail["List-Id"].matches(".*\.parabola\.nu") or mail["Subject"].contains("[Dev]") or mail["Subject"].contains("[Maintenance]") @@ -115,36 +115,66 @@ def handle_incoming_unknown(mail): def my_filters(mail): # Sort mail from GNU mailing lists - for list in [ 'bug-gsrc', 'bug-make', 'help-make', 'social', 'help-grub', 'bug-gnuzilla', 'bug-librejs' ]: + # https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@sbcglobal.net + #m = mail["List-Id"].matches("(.*<)?([^<]*)\.gnu\.org") + #if m: + # move_ham(mail,".software.gnu."+m.group(2)) + # return + + for list in [ 'bug-librejs', + 'bug-make', + 'help-grub', + 'help-make', + 'social', + 'social-discuss', + 'stow-devel', + 'bug-gnuzilla', + 'bug-gsrc' ]: if ( False or mail["List-Id"].matches(list+"\.gnu\.org") or mail["Subject"].contains('['+list+']') ): - move_ham(mail,".software."+list) + import pdb; pdb.set_trace() + move_ham(mail,".software.gnu."+list) return - - # Sort mail from other software mailing lists - if ( - False - or mail["List-Id"].matches("social-discuss\.gnu\.org") - or mail["Subject"].contains("social-discuss") - ): - move_ham(mail,".software.social") - return - - if mail["List-Id"].matches("networkmanager-list\.gnome\.org"): - move_ham(mail,".software.networkmanager") + # Sort mail from non-GNU mailing lists + # https://lists.nongnu.org/mailman/options/libreboot/lukeshu@sbcglobal.net + for list in [ 'libreboot', + 'libreboot-dev', + 'librefm-announce', + 'social-announce', + 'gnu-linux-libre' ]: + if ( + False + or mail["List-Id"].matches(list+"\.nongnu\.org") + or mail["Subject"].contains('['+list+']') + ): + import pdb; pdb.set_trace() + move_ham(mail,".software.nongnu."+list) + return + # Sort mail from Gnome mailing lists + # https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@sbcglobal.net + for list in [ 'networkmanager-list' ]: + if mail["List-Id"].matches(list+"\.gnome\.org"): + move_ham(mail,".software.gnome."+list) + return + # Sort mail from Arch Linux mailing lists + for list in [ 'arch-projects', 'pacman-dev' ]: + if mail["List-Id"].matches(list+"\.archlinux\.org"): + move_ham(mail,".software.archlinux."+list) + return + # Sort mail from other mailing lists + if (mail["List-Id"].matches("systemd-devel.lists.freedesktop.org") or is_to_or_from(mail, "systemd-devel@lists.freedesktop.org")): + move_ham(mail,".software.systemd-devel") return - - if mail["List-Id"].matches("maintenance\.lists\.parabola(gnulinux\.org|\.nu)"): + # Sort mail from Parabola mailing lists + if mail["List-Id"].matches("maintenance\.lists\.parabola\.nu"): move_ham(mail,".software.parabola.maintenance") return - - if is_to_or_from(mail, "labs@parabola.nu"): + if mail["List-Id"].matches("labs\.parabola\.nu"): move_ham(mail,".software.parabola.labs") return - if ( False or mail["List-Id"].matches("parabolagnulinux\.org") @@ -159,21 +189,6 @@ def my_filters(mail): else: move_ham(mail,".software.parabola.dev") return - - if (mail["List-Id"].matches("pacman-dev.archlinux.org")): - move_ham(mail,".software.pacman-dev") - return - - if (mail["List-Id"].matches("systemd-devel.lists.freedesktop.org") or is_to_or_from(mail, "systemd-devel@lists.freedesktop.org")): - move_ham(mail,".software.systemd-devel") - return - - for subject_re in [ - "\[Stow-[^\]]*\].*", - ]: - if mail["Subject"].matches(subject_re): - move_ham(mail,".software") - return # Sort mail from some social websites if mail["From"].matches("facebook(|mail)\.com"): @@ -256,12 +271,27 @@ def my_filters(mail): return # Sort mail from FRC people + # Generic + for address in [ "@ni.com", "@usfirst.org" ]: + if is_to_or_from(mail,address): + move_ham(mail,".FRC") + return + # FRC 829 + for address in [ + "wcxctrack829@aim.com", # Pat + "william.walk@gmail.com", + ]: + if is_to_or_from(mail,address): + move_ham(mail,".FRC.829") + return + if mail["Subject"].matches("\b829\b"): + move_hame(mail,".FRC.829") + return + # FRC 1024 for address in [ - "@ni.com", - "@usfirst.org", "BBonahoom@stanleyworks.com", - "allison.m.babcock@gmail.com", "bryanbonahoom@gmail.com", + "allison.m.babcock@gmail.com", "cdewalt3@yahoo.com", "dave.nelson@ecolab.com", "dickaustin190@yahoo.com", @@ -273,24 +303,23 @@ def my_filters(mail): "silioso@gmail.com", "skiplittell@comcast.net", "tswilson4801@att.net", - "wcxctrack829@aim.com", # Pat - "william.walk@gmail.com", ]: if is_to_or_from(mail,address): - move_ham(mail,".School.Robotics") + move_ham(mail,".FRC.1024") return - for subject_re in [ - "robotics", - "\b1024\b", - "\b4272\b", - "kil-?a-?bytes", - ]: + for subject_re in [ "\b1024\b", "kil-?a-?bytes" ]: if mail["Subject"].matches(subject_re): - move_ham(mail,".School.Robotics") + move_ham(mail,".FRC.1024") return + # FRC 4272 + if mail["Subject"].matches("\b4272\b"): + move_hame(mail,".FRC.4272") + return + # Catch BS things because of CS classes before the general + # software filters if mail["Subject"].contains("[Quizroom]"): - move_ham(mail,".School.CS408") + mail.delete() return # Sort mail from software people @@ -298,6 +327,8 @@ def my_filters(mail): "@archlinux.org", "@canonical.org", "@cnuk.org", + "@core3.amsl.com", + "@defectivebydesign.org", "@eff.org", "@foocorp.net", "@fsf.org", @@ -310,39 +341,20 @@ def my_filters(mail): "@nongnu.org", "@sourceforge.com", "@thyrsus.com", - "trustees@core3.amsl.com", ]: if is_to_or_from(mail,address): move_ham(mail,".software") return - # Sort mail from the school newspaper if ( False or is_to_or_from(mail, "@lnnorthstar.org") or is_to_or_from(mail, "lnnorthstar.org@tigertech.net") ): - move_ham(mail,".School.Newspaper") - return - - # Sort mail from various employers/people who pay me - if is_to_or_from(mail, "@precisepath.com"): - move_ham(mail,".Work.PrecisePath") + move_ham(mail,".HighSchool.Newspaper") return - if is_to_or_from(mail,"susyphil@aol.com"): - move_ham(mail,".Work.PMCH") - - for address in [ - "d.farrar@comcast.net", - "dfarrar@avacoustics.net", - "@vmware.com", - ]: - if is_to_or_from(mail,address): - move_ham(mail,".Work.FAST") - return - # Sort misc newsletters if ( False @@ -370,7 +382,7 @@ def my_filters(mail): or mail["Subject"].contains("NHS") or mail["Subject"].contains("National Honor Society") ): - move_ham(mail,".School") + move_ham(mail,".HighSchool") return # from college stuff -- cgit v1.1-4-g5e80