From 7141fb7935a75d3015c16396477e6b9a8e0c518d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 27 Jan 2013 17:46:22 -0500 Subject: mv .maildirproc .config/maildirproc ; ln -s .config/maidirproc .maildirproc --- .config/maildirproc/default.rc | 352 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 352 insertions(+) create mode 100644 .config/maildirproc/default.rc (limited to '.config/maildirproc') diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc new file mode 100644 index 0000000..c2ad6f2 --- /dev/null +++ b/.config/maildirproc/default.rc @@ -0,0 +1,352 @@ +# -*- mode: python; -*- + +import subprocess + +processor.maildir_base = "~/Maildir" +processor.auto_reload_rcfile = True + +def is_to_or_from(mail,address): + """ + Return true if [mail] is to or from an address that contains [address]. + """ + return ( + mail["From"].contains(address) + or mail.target.contains(address)) +def is_to_or_from_re(mail,address): + """ + Return true if [mail] is to or from an address that matches the + regex [address]. + """ + return ( + mail["From"].matches(address) + or mail.target.matches(address)) + +def bogofilter_auto(mail): + p = subprocess.Popen( + ["bogofilter", "-u", "-v", "-I", mail.path], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + (output, _) = p.communicate() + processor.log("*** Bogofilter result: {0!r}".format(output.rstrip())) + if p.returncode not in [0, 1, 2]: + processor.log_error( + "Error running bogofilter: Return code = {0!r}".format( + p.returncode)) + return p.returncode + +def bogofilter_ham(mail): + subprocess.call(["bogofilter", "-S", "-n", "-I", mail.path]) + +def bogofilter_spam(mail): + subprocess.call(["bogofilter", "-N", "-s", "-I", mail.path]) + +def handle_incoming_spam_training(mail): + bogofilter_spam(mail) + mail.move(".Bulk Mail") + +def handle_incoming_ham_training(mail): + bogofilter_ham(mail) + handle_incoming_ham(mail) + +def handle_incoming_ham(mail): + my_filters(mail) +def handle_incoming_spam(mail): + mail.move(".Bulk Mail") + +def handle_incoming_unknown(mail): + # Filter spam + + spam = bogofilter_auto(mail) + if spam == 0: + handle_incoming_spam(mail) + return + elif spam == 1: + handle_incoming_ham(mail) + return + elif spam == 2: + # maybe spam + return + else: + mail.move(".Error") + return + +def my_filters(mail): + # Sort mail from GNU mailing lists + for list in [ 'bug-gsrc', 'bug-make', 'help-make', 'social', 'help-grub' ]: + if ( + False + or mail["List-Id"].matches(list+"\.gnu\.org") + or mail["Subject"].contains(list) + ): + mail.move(".software."+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") + ): + mail.move(".software.social") + return + + if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): + mail.move(".software.parabola-maintenance") + return + if ( + False + or mail["List-Id"].matches("parabolagnulinux.org") + or is_to_or_from(mail, "parabolagnulinux.org") + or is_to_or_from(mail, "parabola.nu") + ): + mail.move(".software.parabola-dev") + return + + if (mail["List-Id"].matches("pacman-dev.archlinux.org")): + mail.move(".software.pacman-dev") + return + + for subject_re in [ + "\[Stow-[^\]]*\].*", + ]: + if mail["Subject"].matches(subject_re): + mail.move(".software") + return + + # Sort mail from some social websites + if mail["From"].matches("facebook(|mail)\.com"): + mail.move(".Social.Facebook") + return + + if ( + False + or mail["From"].matches("identi\.ca") + or mail["From"].matches("statusnet") + ): + mail.move(".Social.Identica") + return + + if mail["From"].matches("twitter\.com"): + mail.move(".Social.Twitter") + return + + if mail["From"].matches("@xkcd\.com"): + mail.move(".Social.xkcd") + return + + # Sort mail related to Troop 276 + if ( + False + or mail["List-Id"].contains("troopmailinglist.troop276.net") + or is_to_or_from(mail,"t276_announcements@att.net") + or mail["Subject"].matches("troop") + or mail["Subject"].matches("merit\s*badge") + or is_to_or_from(mail,"jsting@sbcglobal.net") + or is_to_or_from(mail,"trdindy@comcast.net") + or is_to_or_from(mail,"wjensen111@aol.com") + or is_to_or_from(mail,"dhoyt@yourhomecompany.com") + or is_to_or_from(mail,"salupo_vincent_p@lilly.com") + or is_to_or_from(mail,"basu@maharjan.org") + or is_to_or_from(mail,"muellerindy@yahoo.com") + or is_to_or_from(mail,"solorzano.luis@rocketmail.com") + or is_to_or_from(mail,"eldredmac@comcast.net")# MacDonell + or is_to_or_from(mail,"mitchprather@sbcglobal.net") + or is_to_or_from(mail,"oa_wap@yahoo.com") + or is_to_or_from(mail,"mytroop.us") + ): + mail.move(".Troop276") + return + + # Sort mail from misc people + if mail["From"].matches("margieshu@sbcglobal\.net"): + mail.move(".misc.Mom") + return + + for address in [ + "justicejade10@aol.com", + "parsonsjade@aol.com", + "parsonstjade@gmail.com", + ]: + if mail["From"].contains(address): + mail.move(".misc.Jade") + return + + for address in [ + "nintendo.com", + "nintendo-news.com", + ]: + if mail["From"].contains(address): + mail.move(".misc.Nintendo") + return + + for address in [ + "@lpi.org", + "@pearson.com", + "CompTIA", + ]: + if mail["From"].contains(address): + mail.move(".misc.CompTIA") + return + + # Sort mail from FRC people + for address in [ + "jeffreysmith@msdlt.k12.in.us", + "jason.zielke@gmail.com", + "allison.m.babcock@gmail.com", + "william.walk@gmail.com", + "BBonahoom@stanleyworks.com", + "wcxctrack829@aim.com", # Pat + "djnels1@comcast.net", # Dave and Julie Nelson + "sarahlittell@comcast.net", + "skiplittell@comcast.net", + "dave.nelson@ecolab.com", + "@ni.com", + "@usfirst.org", + "gamefreak207@gmail.com", # Brett Leedy + "tswilson4801@att.net", + "silioso@gmail.com", + "cdewalt3@yahoo.com", + "bryanbonahoom@gmail.com", + ]: + if is_to_or_from(mail,address): + mail.move(".School.Robotics") + return + for subject_re in [ + "FIRST", + "robotics", + "1024", + "kil-?a-?bytes", + ]: + if mail["Subject"].matches(subject_re): + mail.move(".School.Robotics") + return + + # Sort mail from software people + for address in [ + "gnu.org", + "eff.org", + "gitorious.org", + "sourceforge.com", + "ietf.org", + "kde.org", + "trustees@core3.amsl.com", + "esr@thyrsus.com", + "canonical.org", + "foocorp.net", + "cnuk.org", + "@archlinux.org", + "@github.com", + ]: + if is_to_or_from(mail,address): + mail.move(".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") + ): + mail.move(".School.Newspaper") + return + + # Sort mail from various employers/people who pay me + if is_to_or_from(mail, "@precisepath.com"): + mail.move(".Work.PrecisePath") + return + + if is_to_or_from(mail,"susyphil@aol.com"): + mail.move(".Work.PMCH") + + for address in [ + "d.farrar@comcast.net", + "dfarrar@avacoustics.net", + "@vmware.com", + ]: + if is_to_or_from(mail,address): + mail.move(".Work.FAST") + return + + # Sort misc newsletters + if ( + False + or mail["From"].contains("newsletter") + or mail["From"].contains("auto@comicsbyemail.com") + or mail["From"].contains("oreilly.com") + or mail["Subject"].contains("newsletter") + or mail["From"].contains("Info@mailing.jamendo.com") + or mail["From"].contains("info@demandprogress.org") + ): + mail.move(".misc.Newsletters") + return + + if ( + False + or mail["From"].contains("@msdlt.k12.in.us") + or mail["From"].contains("naviance.com") + or is_to_or_from(mail,"ibwhite@comcast.net") + or mail["Subject"].contains("IOA") + or mail["From"].contains("nths.org") + or mail["Subject"].contains("NTHS") + or mail["Subject"].contains("National Technical Honor Society") + or mail["Subject"].contains("NHS") + or mail["Subject"].contains("National Honor Society") + ): + mail.move(".School") + return + + # from college stuff + if ( + False + or mail["Subject"].contains("NYLF") # National Youth Leadership Conference + or mail["Subject"].contains("NSHSS") + ): + mail.move(".College.Societies") + return + if ( + False + or mail["From"].contains(".edu") + or mail["From"].contains("admissions@") + or mail["From"].contains("college") + or mail["From"].contains("university") + or mail["Subject"].contains("college") + # now we get to the BS + or mail["From"].contains("@dreamitdoitindiana.com") + or mail["From"].contains("@indianatechinfo.org") + ): + mail.move(".College") + return + + if mail["From"].contains("@projectwonderful.com"): + mail.move(".ProjectWonderful") + return + + if ( + False + or mail["From"].matches("@localhost") + or mail["From"].matches("@[^,>]*\.local") + or mail["From"].matches("@[^,>]*\.lukeshu\.ath\.cx") + or mail["To"].matches("luke@") + ): + mail.move(".LocalSystems") + return + if ( + False + or mail["Subject"].contains("password") + or mail["Subject"].contains("account") + ): + mail.move(".misc.accounts") + return + + mail.move(".Ham") + +handle_mapping = { + ".": handle_incoming_unknown, + ".spam-training": handle_incoming_spam_training, + ".ham-training": handle_incoming_ham_training, + #".Ham": handle_incoming_ham, + } +processor.maildirs = handle_mapping.keys() +for mail in processor: + handle_mapping[mail.maildir](mail) -- cgit v1.2.3-2-g168b From e23abe50526995efb67b83f88441dbecdd9d304a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 27 Jan 2013 20:37:02 -0500 Subject: mv .maildirproc .config/maildirproc; ln -s .config/maildirproc/ .maildirproc --- .config/maildirproc/purdue.rc | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .config/maildirproc/purdue.rc (limited to '.config/maildirproc') diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc new file mode 100644 index 0000000..9a759f5 --- /dev/null +++ b/.config/maildirproc/purdue.rc @@ -0,0 +1,84 @@ +# -*- mode: python; -*- + +import subprocess + +processor.maildir_base = "~/Maildir.purdue" +processor.auto_reload_rcfile = True + +def is_to_or_from(mail,address): + """ + Return true if [mail] is to or from an address that contains [address]. + """ + return ( + mail["From"].contains(address) + or mail.target.contains(address)) +def is_to_or_from_re(mail,address): + """ + Return true if [mail] is to or from an address that matches the + regex [address]. + """ + return ( + mail["From"].matches(address) + or mail.target.matches(address)) + +def piazza_topic(mail, topic): + return ( + is_to_or_from(mail, topic+" on Piazza") + or mail["Subject"].contains(topic+" on Piazza")) + +def my_filters(mail): + # Generic stuff ######################################################## + + if mail["Subject"].contains("[PASE]"): + mail.move("INBOX.PASE") + return + + if mail["Subject"].contains("[PLUG]"): + mail.move("INBOX.PLUG") + return + + if is_to_or_from(mail,"linkedin.com"): + mail.move("INBOX.LinkedIn") + return + + if ( + False + or mail["Subject"].contains("[CS Opportunity Update]") + or mail["Subject"].contains("[CS Majors]") + ): + mail.move("INBOX.CS") + return + + # Fall 2012 ############################################################ + + if mail["Subject"].contains("Fall-2012-SCI-21000-001:"): + mail.move("INBOX.classes.2012-2.SCI210") + if mail["Subject"].contains("fall-2012-cs-18000"): + mail.move("INBOX.classes.2012-2.CS180") + return + if piazza_topic(mail, "CS 18000"): + mail.move("INBOX.classes.2012-2.CS180.Piazza") + return + if mail["Subject"].contains("Fall-2012-SOC-10000"): + mail.move("INBOX.classes.2012-2.SOC100") + return + + # Spring 2013 ########################################################## + + if mail["Subject"].contains("[CS240]") or mail["Subject"].contains("Spring-2013-CS-24000"): + mail.move("INBOX.classes.2013-1.CS240") + return + if piazza_topic(mail, "CS 240"): + mail.move("INBOX.classes.2013-1.CS240.Piazza") + return + + if mail["Subject"].contains("Spring-2013-CS-18200"): + mail.move("INBOX.classes.2013-1.CS182") + return + +handle_mapping = { + "INBOX": my_filters, + } +processor.maildirs = handle_mapping.keys() +for mail in processor: + handle_mapping[mail.maildir](mail) -- cgit v1.2.3-2-g168b From 79603171010f907ef037213b7ec6cbf5f33258c1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 10 Jul 2014 18:05:37 -0400 Subject: stuff --- .config/maildirproc/att.rc | 117 ++++++++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 50 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc index 381ce8f..0252c74 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/att.rc @@ -46,7 +46,7 @@ def bogofilter_spam(mail): def handle_incoming_spam_training(mail): bogofilter_spam(mail) - mail.move(".Bulk Mail") + mail.move("FOLDERS.Spam") def handle_incoming_ham_training(mail): bogofilter_ham(mail) @@ -55,10 +55,26 @@ def handle_incoming_ham_training(mail): def handle_incoming_ham(mail): my_filters(mail) def handle_incoming_spam(mail): - mail.move(".Bulk Mail") + mail.move("FOLDERS.Spam") def handle_incoming_unknown(mail): # Filter spam + + if ( + False + or mail["Subject"].contains("[systemd-devel]") + or mail["Subject"].contains("[PATCH") + or mail["Subject"].contains("[Dev]") + or mail["Subject"].contains("[Maintenance]") + or is_to_or_from(mail, "gnu.org") + or is_to_or_from(mail, "fsf.org") + or mail["From"].contains("@parabola.nu") + or mail["From"].contains("parabolagnulinux.org") + or mail["From"].contains("@facebookmail.com>") + or mail["List-Id"].matches(".*\.(gnu|archlinux|parabolagnulinuxlibre)\.org") + ): + handle_incoming_ham_training(mail) + return spam = bogofilter_auto(mail) if spam == 0: @@ -68,10 +84,10 @@ def handle_incoming_unknown(mail): handle_incoming_ham(mail) return elif spam == 2: - # maybe spam + mail.move("Inbox") return else: - mail.move(".Error") + mail.move("FOLDERS.Error") return def my_filters(mail): @@ -82,7 +98,7 @@ def my_filters(mail): or mail["List-Id"].matches(list+"\.gnu\.org") or mail["Subject"].contains('['+list+']') ): - mail.move(".software."+list) + mail.move("FOLDERS.software."+list) return # Sort mail from other software mailing lists @@ -91,36 +107,36 @@ def my_filters(mail): or mail["List-Id"].matches("social-discuss\.gnu\.org") or mail["Subject"].contains("social-discuss") ): - mail.move(".software.social") + mail.move("FOLDERS.software.social") return if mail["List-Id"].matches("networkmanager-list\.gnome\.org"): - mail.move(".software.networkmanager") + mail.move("FOLDERS.software.networkmanager") return if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): if mail["From"].contains("monit@"): if mail["Message-Id"].contains("@repo.parabolagnulinux.org"): if mail["Subject"].matches("^\[Maintenance\] monit alert -- (Execution|Connection) (succeeded|failed) sshd$"): - mail.move(".software.parabola-maintenance.monit-repo.sshd") + mail.move("FOLDERS.software.parabola-maintenance.monit-repo.sshd") return - mail.move(".software.parabola-maintenance.monit-repo") + mail.move("FOLDERS.software.parabola-maintenance.monit-repo") return if mail["Message-Id"].contains("@rshg054.dnsready.net"): - mail.move(".software.parabola-maintenance.monit-rshg054") + mail.move("FOLDERS.software.parabola-maintenance.monit-rshg054") return if mail["Subject"].matches("Cron <.*@repo>"): - mail.move(".software.parabola-maintenance.cron-repo") + mail.move("FOLDERS.software.parabola-maintenance.cron-repo") return if mail["Subject"].matches("Cron <.*@rshg054>"): - mail.move(".software.parabola-maintenance.cron-rshg054") + mail.move("FOLDERS.software.parabola-maintenance.cron-rshg054") return - mail.move(".software.parabola-maintenance") + mail.move("FOLDERS.software.parabola-maintenance") return - if is_to_or_from(mail, "parabola.nu"): - mail.move(".software.parabola-labs") - return + #if is_to_or_from(mail, "parabola.nu"): + # mail.move("FOLDERS.software.parabola-labs") + # return if ( False @@ -129,29 +145,29 @@ def my_filters(mail): or is_to_or_from(mail, "kiwwwi.com.ar") ): if mail["Subject"].contains("[Django]"): - mail.move(".software.parabola-maintenance.django") + mail.move("FOLDERS.software.parabola-maintenance.django") return - mail.move(".software.parabola-dev") + mail.move("FOLDERS.software.parabola-dev") return if (mail["List-Id"].matches("pacman-dev.archlinux.org")): - mail.move(".software.pacman-dev") + mail.move("FOLDERS.software.pacman-dev") return - if (mail["List-Id"].matches("systemd-devel.lists.freedesktop.org")): - mail.move(".software.systemd-devel") + if (mail["List-Id"].matches("systemd-devel.lists.freedesktop.org") or is_to_or_from(mail, "systemd-devel@lists.freedesktop.org")): + mail.move("FOLDERS.software.systemd-devel") return for subject_re in [ "\[Stow-[^\]]*\].*", ]: if mail["Subject"].matches(subject_re): - mail.move(".software") + mail.move("FOLDERS.software") return # Sort mail from some social websites if mail["From"].matches("facebook(|mail)\.com"): - mail.move(".Social.Facebook") + mail.move("FOLDERS.Social.Facebook") return if ( @@ -159,15 +175,15 @@ def my_filters(mail): or mail["From"].matches("identi\.ca") or mail["From"].matches("statusnet") ): - mail.move(".Social.Identica") + mail.move("FOLDERS.Social.Identica") return if mail["From"].matches("twitter\.com"): - mail.move(".Social.Twitter") + mail.move("FOLDERS.Social.Twitter") return if mail["From"].matches("@xkcd\.com"): - mail.move(".Social.xkcd") + mail.move("FOLDERS.Social.xkcd") return # Sort mail related to Troop 276 @@ -191,12 +207,12 @@ def my_filters(mail): or is_to_or_from(mail,"mytroop.us") or is_to_or_from(mail,"crossroadsbsa.org") ): - mail.move(".Troop276") + mail.move("FOLDERS.BoyScouts") return # Sort mail from misc people if mail["From"].matches("margieshu@sbcglobal\.net"): - mail.move(".misc.Mom") + mail.move("FOLDERS.misc.Mom") return for address in [ @@ -206,7 +222,7 @@ def my_filters(mail): "jadparso@umail.iu.edu", ]: if is_to_or_from(mail,address): - mail.move(".misc.Jade") + mail.move("FOLDERS.misc.Jade") return for address in [ @@ -214,7 +230,7 @@ def my_filters(mail): "nintendo-news.com", ]: if mail["From"].contains(address): - mail.move(".misc.Nintendo") + mail.move("FOLDERS.misc.Nintendo") return for address in [ @@ -223,7 +239,7 @@ def my_filters(mail): "CompTIA", ]: if mail["From"].contains(address): - mail.move(".misc.CompTIA") + mail.move("FOLDERS.misc.CompTIA") return # Sort mail from FRC people @@ -248,7 +264,7 @@ def my_filters(mail): "william.walk@gmail.com", ]: if is_to_or_from(mail,address): - mail.move(".School.Robotics") + mail.move("FOLDERS.School.Robotics") return for subject_re in [ "robotics", @@ -256,7 +272,7 @@ def my_filters(mail): "kil-?a-?bytes", ]: if mail["Subject"].matches(subject_re): - mail.move(".School.Robotics") + mail.move("FOLDERS.School.Robotics") return # Sort mail from software people @@ -278,7 +294,7 @@ def my_filters(mail): "trustees@core3.amsl.com", ]: if is_to_or_from(mail,address): - mail.move(".software") + mail.move("FOLDERS.software") return @@ -288,16 +304,16 @@ def my_filters(mail): or is_to_or_from(mail, "@lnnorthstar.org") or is_to_or_from(mail, "lnnorthstar.org@tigertech.net") ): - mail.move(".School.Newspaper") + mail.move("FOLDERS.School.Newspaper") return # Sort mail from various employers/people who pay me if is_to_or_from(mail, "@precisepath.com"): - mail.move(".Work.PrecisePath") + mail.move("FOLDERS.Work.PrecisePath") return if is_to_or_from(mail,"susyphil@aol.com"): - mail.move(".Work.PMCH") + mail.move("FOLDERS.Work.PMCH") for address in [ "d.farrar@comcast.net", @@ -305,7 +321,7 @@ def my_filters(mail): "@vmware.com", ]: if is_to_or_from(mail,address): - mail.move(".Work.FAST") + mail.move("FOLDERS.Work.FAST") return # Sort misc newsletters @@ -319,12 +335,13 @@ def my_filters(mail): or mail["From"].contains("info@demandprogress.org") or (mail["From"].contains("@sparkfun.com") and mail["Message-Id"].contains("rsgsv.net")) ): - mail.move(".misc.Newsletters") + mail.move("FOLDERS.misc.Newsletters") return if ( False or mail["From"].contains("@msdlt.k12.in.us") + or mail["From"].contains("ltschoolfoundation@gmail.com") or mail["From"].contains("naviance.com") or is_to_or_from(mail,"ibwhite@comcast.net") or mail["Subject"].contains("IOA") @@ -334,7 +351,7 @@ def my_filters(mail): or mail["Subject"].contains("NHS") or mail["Subject"].contains("National Honor Society") ): - mail.move(".School") + mail.move("FOLDERS.School") return # from college stuff @@ -343,7 +360,7 @@ def my_filters(mail): or mail["Subject"].contains("NYLF") # National Youth Leadership Conference or mail["Subject"].contains("NSHSS") ): - mail.move(".College.Societies") + mail.move("FOLDERS.College.Societies") return if ( False @@ -356,11 +373,11 @@ def my_filters(mail): or mail["From"].contains("@dreamitdoitindiana.com") or mail["From"].contains("@indianatechinfo.org") ): - mail.move(".College") + mail.move("FOLDERS.College") return if mail["From"].contains("@projectwonderful.com"): - mail.move(".ProjectWonderful") + mail.move("FOLDERS.misc.ProjectWonderful") return if ( @@ -370,23 +387,23 @@ def my_filters(mail): or mail["From"].matches("@[^,>]*\.lukeshu\.ath\.cx") or mail["To"].matches("luke@") ): - mail.move(".LocalSystems") + mail.move("FOLDERS.LocalSystems") return if ( False or mail["Subject"].contains("password") or mail["Subject"].contains("account") ): - mail.move(".misc.accounts") + mail.move("FOLDERS.misc.accounts") return - mail.move(".Ham") + mail.move("FOLDERS.Ham") handle_mapping = { - ".": handle_incoming_unknown, - ".spam-training": handle_incoming_spam_training, - ".ham-training": handle_incoming_ham_training, - #".Ham": handle_incoming_ham, + "Inbox": handle_incoming_unknown, + "Bulk Mail": handle_incoming_unknown, + "FOLDERS.Spam.training": handle_incoming_spam_training, + "FOLDERS.Ham.training": handle_incoming_ham_training, } processor.maildirs = handle_mapping.keys() for mail in processor: -- cgit v1.2.3-2-g168b From 5984f9884153b4f035bf3be3cd69ef2970244209 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 10 Oct 2014 17:11:18 -0400 Subject: update mail filters --- .config/maildirproc/att.rc | 102 +++++++++++++++++++----------------------- .config/maildirproc/purdue.rc | 36 ++++++++++++++- 2 files changed, 80 insertions(+), 58 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc index 0252c74..e7f581b 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/att.rc @@ -37,20 +37,17 @@ def bogofilter_auto(mail): "Error running bogofilter: Return code = {0!r}".format( p.returncode)) return p.returncode - def bogofilter_ham(mail): subprocess.call(["bogofilter", "-S", "-n", "-I", mail.path]) - def bogofilter_spam(mail): subprocess.call(["bogofilter", "-N", "-s", "-I", mail.path]) -def handle_incoming_spam_training(mail): - bogofilter_spam(mail) - mail.move("FOLDERS.Spam") - def handle_incoming_ham_training(mail): bogofilter_ham(mail) handle_incoming_ham(mail) +def handle_incoming_spam_training(mail): + bogofilter_spam(mail) + mail.move("FOLDERS.Spam") def handle_incoming_ham(mail): my_filters(mail) @@ -71,7 +68,7 @@ def handle_incoming_unknown(mail): or mail["From"].contains("@parabola.nu") or mail["From"].contains("parabolagnulinux.org") or mail["From"].contains("@facebookmail.com>") - or mail["List-Id"].matches(".*\.(gnu|archlinux|parabolagnulinuxlibre)\.org") + or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre)\.org") ): handle_incoming_ham_training(mail) return @@ -84,10 +81,10 @@ def handle_incoming_unknown(mail): handle_incoming_ham(mail) return elif spam == 2: - mail.move("Inbox") + mail.move("FOLDERS.MysteryMeat") return else: - mail.move("FOLDERS.Error") + mail.move("FOLDERS.BogoFail") return def my_filters(mail): @@ -98,7 +95,7 @@ def my_filters(mail): or mail["List-Id"].matches(list+"\.gnu\.org") or mail["Subject"].contains('['+list+']') ): - mail.move("FOLDERS.software."+list) + mail.move("FOLDERS.Ham.software."+list) return # Sort mail from other software mailing lists @@ -107,67 +104,58 @@ def my_filters(mail): or mail["List-Id"].matches("social-discuss\.gnu\.org") or mail["Subject"].contains("social-discuss") ): - mail.move("FOLDERS.software.social") + mail.move("FOLDERS.Ham.software.social") return if mail["List-Id"].matches("networkmanager-list\.gnome\.org"): - mail.move("FOLDERS.software.networkmanager") + mail.move("FOLDERS.Ham.software.networkmanager") return if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): - if mail["From"].contains("monit@"): - if mail["Message-Id"].contains("@repo.parabolagnulinux.org"): - if mail["Subject"].matches("^\[Maintenance\] monit alert -- (Execution|Connection) (succeeded|failed) sshd$"): - mail.move("FOLDERS.software.parabola-maintenance.monit-repo.sshd") - return - mail.move("FOLDERS.software.parabola-maintenance.monit-repo") - return - if mail["Message-Id"].contains("@rshg054.dnsready.net"): - mail.move("FOLDERS.software.parabola-maintenance.monit-rshg054") - return if mail["Subject"].matches("Cron <.*@repo>"): - mail.move("FOLDERS.software.parabola-maintenance.cron-repo") + mail.move("FOLDERS.Ham.software.parabola-maintenance.cron-repo") return - if mail["Subject"].matches("Cron <.*@rshg054>"): - mail.move("FOLDERS.software.parabola-maintenance.cron-rshg054") + if mail["Subject"].matches("Cron <.*@parabolagnulinux>"): + mail.move("FOLDERS.Ham.software.parabola-maintenance.cron-web") return - mail.move("FOLDERS.software.parabola-maintenance") + mail.move("FOLDERS.Ham.software.parabola-maintenance") return - #if is_to_or_from(mail, "parabola.nu"): - # mail.move("FOLDERS.software.parabola-labs") - # return + if is_to_or_from(mail, "labs@parabola.nu"): + mail.move("FOLDERS.Ham.software.parabola-labs") + return if ( False or mail["List-Id"].matches("parabolagnulinux.org") or is_to_or_from(mail, "parabolagnulinux.org") or is_to_or_from(mail, "kiwwwi.com.ar") + or is_to_or_from(mail, "parabola.nu") ): if mail["Subject"].contains("[Django]"): - mail.move("FOLDERS.software.parabola-maintenance.django") + mail.move("FOLDERS.Ham.software.parabola-maintenance.django") return - mail.move("FOLDERS.software.parabola-dev") + mail.move("FOLDERS.Ham.software.parabola-dev") return if (mail["List-Id"].matches("pacman-dev.archlinux.org")): - mail.move("FOLDERS.software.pacman-dev") + mail.move("FOLDERS.Ham.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")): - mail.move("FOLDERS.software.systemd-devel") + mail.move("FOLDERS.Ham.software.systemd-devel") return for subject_re in [ "\[Stow-[^\]]*\].*", ]: if mail["Subject"].matches(subject_re): - mail.move("FOLDERS.software") + mail.move("FOLDERS.Ham.software") return # Sort mail from some social websites if mail["From"].matches("facebook(|mail)\.com"): - mail.move("FOLDERS.Social.Facebook") + mail.move("FOLDERS.Ham.Social.Facebook") return if ( @@ -175,15 +163,15 @@ def my_filters(mail): or mail["From"].matches("identi\.ca") or mail["From"].matches("statusnet") ): - mail.move("FOLDERS.Social.Identica") + mail.move("FOLDERS.Ham.Social.Identica") return if mail["From"].matches("twitter\.com"): - mail.move("FOLDERS.Social.Twitter") + mail.move("FOLDERS.Ham.Social.Twitter") return if mail["From"].matches("@xkcd\.com"): - mail.move("FOLDERS.Social.xkcd") + mail.move("FOLDERS.Ham.Social.xkcd") return # Sort mail related to Troop 276 @@ -207,12 +195,12 @@ def my_filters(mail): or is_to_or_from(mail,"mytroop.us") or is_to_or_from(mail,"crossroadsbsa.org") ): - mail.move("FOLDERS.BoyScouts") + mail.move("FOLDERS.Ham.BoyScouts") return # Sort mail from misc people if mail["From"].matches("margieshu@sbcglobal\.net"): - mail.move("FOLDERS.misc.Mom") + mail.move("FOLDERS.Ham.misc.Mom") return for address in [ @@ -222,7 +210,7 @@ def my_filters(mail): "jadparso@umail.iu.edu", ]: if is_to_or_from(mail,address): - mail.move("FOLDERS.misc.Jade") + mail.move("FOLDERS.Ham.misc.Jade") return for address in [ @@ -230,7 +218,7 @@ def my_filters(mail): "nintendo-news.com", ]: if mail["From"].contains(address): - mail.move("FOLDERS.misc.Nintendo") + mail.move("FOLDERS.Ham.misc.Nintendo") return for address in [ @@ -239,7 +227,7 @@ def my_filters(mail): "CompTIA", ]: if mail["From"].contains(address): - mail.move("FOLDERS.misc.CompTIA") + mail.move("FOLDERS.Ham.misc.CompTIA") return # Sort mail from FRC people @@ -264,7 +252,7 @@ def my_filters(mail): "william.walk@gmail.com", ]: if is_to_or_from(mail,address): - mail.move("FOLDERS.School.Robotics") + mail.move("FOLDERS.Ham.School.Robotics") return for subject_re in [ "robotics", @@ -272,7 +260,7 @@ def my_filters(mail): "kil-?a-?bytes", ]: if mail["Subject"].matches(subject_re): - mail.move("FOLDERS.School.Robotics") + mail.move("FOLDERS.Ham.School.Robotics") return # Sort mail from software people @@ -294,7 +282,7 @@ def my_filters(mail): "trustees@core3.amsl.com", ]: if is_to_or_from(mail,address): - mail.move("FOLDERS.software") + mail.move("FOLDERS.Ham.software") return @@ -304,16 +292,16 @@ def my_filters(mail): or is_to_or_from(mail, "@lnnorthstar.org") or is_to_or_from(mail, "lnnorthstar.org@tigertech.net") ): - mail.move("FOLDERS.School.Newspaper") + mail.move("FOLDERS.Ham.School.Newspaper") return # Sort mail from various employers/people who pay me if is_to_or_from(mail, "@precisepath.com"): - mail.move("FOLDERS.Work.PrecisePath") + mail.move("FOLDERS.Ham.Work.PrecisePath") return if is_to_or_from(mail,"susyphil@aol.com"): - mail.move("FOLDERS.Work.PMCH") + mail.move("FOLDERS.Ham.Work.PMCH") for address in [ "d.farrar@comcast.net", @@ -321,7 +309,7 @@ def my_filters(mail): "@vmware.com", ]: if is_to_or_from(mail,address): - mail.move("FOLDERS.Work.FAST") + mail.move("FOLDERS.Ham.Work.FAST") return # Sort misc newsletters @@ -335,7 +323,7 @@ def my_filters(mail): or mail["From"].contains("info@demandprogress.org") or (mail["From"].contains("@sparkfun.com") and mail["Message-Id"].contains("rsgsv.net")) ): - mail.move("FOLDERS.misc.Newsletters") + mail.move("FOLDERS.Ham.misc.Newsletters") return if ( @@ -351,7 +339,7 @@ def my_filters(mail): or mail["Subject"].contains("NHS") or mail["Subject"].contains("National Honor Society") ): - mail.move("FOLDERS.School") + mail.move("FOLDERS.Ham.School") return # from college stuff @@ -360,7 +348,7 @@ def my_filters(mail): or mail["Subject"].contains("NYLF") # National Youth Leadership Conference or mail["Subject"].contains("NSHSS") ): - mail.move("FOLDERS.College.Societies") + mail.move("FOLDERS.Ham.College.Societies") return if ( False @@ -373,11 +361,11 @@ def my_filters(mail): or mail["From"].contains("@dreamitdoitindiana.com") or mail["From"].contains("@indianatechinfo.org") ): - mail.move("FOLDERS.College") + mail.move("FOLDERS.Ham.College") return if mail["From"].contains("@projectwonderful.com"): - mail.move("FOLDERS.misc.ProjectWonderful") + mail.move("FOLDERS.Ham.misc.ProjectWonderful") return if ( @@ -387,14 +375,14 @@ def my_filters(mail): or mail["From"].matches("@[^,>]*\.lukeshu\.ath\.cx") or mail["To"].matches("luke@") ): - mail.move("FOLDERS.LocalSystems") + mail.move("FOLDERS.Ham.LocalSystems") return if ( False or mail["Subject"].contains("password") or mail["Subject"].contains("account") ): - mail.move("FOLDERS.misc.accounts") + mail.move("FOLDERS.Ham.misc.accounts") return mail.move("FOLDERS.Ham") diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index 6d4b913..7b75d7c 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -70,10 +70,18 @@ def my_filters(mail): or is_to_or_from(mail,"@propertysolutions.com") or is_to_or_from(mail,"collegestationapartments@gmail.com") or is_to_or_from_re(mail,"collegestationca\..*@gmail.com") - or is_to_or_from(mail, "@duke-energy.com") ): mail.move("INBOX.housing.CollegeStation") return + if ( + False + or is_to_or_from(mail,"@hunterlp.com") + or is_to_or_from(mail, "@duke-energy.com") + or is_to_or_from(mail, "@alerts.comcast.net") + or is_to_or_from(mail, "rentpayment.com") + ): + mail.move("INBOX.housing.BeauJardin") + return if mail["From"].matches("facebook(|mail)\.com"): mail.move("INBOX.crap.Facebook") @@ -183,6 +191,32 @@ def my_filters(mail): mail.move("INBOX.classes.2014-1.STAT350.Piazza") return + # Fall 2014 ############################################################ + + # CS334 (Graphics) + if (is_to_or_from(mail, "lin553@purdue.edu") or mail["Subject"].contains("Fall-2014-CS-33400")): + mail.move("INBOX.classes.2014-2.CS334") + return + # CS354 (OS) + # CS381 (Algo) + if piazza_topic(mail, "CS 354"): + mail.move("INBOX.classes.2014-2.CS354.Piazza") + return + if piazza_topic(mail, "CS 381"): + mail.move("INBOX.classes.2014-2.CS381.Piazza") + return + # CS456 (Programming languages) + if piazza_topic(mail, "CS 456"): + mail.move("INBOX.classes.2014-2.CS456.Piazza") + return + # MA416 + if mail["Subject"].contains("Fall-2014-MA-41600"): + mail.move("INBOX.classes.2014-2.MA416") + return + # PHYS221 + if (is_to_or_from(mail, "cui@purdue.edu") or is_to_or_from(mail, "china@purdue.edu")): + mail.move("INBOX.classes.2014-2.PHYS221") + return handle_mapping = { "INBOX": my_filters, } -- cgit v1.2.3-2-g168b From a12f3189bcf6d2cf277acfa7824961b158bd57e6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 29 Nov 2014 22:38:56 -0500 Subject: stuff --- .config/maildirproc/att.rc | 136 +++++++++++++++++++++++------------------- .config/maildirproc/purdue.rc | 7 ++- 2 files changed, 80 insertions(+), 63 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc index e7f581b..b8ff8f1 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/att.rc @@ -2,6 +2,7 @@ import os import subprocess +import datetime processor.maildir_base = "~/Maildir" processor.auto_reload_rcfile = True @@ -24,6 +25,9 @@ def is_to_or_from_re(mail,address): return ( mail["From"].matches(address) or mail.target.matches(address)) +def move_ham(mail,folder): + y = datetime.datetime.now().year + mail.move("FOLDERS.Ham."+str(y)+folder) def bogofilter_auto(mail): p = subprocess.Popen( @@ -57,18 +61,30 @@ def handle_incoming_spam(mail): def handle_incoming_unknown(mail): # Filter spam + # Whitelist if ( False - or mail["Subject"].contains("[systemd-devel]") - or mail["Subject"].contains("[PATCH") - or mail["Subject"].contains("[Dev]") - or mail["Subject"].contains("[Maintenance]") - or is_to_or_from(mail, "gnu.org") or is_to_or_from(mail, "fsf.org") + or is_to_or_from(mail, "gnu.org") + or is_to_or_from(mail, "parabola.nu") + or is_to_or_from(mail, "parabolagnulinux.org") + or mail["From"] == "MAILER-DAEMON@yahoo.com" + or mail["From"].contains("@facebookmail.com>") + or mail["From"].contains("@gandi.net") + or mail["From"].contains("@goodwillindy.org>") + or mail["From"].contains("@lpi.org>") + or mail["From"].contains("@msdlt.k12.in.us>") or mail["From"].contains("@parabola.nu") + or mail["From"].contains("@post.oreilly.com>") + or mail["From"].contains("@scouting.org>") + or mail["From"].contains("@wolframalpha.com>") or mail["From"].contains("parabolagnulinux.org") - or mail["From"].contains("@facebookmail.com>") or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre)\.org") + or mail["List-Id"].matches(".*\.parabola\.nu") + or mail["Subject"].contains("[Dev]") + or mail["Subject"].contains("[Maintenance]") + or mail["Subject"].contains("[PATCH") + or mail["Subject"].contains("[systemd-devel]") ): handle_incoming_ham_training(mail) return @@ -95,7 +111,7 @@ def my_filters(mail): or mail["List-Id"].matches(list+"\.gnu\.org") or mail["Subject"].contains('['+list+']') ): - mail.move("FOLDERS.Ham.software."+list) + move_ham(mail,".software."+list) return # Sort mail from other software mailing lists @@ -104,25 +120,19 @@ def my_filters(mail): or mail["List-Id"].matches("social-discuss\.gnu\.org") or mail["Subject"].contains("social-discuss") ): - mail.move("FOLDERS.Ham.software.social") + move_ham(mail,".software.social") return if mail["List-Id"].matches("networkmanager-list\.gnome\.org"): - mail.move("FOLDERS.Ham.software.networkmanager") + move_ham(mail,".software.networkmanager") return if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): - if mail["Subject"].matches("Cron <.*@repo>"): - mail.move("FOLDERS.Ham.software.parabola-maintenance.cron-repo") - return - if mail["Subject"].matches("Cron <.*@parabolagnulinux>"): - mail.move("FOLDERS.Ham.software.parabola-maintenance.cron-web") - return - mail.move("FOLDERS.Ham.software.parabola-maintenance") + move_ham(mail,".software.parabola.maintenance") return if is_to_or_from(mail, "labs@parabola.nu"): - mail.move("FOLDERS.Ham.software.parabola-labs") + move_ham(mail,".software.parabola.labs") return if ( @@ -133,29 +143,30 @@ def my_filters(mail): or is_to_or_from(mail, "parabola.nu") ): if mail["Subject"].contains("[Django]"): - mail.move("FOLDERS.Ham.software.parabola-maintenance.django") + move_ham(mail,".software.parabola.maintenance.django") + return + else: + move_ham(mail,".software.parabola.dev") return - mail.move("FOLDERS.Ham.software.parabola-dev") - return if (mail["List-Id"].matches("pacman-dev.archlinux.org")): - mail.move("FOLDERS.Ham.software.pacman-dev") + 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")): - mail.move("FOLDERS.Ham.software.systemd-devel") + move_ham(mail,".software.systemd-devel") return for subject_re in [ "\[Stow-[^\]]*\].*", ]: if mail["Subject"].matches(subject_re): - mail.move("FOLDERS.Ham.software") + move_ham(mail,".software") return # Sort mail from some social websites if mail["From"].matches("facebook(|mail)\.com"): - mail.move("FOLDERS.Ham.Social.Facebook") + move_ham(mail,".Social.Facebook") return if ( @@ -163,15 +174,24 @@ def my_filters(mail): or mail["From"].matches("identi\.ca") or mail["From"].matches("statusnet") ): - mail.move("FOLDERS.Ham.Social.Identica") + move_ham(mail,".Social.Identica") return + if ( + False + or mail["From"].contains("@gandi.net") + or mail["From"].contains("@ramhost.us") + or mail["From"].contains("@startcom.org") + ): + move_ham(mail,".lukeshu-com") + return + if mail["From"].matches("twitter\.com"): - mail.move("FOLDERS.Ham.Social.Twitter") + move_ham(mail,".Social.Twitter") return if mail["From"].matches("@xkcd\.com"): - mail.move("FOLDERS.Ham.Social.xkcd") + move_ham(mail,".Social.xkcd") return # Sort mail related to Troop 276 @@ -195,30 +215,24 @@ def my_filters(mail): or is_to_or_from(mail,"mytroop.us") or is_to_or_from(mail,"crossroadsbsa.org") ): - mail.move("FOLDERS.Ham.BoyScouts") + move_ham(mail,".BoyScouts") return # Sort mail from misc people - if mail["From"].matches("margieshu@sbcglobal\.net"): - mail.move("FOLDERS.Ham.misc.Mom") + if ( + False + or is_to_or_from(mail,"margieshu@sbcglobal.net") + or is_to_or_from(mail,"3174451635@mms.att.net") + ): + move_ham(mail,".misc.Mom") return - for address in [ - "justicejade10@aol.com", - "parsonsjade@aol.com", - "parsonstjade@gmail.com", - "jadparso@umail.iu.edu", - ]: - if is_to_or_from(mail,address): - mail.move("FOLDERS.Ham.misc.Jade") - return - for address in [ "nintendo.com", "nintendo-news.com", ]: if mail["From"].contains(address): - mail.move("FOLDERS.Ham.misc.Nintendo") + move_ham(mail,".misc.Nintendo") return for address in [ @@ -227,7 +241,7 @@ def my_filters(mail): "CompTIA", ]: if mail["From"].contains(address): - mail.move("FOLDERS.Ham.misc.CompTIA") + move_ham(mail,".misc.CompTIA") return # Sort mail from FRC people @@ -252,15 +266,16 @@ def my_filters(mail): "william.walk@gmail.com", ]: if is_to_or_from(mail,address): - mail.move("FOLDERS.Ham.School.Robotics") + move_ham(mail,".School.Robotics") return for subject_re in [ "robotics", - "1024", + "\b1024\b", + "\b4272\b", "kil-?a-?bytes", ]: if mail["Subject"].matches(subject_re): - mail.move("FOLDERS.Ham.School.Robotics") + move_ham(mail,".School.Robotics") return # Sort mail from software people @@ -282,7 +297,7 @@ def my_filters(mail): "trustees@core3.amsl.com", ]: if is_to_or_from(mail,address): - mail.move("FOLDERS.Ham.software") + move_ham(mail,".software") return @@ -292,16 +307,16 @@ def my_filters(mail): or is_to_or_from(mail, "@lnnorthstar.org") or is_to_or_from(mail, "lnnorthstar.org@tigertech.net") ): - mail.move("FOLDERS.Ham.School.Newspaper") + move_ham(mail,".School.Newspaper") return # Sort mail from various employers/people who pay me if is_to_or_from(mail, "@precisepath.com"): - mail.move("FOLDERS.Ham.Work.PrecisePath") + move_ham(mail,".Work.PrecisePath") return if is_to_or_from(mail,"susyphil@aol.com"): - mail.move("FOLDERS.Ham.Work.PMCH") + move_ham(mail,".Work.PMCH") for address in [ "d.farrar@comcast.net", @@ -309,7 +324,7 @@ def my_filters(mail): "@vmware.com", ]: if is_to_or_from(mail,address): - mail.move("FOLDERS.Ham.Work.FAST") + move_ham(mail,".Work.FAST") return # Sort misc newsletters @@ -323,7 +338,7 @@ def my_filters(mail): or mail["From"].contains("info@demandprogress.org") or (mail["From"].contains("@sparkfun.com") and mail["Message-Id"].contains("rsgsv.net")) ): - mail.move("FOLDERS.Ham.misc.Newsletters") + move_ham(mail,".misc.Newsletters") return if ( @@ -339,7 +354,7 @@ def my_filters(mail): or mail["Subject"].contains("NHS") or mail["Subject"].contains("National Honor Society") ): - mail.move("FOLDERS.Ham.School") + move_ham(mail,".School") return # from college stuff @@ -348,44 +363,41 @@ def my_filters(mail): or mail["Subject"].contains("NYLF") # National Youth Leadership Conference or mail["Subject"].contains("NSHSS") ): - mail.move("FOLDERS.Ham.College.Societies") + move_ham(mail,".College.Societies") return if ( False - #or mail["From"].contains(".edu") or mail["From"].contains("admissions@") - #or mail["From"].contains("college") - #or mail["From"].contains("university") or mail["Subject"].contains("college") # now we get to the BS or mail["From"].contains("@dreamitdoitindiana.com") or mail["From"].contains("@indianatechinfo.org") ): - mail.move("FOLDERS.Ham.College") + move_ham(mail,".College") return if mail["From"].contains("@projectwonderful.com"): - mail.move("FOLDERS.Ham.misc.ProjectWonderful") + move_ham(mail,".misc.ProjectWonderful") return if ( False or mail["From"].matches("@localhost") or mail["From"].matches("@[^,>]*\.local") - or mail["From"].matches("@[^,>]*\.lukeshu\.ath\.cx") + or mail["From"].matches("@[^,>]*\.lan") or mail["To"].matches("luke@") ): - mail.move("FOLDERS.Ham.LocalSystems") + move_ham(mail,".LocalSystems") return if ( False or mail["Subject"].contains("password") or mail["Subject"].contains("account") ): - mail.move("FOLDERS.Ham.misc.accounts") + move_ham(mail,".misc.accounts") return - mail.move("FOLDERS.Ham") + move_ham(mail,"") handle_mapping = { "Inbox": handle_incoming_unknown, diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index 7b75d7c..61c264c 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -79,6 +79,7 @@ def my_filters(mail): or is_to_or_from(mail, "@duke-energy.com") or is_to_or_from(mail, "@alerts.comcast.net") or is_to_or_from(mail, "rentpayment.com") + or is_to_or_from(mail, "@vectren.com") ): mail.move("INBOX.housing.BeauJardin") return @@ -214,7 +215,11 @@ def my_filters(mail): mail.move("INBOX.classes.2014-2.MA416") return # PHYS221 - if (is_to_or_from(mail, "cui@purdue.edu") or is_to_or_from(mail, "china@purdue.edu")): + if (False + or is_to_or_from(mail, "cui@purdue.edu") + or is_to_or_from(mail, "shina@purdue.edu") + or is_to_or_from(mail, "ajith@purdue.edu") + ): mail.move("INBOX.classes.2014-2.PHYS221") return handle_mapping = { -- cgit v1.2.3-2-g168b From e9319a2e348b33eeb0f5bfcdd26ef885590cf8cb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 29 Jan 2015 01:36:26 -0500 Subject: update mail filters --- .config/maildirproc/att.rc | 37 +++++++++++++++++----------- .config/maildirproc/purdue.rc | 56 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 75 insertions(+), 18 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc index b8ff8f1..6b31260 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/att.rc @@ -1,6 +1,7 @@ # -*- mode: python; indent-tabs-mode: t -*- import os +import os.path import subprocess import datetime @@ -27,7 +28,14 @@ def is_to_or_from_re(mail,address): or mail.target.matches(address)) def move_ham(mail,folder): y = datetime.datetime.now().year - mail.move("FOLDERS.Ham."+str(y)+folder) + folder = "FOLDERS.Ham."+str(y)+folder + dir = processor.maildir_base+"/"+folder + if not os.path.isfile(dir+"/maildirfolder"): + os.makedirs(dir+"/tmp", 0o777, True) + os.makedirs(dir+"/new", 0o777, True) + os.makedirs(dir+"/cur", 0o777, True) + open(dir+"/maildirfolder", 'a').close() + mail.move(folder) def bogofilter_auto(mail): p = subprocess.Popen( @@ -127,7 +135,7 @@ def my_filters(mail): move_ham(mail,".software.networkmanager") return - if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): + if mail["List-Id"].matches("maintenance\.lists\.parabola(gnulinux\.org|\.nu)"): move_ham(mail,".software.parabola.maintenance") return @@ -137,7 +145,8 @@ def my_filters(mail): if ( False - or mail["List-Id"].matches("parabolagnulinux.org") + or mail["List-Id"].matches("parabolagnulinux\.org") + or mail["List-Id"].matches("parabola\.nu") or is_to_or_from(mail, "parabolagnulinux.org") or is_to_or_from(mail, "kiwwwi.com.ar") or is_to_or_from(mail, "parabola.nu") @@ -281,19 +290,19 @@ def my_filters(mail): # Sort mail from software people for address in [ "@archlinux.org", + "@canonical.org", + "@cnuk.org", + "@eff.org", + "@foocorp.net", "@fsf.org", "@github.com", - "canonical.org", - "cnuk.org", - "eff.org", - "esr@thyrsus.com", - "foocorp.net", - "gitorious.org", - "gnome.org", - "gnu.org", - "ietf.org", - "kde.org", - "sourceforge.com", + "@gitorious.org", + "@gnome.org", + "@gnu.org", + "@ietf.org", + "@kde.org", + "@sourceforge.com", + "@thyrsus.com", "trustees@core3.amsl.com", ]: if is_to_or_from(mail,address): diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index 61c264c..9f6bf37 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -88,12 +88,20 @@ def my_filters(mail): mail.move("INBOX.crap.Facebook") return + if is_to_or_from(mail,"@cerias.purdue.edu"): + mail.move("INBOX.crap.CERIAS") + return + + if is_to_or_from(mail,"royfu@purdue.edu"): + mail.move("INBOX.crap.Hackers") + return + if ( False or is_to_or_from(mail,"@cable.comcast.com") or is_to_or_from(mail,"@apexsystemsinc.com") ): - mail.move("INBOX.work.Comcast") + mail.move("INBOX.work.2013.Comcast") return if ( @@ -109,20 +117,24 @@ def my_filters(mail): # Fall 2012 ############################################################ + # SCI210 (Teaming principles) if mail["Subject"].contains("Fall-2012-SCI-21000-001:"): mail.move("INBOX.classes.2012-2.SCI210") + # CS180 (Java) if mail["Subject"].contains("fall-2012-cs-18000"): mail.move("INBOX.classes.2012-2.CS180") return if piazza_topic(mail, "CS 18000"): mail.move("INBOX.classes.2012-2.CS180.Piazza") return + # SOC100 if mail["Subject"].contains("Fall-2012-SOC-10000"): mail.move("INBOX.classes.2012-2.SOC100") return # Spring 2013 ########################################################## + # CS240 (C) if mail["Subject"].contains("[CS240] Submission result for"): mail.move("INBOX.classes.2013-1.CS240.autograder") return @@ -132,33 +144,40 @@ def my_filters(mail): if piazza_topic(mail, "CS 240"): mail.move("INBOX.classes.2013-1.CS240.Piazza") return + # PHYS220 if mail["Subject"].matches(".*(PHYS|CHIP)\s*220.*") or is_to_or_from(mail,"srdas@purdue.edu"): mail.move("INBOX.classes.2013-1.PHYS220") return + # SOC220 (Social Problems) if mail["Subject"].contains("Spring-2013-SOC-22000"): mail.move("INBOX.classes.2013-1.SOC220") return # Fall 2013 ############################################################ + # CS250 (Computer Architecture) if mail["Subject"].contains("Fall-2013-CS-25000"): mail.move("INBOX.classes.2013-2.CS250") return if piazza_topic(mail, "CS 250") or piazza_topic(mail, "CS 250-FALL2013"): mail.move("INBOX.classes.2013-2.CS250.Piazza") return + # CS251 (Intro Algo) if mail["Subject"].contains("Fall-2013-CS-25100"): mail.move("INBOX.classes.2013-2.CS251") return if piazza_topic(mail, "CS 251"): mail.move("INBOX.classes.2013-2.CS251.Piazza") return + # SPAN101 if mail["Subject"].contains("Fall-2013-SPAN-10100"): mail.move("INBOX.classes.2013-2.SPAN101") return + # MA261 (Calc III) if mail["Subject"].contains("Fall-2013-MA-26100"): mail.move("INBOX.classes.2013-2.MA261") return + # MA265 (Linear Algebra) if mail["Subject"].contains("Fall-2013-MA-26500"): mail.move("INBOX.classes.2013-2.MA265") return @@ -172,11 +191,11 @@ def my_filters(mail): if mail["From"].contains("mixable") and mail["Subject"].matches("^COM 21700"): mail.move("INBOX.classes.2014-1.COM217.Mixable") return - # CS252 + # CS252 (Systems Programming) if piazza_topic(mail, "CS 25200"): mail.move("INBOX.classes.2014-1.CS252.Piazza") return - # CS307 + # CS307 (Software Engineering) if is_to_or_from(mail, "dunsmore@purdue.edu") or mail["Subject"].contains("Spring-2014-CS-30700-LE1"): mail.move("INBOX.classes.2014-1.CS307") return @@ -199,10 +218,10 @@ def my_filters(mail): mail.move("INBOX.classes.2014-2.CS334") return # CS354 (OS) - # CS381 (Algo) if piazza_topic(mail, "CS 354"): mail.move("INBOX.classes.2014-2.CS354.Piazza") return + # CS381 (Algo) if piazza_topic(mail, "CS 381"): mail.move("INBOX.classes.2014-2.CS381.Piazza") return @@ -222,6 +241,35 @@ def my_filters(mail): ): mail.move("INBOX.classes.2014-2.PHYS221") return + + # Spring 2015 ######################################################### + + # CS352 (Compilers) + if is_to_or_from(mail, "wjg@cs.purdue.edu"): + mail.move("INBOX.classes.2015-1.CS352") + return + if piazza_topic(mail, "CS 352"): + mail.move("INBOX.classes.2015-1.CS352.Piazza") + return + # CS408 (Software testing) + if (False + or mail["Subject"].contains("spring-2015-cs-40800") + or is_to_or_from(mail, "li1471@purdue.edu") + or is_to_or_from(mail, "kirby@purdue.edu") + or is_to_or_from(mail, "webb39@purdue.edu") + or is_to_or_from(mail, "Jkou@purdue.edu") + or is_to_or_from(mail, "nstodda@purdue.edu") + or is_to_or_from(mail, "aryker@purdue.edu") # TA + ): + mail.move("INBOX.classes.2015-1.CS408") + return + # CS448 (Databases) + # ME297 (FRC) + if mail["Subject"].contains("[ME297]"): + mail.move("INBOX.classes.2015-1.ME297") + return + # SOC324 (Criminology) + handle_mapping = { "INBOX": my_filters, } -- cgit v1.2.3-2-g168b