summaryrefslogtreecommitdiff
path: root/.config/maildirproc/att.rc
diff options
context:
space:
mode:
Diffstat (limited to '.config/maildirproc/att.rc')
-rw-r--r--.config/maildirproc/att.rc136
1 files changed, 74 insertions, 62 deletions
diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc
index e7f581b..b8ff8f1 100644
--- a/.config/maildirproc/att.rc
+++ b/.config/maildirproc/att.rc
@@ -2,6 +2,7 @@
import os
import subprocess
+import datetime
processor.maildir_base = "~/Maildir"
processor.auto_reload_rcfile = True
@@ -24,6 +25,9 @@ def is_to_or_from_re(mail,address):
return (
mail["From"].matches(address)
or mail.target.matches(address))
+def move_ham(mail,folder):
+ y = datetime.datetime.now().year
+ mail.move("FOLDERS.Ham."+str(y)+folder)
def bogofilter_auto(mail):
p = subprocess.Popen(
@@ -57,18 +61,30 @@ def handle_incoming_spam(mail):
def handle_incoming_unknown(mail):
# Filter spam
+ # Whitelist
if (
False
- or mail["Subject"].contains("[systemd-devel]")
- or mail["Subject"].contains("[PATCH")
- or mail["Subject"].contains("[Dev]")
- or mail["Subject"].contains("[Maintenance]")
- or is_to_or_from(mail, "gnu.org")
or is_to_or_from(mail, "fsf.org")
+ or is_to_or_from(mail, "gnu.org")
+ or is_to_or_from(mail, "parabola.nu")
+ or is_to_or_from(mail, "parabolagnulinux.org")
+ or mail["From"] == "MAILER-DAEMON@yahoo.com"
+ or mail["From"].contains("@facebookmail.com>")
+ or mail["From"].contains("@gandi.net")
+ or mail["From"].contains("@goodwillindy.org>")
+ or mail["From"].contains("@lpi.org>")
+ or mail["From"].contains("@msdlt.k12.in.us>")
or mail["From"].contains("@parabola.nu")
+ or mail["From"].contains("@post.oreilly.com>")
+ or mail["From"].contains("@scouting.org>")
+ or mail["From"].contains("@wolframalpha.com>")
or mail["From"].contains("parabolagnulinux.org")
- or mail["From"].contains("@facebookmail.com>")
or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre)\.org")
+ or mail["List-Id"].matches(".*\.parabola\.nu")
+ or mail["Subject"].contains("[Dev]")
+ or mail["Subject"].contains("[Maintenance]")
+ or mail["Subject"].contains("[PATCH")
+ or mail["Subject"].contains("[systemd-devel]")
):
handle_incoming_ham_training(mail)
return
@@ -95,7 +111,7 @@ def my_filters(mail):
or mail["List-Id"].matches(list+"\.gnu\.org")
or mail["Subject"].contains('['+list+']')
):
- mail.move("FOLDERS.Ham.software."+list)
+ move_ham(mail,".software."+list)
return
# Sort mail from other software mailing lists
@@ -104,25 +120,19 @@ def my_filters(mail):
or mail["List-Id"].matches("social-discuss\.gnu\.org")
or mail["Subject"].contains("social-discuss")
):
- mail.move("FOLDERS.Ham.software.social")
+ move_ham(mail,".software.social")
return
if mail["List-Id"].matches("networkmanager-list\.gnome\.org"):
- mail.move("FOLDERS.Ham.software.networkmanager")
+ move_ham(mail,".software.networkmanager")
return
if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"):
- if mail["Subject"].matches("Cron <.*@repo>"):
- mail.move("FOLDERS.Ham.software.parabola-maintenance.cron-repo")
- return
- if mail["Subject"].matches("Cron <.*@parabolagnulinux>"):
- mail.move("FOLDERS.Ham.software.parabola-maintenance.cron-web")
- return
- mail.move("FOLDERS.Ham.software.parabola-maintenance")
+ move_ham(mail,".software.parabola.maintenance")
return
if is_to_or_from(mail, "labs@parabola.nu"):
- mail.move("FOLDERS.Ham.software.parabola-labs")
+ move_ham(mail,".software.parabola.labs")
return
if (
@@ -133,29 +143,30 @@ def my_filters(mail):
or is_to_or_from(mail, "parabola.nu")
):
if mail["Subject"].contains("[Django]"):
- mail.move("FOLDERS.Ham.software.parabola-maintenance.django")
+ move_ham(mail,".software.parabola.maintenance.django")
+ return
+ else:
+ move_ham(mail,".software.parabola.dev")
return
- mail.move("FOLDERS.Ham.software.parabola-dev")
- return
if (mail["List-Id"].matches("pacman-dev.archlinux.org")):
- mail.move("FOLDERS.Ham.software.pacman-dev")
+ move_ham(mail,".software.pacman-dev")
return
if (mail["List-Id"].matches("systemd-devel.lists.freedesktop.org") or is_to_or_from(mail, "systemd-devel@lists.freedesktop.org")):
- mail.move("FOLDERS.Ham.software.systemd-devel")
+ move_ham(mail,".software.systemd-devel")
return
for subject_re in [
"\[Stow-[^\]]*\].*",
]:
if mail["Subject"].matches(subject_re):
- mail.move("FOLDERS.Ham.software")
+ move_ham(mail,".software")
return
# Sort mail from some social websites
if mail["From"].matches("facebook(|mail)\.com"):
- mail.move("FOLDERS.Ham.Social.Facebook")
+ move_ham(mail,".Social.Facebook")
return
if (
@@ -163,15 +174,24 @@ def my_filters(mail):
or mail["From"].matches("identi\.ca")
or mail["From"].matches("statusnet")
):
- mail.move("FOLDERS.Ham.Social.Identica")
+ move_ham(mail,".Social.Identica")
return
+ if (
+ False
+ or mail["From"].contains("@gandi.net")
+ or mail["From"].contains("@ramhost.us")
+ or mail["From"].contains("@startcom.org")
+ ):
+ move_ham(mail,".lukeshu-com")
+ return
+
if mail["From"].matches("twitter\.com"):
- mail.move("FOLDERS.Ham.Social.Twitter")
+ move_ham(mail,".Social.Twitter")
return
if mail["From"].matches("@xkcd\.com"):
- mail.move("FOLDERS.Ham.Social.xkcd")
+ move_ham(mail,".Social.xkcd")
return
# Sort mail related to Troop 276
@@ -195,30 +215,24 @@ def my_filters(mail):
or is_to_or_from(mail,"mytroop.us")
or is_to_or_from(mail,"crossroadsbsa.org")
):
- mail.move("FOLDERS.Ham.BoyScouts")
+ move_ham(mail,".BoyScouts")
return
# Sort mail from misc people
- if mail["From"].matches("margieshu@sbcglobal\.net"):
- mail.move("FOLDERS.Ham.misc.Mom")
+ if (
+ False
+ or is_to_or_from(mail,"margieshu@sbcglobal.net")
+ or is_to_or_from(mail,"3174451635@mms.att.net")
+ ):
+ move_ham(mail,".misc.Mom")
return
for address in [
- "justicejade10@aol.com",
- "parsonsjade@aol.com",
- "parsonstjade@gmail.com",
- "jadparso@umail.iu.edu",
- ]:
- if is_to_or_from(mail,address):
- mail.move("FOLDERS.Ham.misc.Jade")
- return
-
- for address in [
"nintendo.com",
"nintendo-news.com",
]:
if mail["From"].contains(address):
- mail.move("FOLDERS.Ham.misc.Nintendo")
+ move_ham(mail,".misc.Nintendo")
return
for address in [
@@ -227,7 +241,7 @@ def my_filters(mail):
"CompTIA",
]:
if mail["From"].contains(address):
- mail.move("FOLDERS.Ham.misc.CompTIA")
+ move_ham(mail,".misc.CompTIA")
return
# Sort mail from FRC people
@@ -252,15 +266,16 @@ def my_filters(mail):
"william.walk@gmail.com",
]:
if is_to_or_from(mail,address):
- mail.move("FOLDERS.Ham.School.Robotics")
+ move_ham(mail,".School.Robotics")
return
for subject_re in [
"robotics",
- "1024",
+ "\b1024\b",
+ "\b4272\b",
"kil-?a-?bytes",
]:
if mail["Subject"].matches(subject_re):
- mail.move("FOLDERS.Ham.School.Robotics")
+ move_ham(mail,".School.Robotics")
return
# Sort mail from software people
@@ -282,7 +297,7 @@ def my_filters(mail):
"trustees@core3.amsl.com",
]:
if is_to_or_from(mail,address):
- mail.move("FOLDERS.Ham.software")
+ move_ham(mail,".software")
return
@@ -292,16 +307,16 @@ def my_filters(mail):
or is_to_or_from(mail, "@lnnorthstar.org")
or is_to_or_from(mail, "lnnorthstar.org@tigertech.net")
):
- mail.move("FOLDERS.Ham.School.Newspaper")
+ move_ham(mail,".School.Newspaper")
return
# Sort mail from various employers/people who pay me
if is_to_or_from(mail, "@precisepath.com"):
- mail.move("FOLDERS.Ham.Work.PrecisePath")
+ move_ham(mail,".Work.PrecisePath")
return
if is_to_or_from(mail,"susyphil@aol.com"):
- mail.move("FOLDERS.Ham.Work.PMCH")
+ move_ham(mail,".Work.PMCH")
for address in [
"d.farrar@comcast.net",
@@ -309,7 +324,7 @@ def my_filters(mail):
"@vmware.com",
]:
if is_to_or_from(mail,address):
- mail.move("FOLDERS.Ham.Work.FAST")
+ move_ham(mail,".Work.FAST")
return
# Sort misc newsletters
@@ -323,7 +338,7 @@ def my_filters(mail):
or mail["From"].contains("info@demandprogress.org")
or (mail["From"].contains("@sparkfun.com") and mail["Message-Id"].contains("rsgsv.net"))
):
- mail.move("FOLDERS.Ham.misc.Newsletters")
+ move_ham(mail,".misc.Newsletters")
return
if (
@@ -339,7 +354,7 @@ def my_filters(mail):
or mail["Subject"].contains("NHS")
or mail["Subject"].contains("National Honor Society")
):
- mail.move("FOLDERS.Ham.School")
+ move_ham(mail,".School")
return
# from college stuff
@@ -348,44 +363,41 @@ def my_filters(mail):
or mail["Subject"].contains("NYLF") # National Youth Leadership Conference
or mail["Subject"].contains("NSHSS")
):
- mail.move("FOLDERS.Ham.College.Societies")
+ move_ham(mail,".College.Societies")
return
if (
False
- #or mail["From"].contains(".edu")
or mail["From"].contains("admissions@")
- #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")
or mail["From"].contains("@indianatechinfo.org")
):
- mail.move("FOLDERS.Ham.College")
+ move_ham(mail,".College")
return
if mail["From"].contains("@projectwonderful.com"):
- mail.move("FOLDERS.Ham.misc.ProjectWonderful")
+ move_ham(mail,".misc.ProjectWonderful")
return
if (
False
or mail["From"].matches("@localhost")
or mail["From"].matches("@[^,>]*\.local")
- or mail["From"].matches("@[^,>]*\.lukeshu\.ath\.cx")
+ or mail["From"].matches("@[^,>]*\.lan")
or mail["To"].matches("luke@")
):
- mail.move("FOLDERS.Ham.LocalSystems")
+ move_ham(mail,".LocalSystems")
return
if (
False
or mail["Subject"].contains("password")
or mail["Subject"].contains("account")
):
- mail.move("FOLDERS.Ham.misc.accounts")
+ move_ham(mail,".misc.accounts")
return
- mail.move("FOLDERS.Ham")
+ move_ham(mail,"")
handle_mapping = {
"Inbox": handle_incoming_unknown,