diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-11-08 14:38:09 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-11-08 14:38:09 -0500 |
commit | 4b418ee4900156ad98b316f31b7731d11837b164 (patch) | |
tree | 177e865439248f116503b5a9027887f4c1ec2bc4 /.config | |
parent | 73792d5157d709ebe3d5ff35563692ac04e89fbd (diff) | |
parent | 3477cafcc1ecf1cefd2c36a7fac36c86443ea573 (diff) |
Merge branch 'master' into gluglugt60-par/master
Diffstat (limited to '.config')
20 files changed, 310 insertions, 185 deletions
diff --git a/.config/Makefile b/.config/Makefile index 3b7ebb1..62c639e 100644 --- a/.config/Makefile +++ b/.config/Makefile @@ -7,11 +7,12 @@ else SHELL = /bin/bash -o pipefail GIT_DIR = ${HOME}/.git +STATEDIR = ${XDG_CACHE_HOME}/config targets = \ ${GIT_DIR}/info/exclude \ - ${XDG_CACHE_HOME}/config-symlinks/cookie \ - $(if $(shell crontab -l),${XDG_CACHE_HOME}/cron/cookie) \ + ${STATEDIR}/symlinks.stamp \ + $(if $(shell crontab -l),${STATEDIR}/crontab.stamp) \ $(if $(wildcard ${HOME}/Maildir),${HOME}/.folders) \ $(if $(wildcard ${XDG_CONFIG_HOME}/dconf/user),${XDG_CONFIG_HOME}/dconf/user.txt) @@ -20,20 +21,32 @@ clean: rm -f -- $(targets) .PHONY: all clean -${HOME}/.folders: ${HOME}/Maildir $(MAKEFILE_LIST) - find -L $< -mindepth 2 -maxdepth 2 \( -type f -name "maildirfolder" -o -type d -name new -o -type d -name tmp -o -type d -name cur \) -printf '%P\0' | xargs -r0 dirname -z -- | sort -zu | xargs -0 printf -- '.%s\n' > '$@' +ifneq ($(wildcard ${HOME}/Maildir),) +MAILDIRS = . +-include ${STATEDIR}/maildirs.mk +${HOME}/.folders: $(addprefix ${HOME}/Maildir/,${MAILDIRS}) + find -L $< \( -false \ + -o -type f -name maildirfolder \ + -o -type d -name new \ + -o -type d -name tmp \ + -o -type d -name cur \ + \) -printf '%P\0' | xargs -r0 dirname -z -- | sort -zu | xargs -0 printf -- '.%s\n' > '$@' +${STATEDIR}/maildirs.mk: ${HOME}/.folders + < $< sed -n 's/^\.//p' | xargs -d $$'\n' -r dirname -- | sort -u | xargs -d $$'\n' -r printf 'MAILDIRS += %s\n' > $@ +endif + ${GIT_DIR}/info/exclude: ${HOME}/.git.info.exclude.in $(shell echo .??*/) ( cat $<; find $^ -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@ ${XDG_CONFIG_HOME}/dconf/user.txt: ${XDG_CONFIG_HOME}/dconf/user dconf dump / > $@ -${XDG_CACHE_HOME}/cron/cookie: ${XDG_CONFIG_HOME}/cron +${STATEDIR}/crontab.stamp: ${XDG_CONFIG_HOME}/cron -(cat $^/*; echo) | crontab - 2>/dev/null mkdir -p '$(@D)' date > '$@' -${XDG_CACHE_HOME}/config-symlinks/cookie: ${XDG_CONFIG_HOME}/symlinks +${STATEDIR}/symlinks.stamp: ${XDG_CONFIG_HOME}/symlinks config-symlinks mkdir -p '$(@D)' date > '$@' diff --git a/.config/bash/rc.d/10_aliases.sh b/.config/bash/rc.d/10_aliases.sh index c3766da..9d008e2 100644 --- a/.config/bash/rc.d/10_aliases.sh +++ b/.config/bash/rc.d/10_aliases.sh @@ -3,9 +3,15 @@ ###################################################################### # Set up colors and settings for all the things # ###################################################################### -if [ -x "`which dircolors`" ]; then - eval "$(dircolors -p | cat - "${XDG_CONFIG_HOME}/dir_colors" | - dircolors -b -)" +if type dircolors &>/dev/null; then + eval "$( + { + dircolors -p + if [[ -f "${XDG_CONFIG_HOME}/dir_colors" ]]; then + cat "${XDG_CONFIG_HOME}/dir_colors" + fi + } | dircolors -b - + )" alias ls='ls -1v --color=auto' alias dir='dir -v --color=auto' alias vdir='vdir -v --color=auto' @@ -63,7 +69,7 @@ if [ -x "`which dircolors`" ]; then } diff() { - if [[ -t 1 ]]; then + if [[ -t 1 ]] && type colordiff &>/dev/null; then ( set -o pipefail command diff "$@" | colordiff diff --git a/.config/emacs/custom.el b/.config/emacs/custom.el index 6da4ae8..8abff88 100644 --- a/.config/emacs/custom.el +++ b/.config/emacs/custom.el @@ -6,11 +6,7 @@ '(ansi-color-names-vector ["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"]) '(custom-enabled-themes (quote (tsdh-dark))) - '(custom-safe-themes - (quote - ("9f443833deb3412a34d2d2c912247349d4bd1b09e0f5eaba11a3ea7872892000" "bb08c73af94ee74453c90422485b29e5643b73b05e8de029a6909af6a3fb3f58" "82d2cac368ccdec2fcc7573f24c3f79654b78bf133096f9b40c20d97ec1d8016" "1b8d67b43ff1723960eb5e0cba512a2c7a2ad544ddb2533a90101fd1852b426e" "628278136f88aa1a151bb2d6c8a86bf2b7631fbea5f0f76cba2a0079cd910f7d" "06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "71b172ea4aad108801421cc5251edb6c792f3adbaecfa1c52e94e3d99634dee7" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" default))) '(erc-nick "lukeshu") - '(explicit-shell-file-name "/bin/bash") '(graphviz-dot-auto-indent-on-semi nil) '(org-latex-default-packages-alist (quote @@ -60,7 +56,6 @@ (Nginx-indent-level . 4) (Nginx-indent-level . 8) (c-set-style . "K&R")))) - '(scroll-bar-mode nil) '(use-package-verbose (quote debug))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 20ac4d8..1dee34a 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -90,10 +90,23 @@ (set (make-local-variable 'tab-width) 2) (set (make-local-variable 'indent-tabs-mode) nil) ))) +(use-package graphviz-dot-mode + :mode ("\\.dot\\'" "\\.gv\\'") + :config (add-hook 'graphviz-dot-mode-hook + '(lambda () + (set (make-local-variable 'graphviz-dot-auto-indent-on-semi) nil) + ))) +;;(use-package php-mode-improved +;; :mode (("\\.php[s34]?\\'" . php-mode) +;; ("\\.phtml\\'" . php-mode) +;; ("\\.inc\\'" . php-mode)) +;; :config (add-hook 'php-mode-hook +;; '(lambda () +;; (c-set-offset 'cpp-macro 0) +;; ))) (use-package cmake-mode :mode ("CMakeLists\\.txt\\'" "\\.cmake\\'")) (use-package glsl-mode :mode ("\\.vert\\'" "\\.frag\\'" "\\.geom\\'" "\\.glsl\\'")) (use-package go-mode :mode "\\.go\\'") -(use-package graphviz-dot-mode :mode ("\\.dot\\'" "\\.gv\\'")) (use-package haml-mode :mode "\\.haml\\'") (use-package haskell-mode :mode (("\\.hcr\\'" . ghc-core-mode) @@ -143,6 +156,7 @@ ;; Misc. crap (when (fboundp 'tool-bar-mode) (tool-bar-mode -1)) +(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) (setq inhibit-startup-screen t) (setq-default truncate-lines t) @@ -326,4 +340,7 @@ sh-script.el is broken." (add-to-list 'auto-mode-alist '("\\.mak\\'" . makefile-gmake-mode)) (add-to-list 'auto-mode-alist '("\\.jad\\'" . java-mode)) + +;; Anything that gets magically appended ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (put 'downcase-region 'disabled nil) diff --git a/.config/emacs/wl.el b/.config/emacs/wl.el index c27c87e..08d9ec3 100644 --- a/.config/emacs/wl.el +++ b/.config/emacs/wl.el @@ -18,12 +18,12 @@ ;; note: all below are dirs (Maildirs) under elmo-maildir-folder-path ;; the '.'-prefix is for marking them as maildirs - wl-fcc ".Sent" ;; sent msgs go to the "sent"-folder - wl-default-folder ".FOLDERS.Ham" ;; my main inbox - wl-draft-folder ".Draft" ;; store drafts in 'postponed' - wl-trash-folder ".Trash" ;; put trash in 'trash' - wl-spam-folder ".FOLDERS.Spam.training" ;; put spam in 'Bulk Mail' - wl-queue-folder ".FOLDERS.Queue" ;; we don't use this + wl-default-folder ".MAIN/Ham.2017" + wl-spam-folder ".QUEUES/Spam" + wl-draft-folder ".WL/Draft" + wl-trash-folder ".WL/Trash" + wl-queue-folder ".WL/Queue" + wl-fcc ".WL/Sent" ;; check this folder periodically, and update modeline ;wl-biff-check-folder-list '(".todo") ;; check every 180 seconds diff --git a/.config/git/attributes b/.config/git/attributes new file mode 100644 index 0000000..56444aa --- /dev/null +++ b/.config/git/attributes @@ -0,0 +1 @@ +ChangeLog merge=merge-changelog diff --git a/.config/git/config b/.config/git/config index 6e5abf2..21efa65 100644 --- a/.config/git/config +++ b/.config/git/config @@ -5,6 +5,9 @@ ui = auto [push] default = matching +[merge "merge-changelog"] + name = GNU-style ChangeLog merge driver + driver =git-merge-changelog %O %A %B [alias] lg = log --graph --format='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative hist = log --format='%h %ci -%C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset' --abbrev-commit diff --git a/.config/login.d/00_path.sh b/.config/login.d/00_path.sh index ae2e8db..aa62f75 100644 --- a/.config/login.d/00_path.sh +++ b/.config/login.d/00_path.sh @@ -1,12 +1,7 @@ #!/hint/sh -eval "$( if type config-path &>/dev/null; then - config_path=config-path -else + eval "$(config-path | sed 's/^/export /')" +elif [[ -x "$HOME/.local/bin/config-path" ]]; then # Bootstrap finding config-path - config_path="$HOME/.local/bin/config-path" + eval "$("$HOME/.local/bin/config-path" | sed 's/^/export /')" fi -IFS=$'\n' -lines=($("$config_path")) -printf -- 'export %s\n' "${lines[@]}" -)" diff --git a/.config/login.d/10_ccache.sh b/.config/login.d/10_ccache.sh new file mode 100644 index 0000000..b9721c0 --- /dev/null +++ b/.config/login.d/10_ccache.sh @@ -0,0 +1,4 @@ +#!/hint/sh +if test -d /usr/lib/ccache/bin; then + PATH="/usr/lib/ccache/bin:$PATH" +fi diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/default.rc index 67335e7..e264cc3 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/default.rc @@ -1,36 +1,81 @@ -# -*- mode: python; indent-tabs-mode: t -*- +#!/hint/python3 +# -*- indent-tabs-mode: t -*- import os import os.path import subprocess import datetime import re +import email.utils # # Mail attribute utilities +def parse_address(x): + return email.utils.parseaddr(str(x))[1] +def parse_addresses(x): + return [p[1] for p in email.utils.getaddresses([str(x)])] + +def match_re(x, pat): + return re.fullmatch(pat, x, re.IGNORECASE) +def match_glob(x, glob): + if '@' in glob: + if glob.startswith('@'): + return x.lower().endswith(glob.lower()) + return x.lower() == glob.lower() + else: + return x.lower().endswith('@'+glob.lower()) or x.lower().endswith('.'+glob.lower()) + +def originator_addresses(mail): + return [p[1] for p in email.utils.getaddresses([ + str(mail['From']), + str(mail['Sender']), + str(mail['Reply-To']), + ]) if p[1] != ''] + +def destination_addresses(mail): + return [p[1] for p in email.utils.getaddresses([ + str(mail['To']), + str(mail['Cc']), + str(mail['Bcc']), + ]) if p[1] != ''] +def all_addresses(mail): + return originator_addresses(mail) + destination_addresses(mail) + 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)) + m = match_re(parse_address(mail["List-Id"]), "(.*)\."+re.escape(domain)) if m: - return m.group(2) - for hdr in [ 'To', 'Cc', 'From' ]: - m = mail[hdr].matches("((\w|-)*)@"+re.escape(domain)) + return m.group(1) + if mail["List-Id"] != "": + return None + for addr in destination_addresses(mail): + m = match_re(addr, "(.*)@"+re.escape(domain)) if m: - if mail["Subject"].contains("["+m.group(1)+"]"): - return m.group(1) + ret = m.group(1) + if mail["Subject"].contains("["+ret+"]"): + return ret return None def ezmlm_domain(mail, domain): """ Return a string that is the list-name for a ezmlm domain """ - m = mail["Mailing-List"].matches("^(.* )?(\w+)(-\S*)?@"+re.escape(domain)+"(;.*)?$") + m = match_re(parse_address(mail["List-Id"]), "(.*)\."+re.escape(domain)) if m: - return m.group(2) - for hdr in [ 'To', 'Cc', 'From' ]: - m = mail[hdr].matches("(\w)@"+re.escape(domain)) + return m.group(1) + if mail["List-Id"] != "": + return None + ml = [s.strip() for s in str(mail["Mailing-List"]).split(";")] + if 'run by ezmlm' in ml: + contacts = [s[7:].strip() for s in ml if s.startswith('contact ')] + for contact in contacts: + m = match_re(contact, "(.+)-help@"+re.escape(domain)) + if m: + return m.group(1) + for addr in destination_addresses(mail): + m = match_re(addr, "(.*)@"+re.escape(domain)) if m: return m.group(1) return None @@ -39,31 +84,26 @@ def majordomo_domain(mail, domain): """ Return a string that is the list-name for a majordomo domain """ - m = mail["List-Id"].matches("^(.*<|)([^<]*)\."+re.escape(domain)) + m = match_re(parse_address(mail["List-Id"]), "(.*)\."+re.escape(domain)) if m: - return m.group(2) - for hdr in [ 'To', 'Cc', 'From' ]: - m = mail[hdr].matches("((\w|-)*)@"+re.escape(domain)) + return m.group(1) + if mail["List-Id"] != "": + return None + for addr in destination_addresses(mail): + m = match_re(addr, "(.*)@"+re.escape(domain)) if m: return m.group(1) + return None + +def is_from(mail, address): + return any(match_glob(addr, address) for addr in originator_addresses(mail)) +def is_from_re(mail, address): + return any(match_re(addr, address) for addr in originator_addresses(mail)) def is_to_or_from(mail, address): - """ - Return true if [mail] is to or from an address that contains [address]. - """ - return ( - False - or mail["From"].contains(address) - or mail["Reply-To"].contains(address) - or mail.target.contains(address)) + return any(match_glob(addr, address) for addr in all_addresses(mail)) 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)) + return any(match_re(addr, address) for addr in all_addresses(mail)) # # bogofilter utilites @@ -88,59 +128,61 @@ def bogofilter_spam(mail): def move_ham(mail, folder): y = datetime.datetime.now().year - folder = "FOLDERS.Ham."+str(y)+folder + folder = "MAIN/Ham."+str(y)+folder dir = processor.maildir_base+"/"+folder if not os.path.isfile(dir+"/maildirfolder"): os.makedirs(dir+"/tmp", 0o777, True) os.makedirs(dir+"/new", 0o777, True) os.makedirs(dir+"/cur", 0o777, True) open(dir+"/maildirfolder", 'a').close() + subprocess.call(['make', '-C', os.environ['XDG_CONFIG_HOME']]) mail.move(folder) def my_whitelist(mail): return ( False - or is_to_or_from(mail, "@opengroup.org") - or is_to_or_from(mail, "@purestorage.com") - or is_to_or_from(mail, "@vger.kernel.org") + or is_to_or_from(mail, "opengroup.org") + or is_to_or_from(mail, "purestorage.com") + or is_to_or_from(mail, "sourceware.org") + or is_to_or_from(mail, "vger.kernel.org") or is_to_or_from(mail, "Bryan@ChankTunUnGi.onmicrosoft.com") or is_to_or_from(mail, "cacnedcomms@gmail.com") 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"] == "3174451635@mms.att.net" - or mail["From"] == "MAILER-DAEMON@yahoo.com" - or mail["From"].contains("@careereco.com") - or mail["From"].contains("@ciholas.com") - or mail["From"].contains("@e.oldnational.com>") - 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("@list.cr.yp.to") - or mail["From"].contains("@lpi.org>") - or mail["From"].contains("@lulzbot.com>") - or mail["From"].contains("@mail.scribd.com>") - or mail["From"].contains("@massdrop.com>") - 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("@solutionsinplastic.com>") - or mail["From"].contains("@startcom.org>") - or mail["From"].contains("@usfirst.org>") - or mail["From"].contains("@vectren.com") - or mail["From"].contains("@vectrenemail.com") - or mail["From"].contains("@wolframalpha.com>") - or mail["From"].contains("Promo@email.newegg.com") - or mail["From"].contains("info@email2.mysimplemobile.com") - or mail["From"].contains("margieshu@sbcglobal.net") - or mail["From"].contains("parabolagnulinux.org") - or mail["From"].matches("@[a-z]+\.gandi\.net") - or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre|fedorahosted)\.org") - or mail["List-Id"].matches(".*\.parabola\.nu") + or is_from(mail, "3174451635@mms.att.net") + or is_from(mail, "MAILER-DAEMON@yahoo.com") + or is_from(mail, "careereco.com") + or is_from(mail, "ciholas.com") + or is_from(mail, "e.oldnational.com") + or is_from(mail, "facebookmail.com") + or is_from(mail, "gandi.net") + or is_from(mail, "github.com") + or is_from(mail, "goodwillindy.org") + or is_from(mail, "kickstarter.com") + or is_from(mail, "list.cr.yp.to") + or is_from(mail, "lpi.org") + or is_from(mail, "lulzbot.com") + or is_from(mail, "mail.scribd.com") + or is_from(mail, "massdrop.com") + or is_from(mail, "msdlt.k12.in.us") + or is_from(mail, "parabola.nu") + or is_from(mail, "post.oreilly.com") + or is_from(mail, "scouting.org") + or is_from(mail, "solutionsinplastic.com") + or is_from(mail, "startcom.org") + or is_from(mail, "usfirst.org") + or is_from(mail, "vectren.com") + or is_from(mail, "vectrenemail.com") + or is_from(mail, "wolframalpha.com") + or is_from(mail, "Promo@email.newegg.com") + or is_from(mail, "info@email2.mysimplemobile.com") + or is_from(mail, "margieshu@sbcglobal.net") + or is_from(mail, "parabolagnulinux.org") + or is_from(mail, "gandi.net") + or match_re(parse_address(mail["List-Id"]), ".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre|fedorahosted)\.org") + or match_re(parse_address(mail["List-Id"]), ".*\.parabola\.nu") or mail["Subject"].contains("[Dev]") or mail["Subject"].contains("[Maintenance]") or mail["Subject"].contains("[PATCH") @@ -148,28 +190,46 @@ def my_whitelist(mail): ) def my_filters(mail): + if mail["From"].contains("Parabola Website Notification <nobody@parabola.nu>"): + move_ham(mail, ".software.parabola.dev.web-notif") + return + + # .software.POSIX (custom mlm, I think) + if is_to_or_from(mail, "austin-group-l@opengroup.org"): + move_ham(mail, ".software.POSIX") + return # .software.* (GNU Mailman) - for pair in [ [ 'gnu.org', 'gnu' ], # https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@sbcglobal.net - [ 'nongnu.org', 'nongnu' ], # https://lists.nongnu.org/mailman/options/libreboot/lukeshu@sbcglobal.net - [ 'gnome.org', 'gnome' ], # https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@sbcglobal.net - [ 'archlinux.org', 'archlinux' ], - [ 'lists.freedesktop.org', 'freedesktop' ], - [ 'lists.fedorahosted.org', 'fedorahosted' ], - [ 'lists.arthurdejong.org', 'arthurdejong' ], - [ 'lists.stanford.edu', 'stanford' ], - [ 'mailman.stanford.edu', 'stanford' ], - [ 'lists.parabola.nu', 'parabola' ], - [ 'parabola.nu', 'parabola' ] ]: + for pair in [ + [ 'archlinux.org' , 'archlinux' ], # @sbcglobal.net and @lukeshu.com ; problems delivering to Yahoo! + [ 'gnome.org' , 'gnome' ], # https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@lukeshu.com + [ 'gnu.org' , 'gnu' ], # https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@lukeshu.com + [ 'lists.arthurdejong.org' , 'arthurdejong' ], + [ 'lists.fedorahosted.org' , 'fedorahosted' ], + [ 'lists.freedesktop.org' , 'freedesktop' ], # https://lists.freedesktop.org/mailman/options/systemd-devel/lukeshu@lukeshu.com + [ 'lists.parabola.nu' , 'parabola' ], # https://lists.parabola.nu/mailman/options/dev/lukeshu@lukeshu.com + [ 'lists.reproducible-builds.org' , 'reproducible-builds' ], # https://lists.reproducible-builds.org/options/rb-general/lukeshu@lukeshu.com + [ 'nongnu.org' , 'nongnu' ], # https://lists.nongnu.org/mailman/options/gnu-linux-libre/lukeshu@lukeshu.com + [ 'redhat.com' , 'redhat' ], # https://www.redhat.com/mailman/options/pam-list/lukeshu@lukeshu.com + [ 'lists.stanford.edu' , 'stanford' ], + [ 'mailman.stanford.edu' , 'stanford' ], + + ]: list = mailman_domain(mail, pair[0]) if list: move_ham(mail, ".software."+pair[1]+"."+list) return # .software.* (EZMLM) - for pair in [ [ 'list.cr.yp.to', 'djb' ] ]: + for pair in [ + [ 'list.cr.yp.to', 'djb' ], + [ 'sourceware.org', 'sourceware' ], + ]: list = ezmlm_domain(mail, pair[0]) if list: move_ham(mail, ".software."+pair[1]+"."+list) return + if is_from(mail, "sourceware-bugzilla@sourceware.org"): + move_ham(mail, ".software.sourceware-bugzilla") + return # .software.* (Majordomo) for pair in [ [ 'vger.kernel.org', 'kernel' ] ]: list = majordomo_domain(mail, pair[0]) @@ -179,42 +239,45 @@ def my_filters(mail): # .software.parabola if ( False - or is_to_or_from(mail, "parabolagnulinux.org") - or is_to_or_from(mail, "parabola.nu") + or is_to_or_from(mail, "ceata.org") or is_to_or_from(mail, "kiwwwi.com.ar") + or is_to_or_from(mail, "endefensadelsl.org") + or is_to_or_from(mail, "parabola.nu") + or is_to_or_from(mail, "parabolagnulinux.org") + or is_to_or_from(mail, "xylon.me.uk") + or False + or is_to_or_from(mail, "g4jc@openmailbox.org") + or is_to_or_from(mail, "jon@whiteheat.org.uk") + or is_to_or_from(mail, "srw@openmailbox.org") + or is_to_or_from(mail, "eliotime3000@openmailbox.org") ): move_ham(mail, ".software.parabola") return - # .software.POSIX - if is_to_or_from(mail, "austin-group-l@opengroup.org"): - move_ham(mail, ".software.POSIX") - return # .software.TravisCI - if mail["From"].contains("builds@travis-ci.org"): + if is_from(mail, "builds@travis-ci.org"): move_ham(mail, ".software.TravisCI") return # .software for address in [ - "@archlinux.org", - "@canonical.org", - "@cnuk.org", - "@core3.amsl.com", - "@defectivebydesign.org", - "@eff.org", - "@fedorahosted.org", - "@foocorp.net", - "@fsf.org", - "@github.com", - "@gitorious.org", - "@gnome.org", - "@gnu.org", - "@ietf.org", - "@kde.org", - "@lists.fedorahosted.org", - "@mozilla.org", - "@nongnu.org", - "@sourceforge.com", - "@thyrsus.com", + "archlinux.org", + "canonical.org", + "cnuk.org", + "core3.amsl.com", + "defectivebydesign.org", + "eff.org", + "fedorahosted.org", + "foocorp.net", + "fsf.org", + "github.com", + "gitorious.org", + "gnome.org", + "gnu.org", + "ietf.org", + "kde.org", + "mozilla.org", + "nongnu.org", + "sourceforge.com", + "thyrsus.com", ]: if is_to_or_from(mail, address): move_ham(mail, ".software") @@ -222,31 +285,42 @@ def my_filters(mail): # .servers if ( False - or mail["From"].contains("@gandi.net") - or mail["From"].contains("@ramhost.us") - or mail["From"].contains("@startcom.org") - or mail["From"].contains("@startssl.com") - or mail["From"].contains("@vultr.com") - or (mail["From"].contains("@2co.com") and mail["Subject"].contains("RAM Host")) + or is_from(mail, "gandi.net") + or is_from(mail, "ramhost.us") + or is_from(mail, "startcom.org") + or is_from(mail, "startssl.com") + or is_from(mail, "vultr.com") + or (is_from(mail, "@2co.com") and mail["Subject"].contains("RAM Host")) + or is_from(mail, "localhost") + or is_from(mail, "local") + or is_from(mail, "lan") + or is_from(mail, "lukeshu.com") ): move_ham(mail, ".servers") return # .Social.* - if mail["From"].matches("facebook(|mail)\.com"): + if is_from_re(mail, ".*[@.]facebook(|mail)\.com"): move_ham(mail, ".Social.Facebook") return - if mail["From"].matches("identi\.ca|statusnet"): + if is_from(mail, "identi.ca"): move_ham(mail, ".Social.Identica") return - if mail["From"].matches("twitter\.com"): + if is_from(mail, "twitter.com"): move_ham(mail, ".Social.Twitter") return - if mail["From"].matches("@xkcd\.com"): + if is_from(mail, "xkcd.com"): move_ham(mail, ".Social.xkcd") return - if is_to_or_from(mail, "linkedin.com"): + if is_from(mail, "linkedin.com"): move_ham(mail, ".Social.LinkedIn") return + # .jobs.* + if is_from(mail, "guru.com"): + move_ham(mail, ".jobs.Guru") + return + if is_from(mail, "glassdoor.com"): + move_ham(mail, ".jobs.Glassdoor") + return # .BSA if ( False @@ -275,7 +349,7 @@ def my_filters(mail): move_ham(mail, ".BSA") return # .FRC - for address in [ "@ni.com", "@usfirst.org", "@firstinspires.org" ]: + for address in [ "ni.com", "usfirst.org", "firstinspires.org" ]: if is_to_or_from(mail, address): move_ham(mail, ".FRC") return @@ -317,7 +391,10 @@ def my_filters(mail): or mail["Subject"].contains("[ME297]") or is_to_or_from(mail, "firstteam4272@gmail.com") or is_to_or_from(mail, "@tscstudents.net") + or is_to_or_from(mail, "@tsc.k12.in.us") + or is_to_or_from(mail, "ericjoelsells@gmail.com") or is_to_or_from(mail, "abenyeho@purdue.edu") + or is_to_or_from(mail, "alexhenry@purdue.edu") or is_to_or_from(mail, "Henry65@purdue.edu") or is_to_or_from(mail, "chang282@purdue.edu") ): @@ -365,10 +442,10 @@ def my_filters(mail): move_ham(mail, ".Purdue.misc") return # .misc.* - if mail["From"].matches("schwab\.com"): + if is_from(mail, "schwab.com"): move_ham(mail, ".misc.schwab") return - if mail["From"].matches("@ebay\.com"): + if is_from(mail, "ebay.com"): move_ham(mail, ".misc.ebay") return if ( @@ -378,13 +455,15 @@ def my_filters(mail): ): move_ham(mail, ".misc.Mom") return + if is_to_or_from(mail, "freelancer.com"): + move_ham(mail, ".misc.Freelancer") + return for address in [ - "@lpi.org", - "@pearson.com", + "lpi.org", + "pearson.com", "ciscotraining-notify@cisco.com", - "CompTIA", ]: - if mail["From"].contains(address): + if is_from(mail, address): move_ham(mail, ".misc.CompTIA") return if ( @@ -419,15 +498,6 @@ def my_filters(mail): return if ( False - or mail["From"].matches("@localhost") - or mail["From"].matches("@[^,>]*\.local") - or mail["From"].matches("@[^,>]*\.lan") - or mail["To"].matches("luke@") - ): - move_ham(mail, ".misc.LocalSystems") - return - if ( - False or mail["Subject"].contains("password") or mail["Subject"].contains("account") or mail["From"].contains("accounts") @@ -444,12 +514,12 @@ def handle_incoming_ham_training(mail): handle_incoming_ham(mail) def handle_incoming_spam_training(mail): bogofilter_spam(mail) - mail.move("FOLDERS.Spam") + mail.move("MAIN/Spam") def handle_incoming_ham(mail): my_filters(mail) def handle_incoming_spam(mail): - mail.move("FOLDERS.Spam") + mail.move("MAIN/Spam") def handle_incoming_unknown(mail): # Whitelist @@ -465,20 +535,21 @@ def handle_incoming_unknown(mail): handle_incoming_ham(mail) return elif spam == 2: - mail.move("FOLDERS.MysteryMeat") + mail.move("MAIN/MysteryMeat") return else: - mail.move("FOLDERS.BogoFail") + mail.move("MAIN/BogoFail") return # hook the above functions into the maildirproc processor processor.maildir_base = "~/Maildir" processor.auto_reload_rcfile = True handle_mapping = { - "Inbox": handle_incoming_unknown, - "Bulk Mail": handle_incoming_unknown, # fucking Yahoo! - "FOLDERS.Spam.training": handle_incoming_spam_training, - "FOLDERS.Ham.training": handle_incoming_ham_training, + "REMOTES/ATT/Inbox": handle_incoming_unknown, + "REMOTES/ATT/Bulk Mail": handle_incoming_unknown, # fucking Yahoo! + "REMOTES/lukeshu/INBOX": handle_incoming_unknown, + "QUEUES/Spam": handle_incoming_spam_training, + "QUEUES/Ham": handle_incoming_ham_training, } processor.maildirs = handle_mapping.keys() for mail in processor: diff --git a/.config/offlineimap/config b/.config/offlineimap/config index 2fc6ecc..b3262b2 100644 --- a/.config/offlineimap/config +++ b/.config/offlineimap/config @@ -1,26 +1,42 @@ # -*- Mode: Conf -*- [general] -accounts = ATT +accounts = ATT,lukeshu metadata = ~/.local/share/offlineimap ## AT&T ############################################################### [Account ATT] -localrepository = Local-Main -remoterepository = Remote-SBCGlobal +localrepository = Local-ATT +remoterepository = Remote-ATT -[Repository Local-Main] +[Repository Local-ATT] type = Maildir -localfolders = ~/Maildir +localfolders = ~/Maildir/REMOTES/ATT sep = . -folderfilter = lambda folder: folder in [ 'Inbox', 'Bulk Mail' ] -[Repository Remote-SBCGlobal] +[Repository Remote-ATT] type = IMAP ssl = yes sslcacertfile = /etc/ssl/certs/ca-certificates.crt auth_mechanisms = PLAIN remotehost = imap.mail.yahoo.com remoteuser = lukeshu@sbcglobal.net -folderfilter = lambda folder: folder in [ 'Inbox', 'Bulk Mail' ] -idlefolders = [ 'Inbox', 'Bulk Mail' ] + +## lukeshu.com ######################################################## + +[Account lukeshu] +localrepository = Local-lukeshu +remoterepository = Remote-lukeshu + +[Repository Local-lukeshu] +type = Maildir +localfolders = ~/Maildir/REMOTES/lukeshu +sep = . + +[Repository Remote-lukeshu] +type = IMAP +ssl = yes +sslcacertfile = /etc/ssl/certs/ca-certificates.crt +auth_mechanisms = PLAIN +remotehost = mav.lukeshu.com +remoteuser = lukeshu diff --git a/.config/systemd/user/default.target.wants/mail.target b/.config/systemd/user/default.target.wants/mail.target deleted file mode 120000 index 40ca36d..0000000 --- a/.config/systemd/user/default.target.wants/mail.target +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/systemd/user/mail.target
\ No newline at end of file diff --git a/.config/systemd/user/mail.target b/.config/systemd/user/mail.target new file mode 100644 index 0000000..5a408b2 --- /dev/null +++ b/.config/systemd/user/mail.target @@ -0,0 +1,5 @@ +[Unit] +Description=Mail Target + +[Install] +WantedBy=default.target diff --git a/.config/systemd/user/mail.target.wants/maildirproc@default.service b/.config/systemd/user/mail.target.wants/maildirproc@default.service new file mode 120000 index 0000000..13e527c --- /dev/null +++ b/.config/systemd/user/mail.target.wants/maildirproc@default.service @@ -0,0 +1 @@ +../maildirproc@.service
\ No newline at end of file diff --git a/.config/systemd/user/mail.target.wants/offlineimap-oneshot.timer b/.config/systemd/user/mail.target.wants/offlineimap-oneshot.timer new file mode 120000 index 0000000..9fb06ea --- /dev/null +++ b/.config/systemd/user/mail.target.wants/offlineimap-oneshot.timer @@ -0,0 +1 @@ +/usr/lib/systemd/user/offlineimap-oneshot.timer
\ No newline at end of file diff --git a/.config/systemd/user/mail.target.wants/offlineimap.service b/.config/systemd/user/mail.target.wants/offlineimap.service deleted file mode 120000 index aacc641..0000000 --- a/.config/systemd/user/mail.target.wants/offlineimap.service +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/systemd/user/offlineimap.service
\ No newline at end of file diff --git a/.config/systemd/user/mail.target.wants/offlineimap.timer b/.config/systemd/user/mail.target.wants/offlineimap.timer deleted file mode 120000 index 0644e30..0000000 --- a/.config/systemd/user/mail.target.wants/offlineimap.timer +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/systemd/user/offlineimap.timer
\ No newline at end of file diff --git a/.config/systemd/user/maildirproc@.service b/.config/systemd/user/maildirproc@.service index 450157f..f5a7ca5 100644 --- a/.config/systemd/user/maildirproc@.service +++ b/.config/systemd/user/maildirproc@.service @@ -7,4 +7,4 @@ ExecStart=/usr/bin/env maildirproc --rcfile=${HOME}/.config/maildirproc/%I.rc -- Restart=on-failure [Install] -WantedBy=default.target +WantedBy=mail.target diff --git a/.config/systemd/user/offlineimap-oneshot.timer.d/length.conf b/.config/systemd/user/offlineimap-oneshot.timer.d/length.conf new file mode 100644 index 0000000..5945ce8 --- /dev/null +++ b/.config/systemd/user/offlineimap-oneshot.timer.d/length.conf @@ -0,0 +1,2 @@ +[Timer] +OnUnitInactiveSec=1m diff --git a/.config/systemd/user/offlineimap.timer.d/length.conf b/.config/systemd/user/offlineimap.timer.d/length.conf deleted file mode 100644 index c010b38..0000000 --- a/.config/systemd/user/offlineimap.timer.d/length.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Timer] -OnUnitInactiveSec=5m |