summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-01-27 20:37:02 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-01-27 20:37:02 -0500
commit06268b3c5291565b37e7339ddf2451aab770725a (patch)
treee7c4de9e9d955cc2ac187b00f13f0a2539ca9aef
parent3d546259779cf3829653594d961b0422183e7484 (diff)
mv .maildirproc .config/maildirproc; ln -s .config/maildirproc/ .maildirproc
-rw-r--r--.config/maildirproc/purdue.rc84
l---------.maildirproc2
2 files changed, 85 insertions, 1 deletions
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)
diff --git a/.maildirproc b/.maildirproc
index ac993e9..f29b6d2 120000
--- a/.maildirproc
+++ b/.maildirproc
@@ -1 +1 @@
-.config/maidirproc \ No newline at end of file
+.config/maildirproc/ \ No newline at end of file