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.rc168
1 files changed, 77 insertions, 91 deletions
diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc
index 6b31260..792b42c 100644
--- a/.config/maildirproc/att.rc
+++ b/.config/maildirproc/att.rc
@@ -4,10 +4,24 @@ import os
import os.path
import subprocess
import datetime
+import re
processor.maildir_base = "~/Maildir"
processor.auto_reload_rcfile = True
-processor.logfile = os.getenv('XDG_CACHE_HOME', "~/.cache")+"/maildirproc/att.log"
+
+def mailman_domain(mail, domain):
+ """
+ Return a string that is the list-name for a mailman domain
+ """
+ m = mail["List-Id"].matches("^(.*<|)([^<]*)\."+re.escape(domain))
+ if m:
+ return m.group(2)
+ for hdr in [ 'To', 'Cc', 'From' ]:
+ m = mail[hdr].matches("((\w|-)*)@"+re.escape(domain))
+ if m:
+ if mail["Subject"].contains("["+m.group(1)+"]"):
+ return m.group(1)
+ return None
def is_to_or_from(mail,address):
"""
@@ -77,17 +91,21 @@ def handle_incoming_unknown(mail):
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"] == "3174451635@mms.att.net"
or mail["From"].contains("@facebookmail.com>")
or mail["From"].contains("@gandi.net")
+ or mail["From"].contains("@github.com>")
or mail["From"].contains("@goodwillindy.org>")
+ or mail["From"].contains("@kickstarter.com>")
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("margieshu@sbcglobal.net")
or mail["From"].contains("parabolagnulinux.org")
- or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre)\.org")
+ or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre|fedorahosted)\.org")
or mail["List-Id"].matches(".*\.parabola\.nu")
or mail["Subject"].contains("[Dev]")
or mail["Subject"].contains("[Maintenance]")
@@ -112,66 +130,30 @@ def handle_incoming_unknown(mail):
return
def my_filters(mail):
- # Sort mail from GNU mailing lists
- for list in [ 'bug-gsrc', 'bug-make', 'help-make', 'social', 'help-grub', 'bug-gnuzilla', 'bug-librejs' ]:
- if (
- False
- or mail["List-Id"].matches(list+"\.gnu\.org")
- or mail["Subject"].contains('['+list+']')
- ):
- move_ham(mail,".software."+list)
+ # Sort mail from various mailing lists
+ # https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@sbcglobal.net
+ # https://lists.nongnu.org/mailman/options/libreboot/lukeshu@sbcglobal.net
+ # https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@sbcglobal.net
+ for pair in [ [ 'gnu.org', 'gnu' ],
+ [ 'nongnu.org', 'nongnu' ],
+ [ 'gnome.org', 'gnome' ],
+ [ 'archlinux.org', 'archlinux' ],
+ [ 'lists.freedesktop.org', 'freedesktop' ],
+ [ 'lists.fedorahosted.org', 'fedorahosted' ],
+ [ 'lists.parabola.nu', 'parabola' ],
+ [ 'parabola.nu', 'parabola' ] ]:
+ list = mailman_domain(mail, pair[0])
+ if list:
+ move_ham(mail,".software."+pair[1]+"."+list)
return
-
- # Sort mail from other software mailing lists
- if (
- False
- or mail["List-Id"].matches("social-discuss\.gnu\.org")
- or mail["Subject"].contains("social-discuss")
- ):
- move_ham(mail,".software.social")
- return
-
- if mail["List-Id"].matches("networkmanager-list\.gnome\.org"):
- move_ham(mail,".software.networkmanager")
- return
-
- if mail["List-Id"].matches("maintenance\.lists\.parabola(gnulinux\.org|\.nu)"):
- move_ham(mail,".software.parabola.maintenance")
- return
-
- if is_to_or_from(mail, "labs@parabola.nu"):
- move_ham(mail,".software.parabola.labs")
- return
-
if (
False
- or mail["List-Id"].matches("parabolagnulinux\.org")
- or mail["List-Id"].matches("parabola\.nu")
- 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")
+ or is_to_or_from(mail, "parabolagnulinux.org")
+ or is_to_or_from(mail, "parabola.nu")
+ or is_to_or_from(mail, "kiwwwi.com.ar")
):
- if mail["Subject"].contains("[Django]"):
- move_ham(mail,".software.parabola.maintenance.django")
- return
- else:
- move_ham(mail,".software.parabola.dev")
- return
-
- if (mail["List-Id"].matches("pacman-dev.archlinux.org")):
- move_ham(mail,".software.pacman-dev")
+ move_ham(mail,".software.parabola")
return
-
- if (mail["List-Id"].matches("systemd-devel.lists.freedesktop.org") or is_to_or_from(mail, "systemd-devel@lists.freedesktop.org")):
- move_ham(mail,".software.systemd-devel")
- return
-
- for subject_re in [
- "\[Stow-[^\]]*\].*",
- ]:
- if mail["Subject"].matches(subject_re):
- move_ham(mail,".software")
- return
# Sort mail from some social websites
if mail["From"].matches("facebook(|mail)\.com"):
@@ -254,12 +236,27 @@ def my_filters(mail):
return
# Sort mail from FRC people
+ # Generic
+ for address in [ "@ni.com", "@usfirst.org" ]:
+ if is_to_or_from(mail,address):
+ move_ham(mail,".FRC")
+ return
+ # FRC 829
+ for address in [
+ "wcxctrack829@aim.com", # Pat
+ "william.walk@gmail.com",
+ ]:
+ if is_to_or_from(mail,address):
+ move_ham(mail,".FRC.829")
+ return
+ if mail["Subject"].matches("\b829\b"):
+ move_hame(mail,".FRC.829")
+ return
+ # FRC 1024
for address in [
- "@ni.com",
- "@usfirst.org",
"BBonahoom@stanleyworks.com",
- "allison.m.babcock@gmail.com",
"bryanbonahoom@gmail.com",
+ "allison.m.babcock@gmail.com",
"cdewalt3@yahoo.com",
"dave.nelson@ecolab.com",
"dickaustin190@yahoo.com",
@@ -271,28 +268,34 @@ def my_filters(mail):
"silioso@gmail.com",
"skiplittell@comcast.net",
"tswilson4801@att.net",
- "wcxctrack829@aim.com", # Pat
- "william.walk@gmail.com",
]:
if is_to_or_from(mail,address):
- move_ham(mail,".School.Robotics")
+ move_ham(mail,".FRC.1024")
return
- for subject_re in [
- "robotics",
- "\b1024\b",
- "\b4272\b",
- "kil-?a-?bytes",
- ]:
+ for subject_re in [ "\b1024\b", "kil-?a-?bytes" ]:
if mail["Subject"].matches(subject_re):
- move_ham(mail,".School.Robotics")
+ move_ham(mail,".FRC.1024")
return
+ # FRC 4272
+ if mail["Subject"].matches("\b4272\b"):
+ move_hame(mail,".FRC.4272")
+ return
+
+ # Catch BS things because of CS classes before the general
+ # software filters
+ if mail["Subject"].contains("[Quizroom]"):
+ mail.delete()
+ return
# Sort mail from software people
for address in [
"@archlinux.org",
"@canonical.org",
"@cnuk.org",
+ "@core3.amsl.com",
+ "@defectivebydesign.org",
"@eff.org",
+ "@fedorahosted.org",
"@foocorp.net",
"@fsf.org",
"@github.com",
@@ -301,41 +304,24 @@ def my_filters(mail):
"@gnu.org",
"@ietf.org",
"@kde.org",
+ "@lists.fedorahosted.org",
+ "@nongnu.org",
"@sourceforge.com",
"@thyrsus.com",
- "trustees@core3.amsl.com",
]:
if is_to_or_from(mail,address):
move_ham(mail,".software")
return
-
# 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")
):
- move_ham(mail,".School.Newspaper")
- return
-
- # Sort mail from various employers/people who pay me
- if is_to_or_from(mail, "@precisepath.com"):
- move_ham(mail,".Work.PrecisePath")
+ move_ham(mail,".HighSchool.Newspaper")
return
- if is_to_or_from(mail,"susyphil@aol.com"):
- move_ham(mail,".Work.PMCH")
-
- for address in [
- "d.farrar@comcast.net",
- "dfarrar@avacoustics.net",
- "@vmware.com",
- ]:
- if is_to_or_from(mail,address):
- move_ham(mail,".Work.FAST")
- return
-
# Sort misc newsletters
if (
False
@@ -363,7 +349,7 @@ def my_filters(mail):
or mail["Subject"].contains("NHS")
or mail["Subject"].contains("National Honor Society")
):
- move_ham(mail,".School")
+ move_ham(mail,".HighSchool")
return
# from college stuff