summaryrefslogtreecommitdiff
path: root/.maildirproc/default.rc
diff options
context:
space:
mode:
Diffstat (limited to '.maildirproc/default.rc')
-rw-r--r--.maildirproc/default.rc56
1 files changed, 44 insertions, 12 deletions
diff --git a/.maildirproc/default.rc b/.maildirproc/default.rc
index 7ea1ef0..f49fb9b 100644
--- a/.maildirproc/default.rc
+++ b/.maildirproc/default.rc
@@ -6,10 +6,17 @@ processor.maildir_base = "~/Maildir"
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))
@@ -39,24 +46,25 @@ 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")
@@ -85,17 +93,33 @@ def my_filters(mail):
mail.move(".software.social")
return
- if mail["List-ID"].matches("dev.lists.parabolagnulinux.org"):
+ 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
+ if (
+ False
+ or mail["List-Id"].matches("parabolagnulinux.org")
+ or is_to_or_from(mail, "parabolagnulinux.org")
+ or is_to_or_from(mail, "parabola.nu")
+ ):
mail.move(".software.parabola-dev")
return
# Sort email from some social websites
- if mail["From"].matches("@facebook(|mail)\.com"):
+ if mail["From"].matches("facebook(|mail)\.com"):
mail.move(".Social.Facebook")
return
- if mail["From"].matches("identi\.ca"):
+ if (
+ False
+ or mail["From"].matches("identi\.ca")
+ or mail["From"].matches("statusnet")
+ ):
mail.move(".Social.Identica")
return
@@ -125,6 +149,7 @@ def my_filters(mail):
or is_to_or_from(mail,"solorzano.luis@rocketmail.com")
or is_to_or_from(mail,"eldredmac@comcast.net")# MacDonell
or is_to_or_from(mail,"mitchprather@sbcglobal.net")
+ or is_to_or_from(mail,"oa_wap@yahoo.com")
):
mail.move(".Troop276")
return
@@ -147,11 +172,13 @@ def my_filters(mail):
"dave.nelson@ecolab.com",
"@ni.com",
"@precisepath.com",
+ "@usfirst.org",
"gamefreak207@gmail.com", # Brett Leedy
"tswilson4801@att.net",
"justicejade10@aol.com",
"silioso@gmail.com",
"cdewalt3@yahoo.com",
+ "bryanbonahoom@gmail.com",
]:
if is_to_or_from(mail,address):
mail.move(".School.Robotics")
@@ -176,7 +203,6 @@ def my_filters(mail):
"esr@thyrsus.com",
"canonical.org",
"foocorp.net",
- "parabolagnulinux.org",
"cnuk.org",
]:
if is_to_or_from(mail,address):
@@ -206,11 +232,15 @@ def my_filters(mail):
mail.move(".CompTIA")
return
- if mail["From"].contains("@lnnorthstar.org"):
+ 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
- if mail["From"].contains("susyphil@aol.com"):
+ if is_to_or_from(mail,"susyphil@aol.com"):
mail.move(".PMCH")
for address in [
@@ -238,6 +268,7 @@ def my_filters(mail):
if (
False
or mail["From"].contains("@msdlt.k12.in.us")
+ or mail["From"].contains("naviance.com")
or is_to_or_from(mail,"ibwhite@comcast.net")
or mail["Subject"].contains("IOA")
or mail["From"].contains("nths.org")
@@ -292,12 +323,13 @@ def my_filters(mail):
mail.move(".misc.accounts")
return
+ mail.move(".Ham")
+
handle_mapping = {
".": handle_incoming_unknown,
- ".Inbox": 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: