summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/maildirproc/att.rc101
-rw-r--r--.config/maildirproc/purdue.rc16
2 files changed, 48 insertions, 69 deletions
diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc
index c94ac8d..98ef8ae 100644
--- a/.config/maildirproc/att.rc
+++ b/.config/maildirproc/att.rc
@@ -4,10 +4,26 @@ import os
import os.path
import subprocess
import datetime
+import re
processor.maildir_base = "~/Maildir"
processor.auto_reload_rcfile = True
+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:
+ if mail["Subject"].contains("["+m.group(2)+"]"):
+ 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(2)
+ return None
+
def is_to_or_from(mail,address):
"""
Return true if [mail] is to or from an address that contains [address].
@@ -114,81 +130,30 @@ def handle_incoming_unknown(mail):
return
def my_filters(mail):
- # Sort mail from GNU mailing lists
+ # Sort mail from various mailing lists
# https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@sbcglobal.net
- #m = mail["List-Id"].matches("(.*<)?([^<]*)\.gnu\.org")
- #if m:
- # move_ham(mail,".software.gnu."+m.group(2))
- # return
-
- for list in [ 'bug-librejs',
- 'bug-make',
- 'help-grub',
- 'help-make',
- 'social',
- 'social-discuss',
- 'stow-devel',
- 'bug-gnuzilla',
- 'bug-gsrc' ]:
- if (
- False
- or mail["List-Id"].matches(list+"\.gnu\.org")
- or mail["Subject"].contains('['+list+']')
- ):
- import pdb; pdb.set_trace()
- move_ham(mail,".software.gnu."+list)
- return
- # Sort mail from non-GNU mailing lists
# https://lists.nongnu.org/mailman/options/libreboot/lukeshu@sbcglobal.net
- for list in [ 'libreboot',
- 'libreboot-dev',
- 'librefm-announce',
- 'social-announce',
- 'gnu-linux-libre' ]:
- if (
- False
- or mail["List-Id"].matches(list+"\.nongnu\.org")
- or mail["Subject"].contains('['+list+']')
- ):
- import pdb; pdb.set_trace()
- move_ham(mail,".software.nongnu."+list)
- return
- # Sort mail from Gnome mailing lists
# https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@sbcglobal.net
- for list in [ 'networkmanager-list' ]:
- if mail["List-Id"].matches(list+"\.gnome\.org"):
- move_ham(mail,".software.gnome."+list)
+ 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 Arch Linux mailing lists
- for list in [ 'arch-projects', 'pacman-dev' ]:
- if mail["List-Id"].matches(list+"\.archlinux\.org"):
- move_ham(mail,".software.archlinux."+list)
- return
- # Sort mail from other mailing lists
- 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
- # Sort mail from Parabola mailing lists
- if mail["List-Id"].matches("maintenance\.lists\.parabola\.nu"):
- move_ham(mail,".software.parabola.maintenance")
- return
- if mail["List-Id"].matches("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
+ move_ham(mail,".software.parabola")
+ return
# Sort mail from some social websites
if mail["From"].matches("facebook(|mail)\.com"):
diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc
index d1505f9..f086eee 100644
--- a/.config/maildirproc/purdue.rc
+++ b/.config/maildirproc/purdue.rc
@@ -103,7 +103,12 @@ def my_filters(mail):
mail.move("INBOX.work.2013.Comcast")
return
- if is_to_or_from(mail,"@Cartus.com"):
+ if (
+ False
+ or is_to_or_from(mail,"@qualcomm.com")
+ or is_to_or_from(mail,"@Cartus.com")
+ or is_to_or_from(mail,"@quicinc.com")
+ ):
mail.move("INBOX.work.2015.qualcomm")
return
@@ -268,6 +273,9 @@ def my_filters(mail):
return
# CS448 (Databases)
if piazza_topic(mail, "CS 44800"):
+ mail.move("INBOX.classes.2015-1.CS448.Piazza")
+ return
+ if mail["Subject"].matches("CS *448"):
mail.move("INBOX.classes.2015-1.CS448")
return
# ME297 (FRC)
@@ -278,6 +286,12 @@ def my_filters(mail):
mail.move("INBOX.classes.2015-1.ME297")
return
# SOC324 (Criminology)
+ if mail["Subject"].contains("spring-2015-soc-32400"):
+ mail.move("INBOX.classes.2015-1.SOC324")
+ return
+
+ # Everything else #####################################################
+ mail.move("INBOX.ham");
handle_mapping = {
"INBOX": my_filters,