From 0f4a6cf04af0cb2a33637dda81dfd82adbc7acc6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 27 Nov 2012 00:25:48 -0500 Subject: stuff --- .maildirproc/default.rc | 42 +++++++++++++++---------- .maildirproc/purdue.rc | 82 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 16 deletions(-) create mode 100644 .maildirproc/purdue.rc (limited to '.maildirproc') diff --git a/.maildirproc/default.rc b/.maildirproc/default.rc index c2ad6f2..cbdc908 100644 --- a/.maildirproc/default.rc +++ b/.maildirproc/default.rc @@ -10,7 +10,9 @@ 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) + False + or mail["From"].contains(address) + or mail["Reply-To"].contains(address) or mail.target.contains(address)) def is_to_or_from_re(mail,address): """ @@ -90,6 +92,10 @@ def my_filters(mail): mail.move(".software.social") return + if mail["List-Id"].matches("networkmanager-list\.gnome\.org"): + mail.move(".software.networkmanager") + return + if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): mail.move(".software.parabola-maintenance") return @@ -97,6 +103,7 @@ def my_filters(mail): 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") ): mail.move(".software.parabola-dev") @@ -166,6 +173,7 @@ def my_filters(mail): "justicejade10@aol.com", "parsonsjade@aol.com", "parsonstjade@gmail.com", + "jadparso@umail.iu.edu", ]: if mail["From"].contains(address): mail.move(".misc.Jade") @@ -190,23 +198,24 @@ def my_filters(mail): # 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", + "@ni.com", + "@usfirst.org", "BBonahoom@stanleyworks.com", - "wcxctrack829@aim.com", # Pat + "allison.m.babcock@gmail.com", + "bryanbonahoom@gmail.com", + "cdewalt3@yahoo.com", + "dave.nelson@ecolab.com", + "dickaustin190@yahoo.com", "djnels1@comcast.net", # Dave and Julie Nelson + "gamefreak207@gmail.com", # Brett Leedy + "jason.zielke@gmail.com", + "jeffreysmith@msdlt.k12.in.us", "sarahlittell@comcast.net", + "silioso@gmail.com", "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", + "wcxctrack829@aim.com", # Pat + "william.walk@gmail.com", ]: if is_to_or_from(mail,address): mail.move(".School.Robotics") @@ -224,6 +233,7 @@ def my_filters(mail): # Sort mail from software people for address in [ "gnu.org", + "gnome.org", "eff.org", "gitorious.org", "sourceforge.com", @@ -306,10 +316,10 @@ def my_filters(mail): return if ( False - or mail["From"].contains(".edu") + #or mail["From"].contains(".edu") or mail["From"].contains("admissions@") - or mail["From"].contains("college") - or mail["From"].contains("university") + #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") diff --git a/.maildirproc/purdue.rc b/.maildirproc/purdue.rc new file mode 100644 index 0000000..546b792 --- /dev/null +++ b/.maildirproc/purdue.rc @@ -0,0 +1,82 @@ +# -*- 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 handle_incoming_ham(mail): + my_filters(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): + 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 ( + False + or mail["Subject"].contains("[CS Opportunity Update]") + or mail["Subject"].contains("[CS Majors]") + ): + mail.move("INBOX.CS") + return + if is_to_or_from(mail,"linkedin.com"): + mail.move("INBOX.LinkedIn") + return + if mail["Subject"].contains("fall-2012-cs-18000"): + mail.move("INBOX.classes.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") + return + if mail["Subject"].contains("Fall-2012-SOC-10000"): + mail.move("INBOX.classes.SOC100") + return + +handle_mapping = { + "INBOX": handle_incoming_ham, + } +processor.maildirs = handle_mapping.keys() +for mail in processor: + handle_mapping[mail.maildir](mail) -- cgit v1.2.3-2-g168b