diff options
Diffstat (limited to '.maildirproc/purdue.rc')
-rw-r--r-- | .maildirproc/purdue.rc | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/.maildirproc/purdue.rc b/.maildirproc/purdue.rc index 546b792..9a759f5 100644 --- a/.maildirproc/purdue.rc +++ b/.maildirproc/purdue.rc @@ -20,36 +20,27 @@ def is_to_or_from_re(mail,address): return ( mail["From"].matches(address) or mail.target.matches(address)) - -def handle_incoming_ham(mail): - my_filters(mail) -def handle_incoming_unknown(mail): - # Filter spam +def piazza_topic(mail, topic): + return ( + is_to_or_from(mail, topic+" on Piazza") + or mail["Subject"].contains(topic+" on Piazza")) - 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): + # Generic stuff ######################################################## + if mail["Subject"].contains("[PASE]"): mail.move("INBOX.PASE") return + if mail["Subject"].contains("[PLUG]"): mail.move("INBOX.PLUG") return - if mail["Subject"].contains("Fall-2012-SCI-21000-001:"): - mail.move("INBOX.classes.SCI210") + + if is_to_or_from(mail,"linkedin.com"): + mail.move("INBOX.LinkedIn") + return + if ( False or mail["Subject"].contains("[CS Opportunity Update]") @@ -57,25 +48,36 @@ def my_filters(mail): ): mail.move("INBOX.CS") return - if is_to_or_from(mail,"linkedin.com"): - mail.move("INBOX.LinkedIn") - 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.CS180") + mail.move("INBOX.classes.2012-2.CS180") return - if ( - False - or is_to_or_from(mail,"CS 18000 on Piazza") - or mail["Subject"].contains("CS 18000 on Piazza") - ): - mail.move("INBOX.classes.CS180.Piazza") + 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.SOC100") + 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": handle_incoming_ham, + "INBOX": my_filters, } processor.maildirs = handle_mapping.keys() for mail in processor: |