summaryrefslogtreecommitdiff
path: root/.config/maildirproc
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-03-27 15:50:32 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-03-27 15:50:32 -0400
commit9e79a6c3bbc37c2eec19e055566440f0b1173c5c (patch)
tree7516e65c0289b9a68b3a97fe2abbdf0d7dba8d8d /.config/maildirproc
parent5c42078bd052705b69d6ea93ff7617445be43789 (diff)
parentd65775a22e1648eca8e74389a4d9c1c299017cf3 (diff)
Merge remote-tracking branch 'origin/master' into purdue-cs
Conflicts: .config/X11/clientrc .config/bash/rc.d/emacs.sh .config/bash/rc.sh .config/conkeror .config/conkerorrc .config/emacs/custom.el .config/irbrc .config/login.sh .config/maildirproc/att.rc .config/maildirproc/default.rc .config/offlineimaprc .config/ssh/config .config/wmii-hg/autostart .config/wmii-hg/include.sh .config/wmii-hg/quit .config/wmii-hg/rbar_battery .config/wmii-hg/rbar_clock .config/wmii-hg/rbar_cpu .config/wmii-hg/rbar_wifi .conkerorrc .maildirproc/default.rc
Diffstat (limited to '.config/maildirproc')
-rw-r--r--.config/maildirproc/att.rc (renamed from .config/maildirproc/default.rc)0
-rw-r--r--.config/maildirproc/purdue.rc191
2 files changed, 191 insertions, 0 deletions
diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/att.rc
index 71bc00c..71bc00c 100644
--- a/.config/maildirproc/default.rc
+++ b/.config/maildirproc/att.rc
diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc
new file mode 100644
index 0000000..6d4b913
--- /dev/null
+++ b/.config/maildirproc/purdue.rc
@@ -0,0 +1,191 @@
+# -*- mode: python; indent-tabs-mode: t -*-
+
+import os
+import subprocess
+
+processor.maildir_base = "~/Maildir.purdue"
+processor.auto_reload_rcfile = True
+processor.logfile = os.getenv('XDG_CACHE_HOME', "~/.cache")+"/maildirproc/purdue.log"
+
+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 (
+ False
+ or mail["Subject"].contains("[PASE]")
+ or is_to_or_from(mail,"Purduealumni@purdue.edu")
+ or is_to_or_from(mail,"pase@purdue.edu")
+ ):
+ mail.move("INBOX.crap.PASE")
+ return
+
+ if mail["Subject"].contains("[PLUG]"):
+ mail.move("INBOX.crap.PLUG")
+ return
+
+ if mail["From"].matches(".*bursar.*@purdue\.edu"):
+ mail.move("INBOX.tuition")
+ return
+
+ if mail["From"].contains("mailhub-admin@purdue.edu"):
+ mail.move("INBOX.crap.mailhub-admin")
+ return
+
+ if mail["From"].matches("pmx-.*@purdue.edu"):
+ mail.move("INBOX.crap.spam")
+ return
+
+ if is_to_or_from(mail,"linkedin.com"):
+ mail.move("INBOX.crap.LinkedIn")
+ return
+
+ if is_to_or_from(mail,"follet.com"):
+ mail.move("INBOX.Follet")
+ return
+
+ if (
+ False
+ or is_to_or_from(mail,"@edrtrust.com")
+ 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 mail["From"].matches("facebook(|mail)\.com"):
+ mail.move("INBOX.crap.Facebook")
+ 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")
+ return
+
+ if (
+ False
+ or mail["Subject"].contains("[CS Opportunity Update]")
+ or mail["Subject"].contains("[CS Majors]")
+ ):
+ mail.move("INBOX.crap.CS")
+ return
+ if (mail["From"].contains("shumakl@cs.purdue.edu") and mail["Subject"].matches("^cron:")):
+ mail.move("INBOX.crap.cron")
+ 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] Submission result for"):
+ mail.move("INBOX.classes.2013-1.CS240.autograder")
+ return
+ 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"].matches(".*(PHYS|CHIP)\s*220.*") or is_to_or_from(mail,"srdas@purdue.edu"):
+ mail.move("INBOX.classes.2013-1.PHYS220")
+ return
+ if mail["Subject"].contains("Spring-2013-SOC-22000"):
+ mail.move("INBOX.classes.2013-1.SOC220")
+ return
+
+ # Fall 2013 ############################################################
+
+ 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
+ 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
+ if mail["Subject"].contains("Fall-2013-SPAN-10100"):
+ mail.move("INBOX.classes.2013-2.SPAN101")
+ return
+ if mail["Subject"].contains("Fall-2013-MA-26100"):
+ mail.move("INBOX.classes.2013-2.MA261")
+ return
+ if mail["Subject"].contains("Fall-2013-MA-26500"):
+ mail.move("INBOX.classes.2013-2.MA265")
+ return
+
+ # Spring 2014 ##########################################################
+
+ # COM217
+ if mail["Subject"].contains("Spring-2014-COM-21700-004"):
+ mail.move("INBOX.classes.2014-1.COM217")
+ return
+ if mail["From"].contains("mixable") and mail["Subject"].matches("^COM 21700"):
+ mail.move("INBOX.classes.2014-1.COM217.Mixable")
+ return
+ # CS252
+ if piazza_topic(mail, "CS 25200"):
+ mail.move("INBOX.classes.2014-1.CS252.Piazza")
+ return
+ # CS307
+ 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
+ # SPAN102
+ if mail["Subject"].contains("spring-2014-span-102"):
+ mail.move("INBOX.classes.2014-1.SPAN102")
+ return
+ # STAT350
+ if is_to_or_from(mail, "ssellke@purdue.edu"):
+ mail.move("INBOX.classes.2014-1.STAT350")
+ return
+ if piazza_topic(mail, "STAT 35000 (SELLKE)"):
+ mail.move("INBOX.classes.2014-1.STAT350.Piazza")
+ return
+
+handle_mapping = {
+ "INBOX": my_filters,
+ }
+processor.maildirs = handle_mapping.keys()
+for mail in processor:
+ handle_mapping[mail.maildir](mail)