diff options
Diffstat (limited to '.maildirproc/default.rc')
-rw-r--r-- | .maildirproc/default.rc | 120 |
1 files changed, 64 insertions, 56 deletions
diff --git a/.maildirproc/default.rc b/.maildirproc/default.rc index d7351c5..24f51e8 100644 --- a/.maildirproc/default.rc +++ b/.maildirproc/default.rc @@ -46,56 +46,50 @@ def handle_incoming_spam_training(mail): def handle_incoming_ham_training(mail): bogofilter_ham(mail) - mail.move(".Ham") + 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: - mail.move(".Bulk Mail") + handle_incoming_spam(mail) return elif spam == 1: - mail.move(".Ham") + handle_incoming_ham(mail) return elif spam == 2: # maybe spam - my_filters(mail) return else: mail.move(".Error") return def my_filters(mail): - # Sort into software mailing lists + # 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("bug-gsrc\.gnu\.org") - or mail["Subject"].contains("bug-gsrc") + or mail["List-Id"].matches("social-discuss\.gnu\.org") + or mail["Subject"].contains("social-discuss") ): - mail.move(".software.bug-gsrc") - return - - if mail["List-Id"].matches("bug-make\.gnu\.org"): - mail.move(".software.bug-make") - return - - if mail["List-Id"].matches("help-make\.gnu\.org"): - mail.move(".software.help-make") - return - - if mail["List-Id"].matches("social(|-discuss)\.gnu\.org"): mail.move(".software.social") return - if mail["List-Id"].matches("help-grub.gnu.org"): - mail.move(".software.help-grub") - return - if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): mail.move(".software.parabola-maintenance") return @@ -107,9 +101,15 @@ def my_filters(mail): ): mail.move(".software.parabola-dev") return + + for subject_re in [ + "\[Stow-[^\]]*\].*", + ]: + if mail["Subject"].matches(subject_re): + mail.move(".software") + return - # Sort email from some social websites - + # Sort mail from some social websites if mail["From"].matches("facebook(|mail)\.com"): mail.move(".Social.Facebook") return @@ -130,8 +130,7 @@ def my_filters(mail): mail.move(".Social.xkcd") return - # Sort email related to Troop 276 - + # Sort mail related to Troop 276 if ( False or mail["List-Id"].contains("troopmailinglist.troop276.net") @@ -153,11 +152,29 @@ def my_filters(mail): mail.move(".Troop276") return + # Sort mail from misc people if mail["From"].matches("margieshu@sbcglobal\.net"): mail.move(".misc.Mom") 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 robotics people + # Sort mail from FRC people for address in [ "jeffreysmith@msdlt.k12.in.us", "jason.zielke@gmail.com", @@ -170,7 +187,6 @@ def my_filters(mail): "skiplittell@comcast.net", "dave.nelson@ecolab.com", "@ni.com", - "@precisepath.com", "@usfirst.org", "gamefreak207@gmail.com", # Brett Leedy "tswilson4801@att.net", @@ -183,6 +199,7 @@ def my_filters(mail): mail.move(".School.Robotics") return for subject_re in [ + "FIRST", "robotics", "1024", "kil-?a-?bytes", @@ -191,9 +208,10 @@ def my_filters(mail): mail.move(".School.Robotics") return - # Sort mail from scoftware people + # Sort mail from software people for address in [ "gnu.org", + "eff.org", "gitorious.org", "sourceforge.com", "ietf.org", @@ -207,36 +225,24 @@ def my_filters(mail): if is_to_or_from(mail,address): mail.move(".software") return - for subject_re in [ - "\[Stow-[^\]]*\].*", - ]: - if mail["Subject"].matches(subject_re): - mail.move(".software") - return - for address in [ - "nintendo.com", - "nintendo-news.com", - ]: - if mail["From"].contains(address): - mail.move(".Nintendo") - return - - for address in [ - "@lpi.org", - "@pearson.com", - "CompTIA", - ]: - if mail["From"].contains(address): - mail.move(".CompTIA") - return - if is_to_or_from(mail, "@lnnorthstar.org"): + # 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(".PMCH") + mail.move(".Work.PMCH") for address in [ "d.farrar@comcast.net", @@ -248,7 +254,6 @@ def my_filters(mail): return # Sort misc newsletters - if ( False or mail["From"].contains("newsletter") @@ -256,6 +261,7 @@ def my_filters(mail): 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 @@ -318,11 +324,13 @@ def my_filters(mail): 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, + #".Ham": handle_incoming_ham, } processor.maildirs = handle_mapping.keys() for mail in processor: |