X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/53d6b45cd27bc760c51930df1b3e18982ae4595b..0630988acc7864483d8f6ed96f0ff1971ddb4db6:/dot/gnus-local.el.distorted diff --git a/dot/gnus-local.el.distorted b/dot/gnus-local.el.distorted index ed6f0aa..5967b7b 100644 --- a/dot/gnus-local.el.distorted +++ b/dot/gnus-local.el.distorted @@ -5,13 +5,13 @@ ;;; (c) 2014 Mark Wooding ;;; -(setq auth-sources '("~/.gnus.authinfo")) +(setq auth-sources '("~/.authinfo.gpg")) ;;;-------------------------------------------------------------------------- ;;; How to send mail. (setq smtpmail-smtp-service 587 - smtpmail-auth-credentials "~/.gnus.authinfo") + smtpmail-auth-credentials "~/.authinfo.gpg") (setq mdw-send-mail-alist `((distorted-smtp @@ -36,7 +36,7 @@ "\\|" "evade\\.org\\.uk" "\\|" "fyvzl\\.net" "\\)$") . chiark-smtp) - ("@g\\(\\|oogle\\)mail\\.com$" . gmail-smtp)) + ("@g\\(oogle\\)?mail\\.com$" . gmail-smtp)) mdw-default-send-mail-method nil) ;;;-------------------------------------------------------------------------- @@ -72,18 +72,6 @@ (setq message-alternative-emails bbdb-user-mail-names message-dont-reply-to-names message-alternative-emails) -;; Mail sent to `mdw-nospam-THING' should appear to come from this address. -(setq gnus-posting-styles - '(("^nnimap\\+distorted:crap\\." - (address (concat "mdw-nospam-" - (substring gnus-newsgroup-name (match-end 0)) - "@distorted.org.uk"))) - ("^nnimap\\+[^:]+-chiark:" - ("X-mdw-Send-Mail" "chiark-smtp")) - ("^nnimap\\+google:" - (address "distorted.mdw@gmail.com") - ("X-mdw-Send-Mail" "gmail-smtp")))) - ;; Augment Gnus's built-in header-list abbreviations. (require 'nnmail) (setq nnmail-split-abbrev-alist @@ -105,9 +93,10 @@ "\\(" "$" "\\|" "\\s-" "\\)")) (defvar mdw-odin-splits nil) +(defvar mdw-odin-sender-alist nil) (defun mdw-update-odin-info () - (let ((list nil)) + (let ((splits nil) (senders nil)) (with-temp-buffer (call-process "ssh" nil t nil "stratocaster" "userv" "odin" "mail" "list") @@ -118,11 +107,27 @@ (tag (match-string 2))) (push `(to ,(format "%s@odin\\.gg" local-part) ,(format "crap.%s" tag)) - list))) + splits) + (push (cons tag local-part) senders))) (forward-line))) - (setq mdw-odin-splits (nreverse list)))) + (setq mdw-odin-splits (nreverse splits) + mdw-odin-sender-alist (nreverse senders)))) (mdw-update-odin-info) +;; Mail sent to `mdw-nospam-THING' should appear to come from this address. +(setq gnus-posting-styles + '(("^nnimap\\+distorted:crap\\." + (address (let* ((mailbox (substring gnus-newsgroup-name + (match-end 0))) + (entry (assoc mailbox mdw-odin-sender-alist))) + (if entry (concat (cdr entry) "@odin.gg") + (concat "mdw-nospam-" mailbox "@distorted.org.uk"))))) + ("^nnimap\\+[^:]+-chiark:" + ("X-mdw-Send-Mail" "chiark-smtp")) + ("^nnimap\\+google:" + (address "distorted.mdw@gmail.com") + ("X-mdw-Send-Mail" "gmail-smtp")))) + ;; The actual splitting rules. (setq nnmail-split-fancy `(| @@ -150,7 +155,7 @@ ;; Mailing lists, not split out earlier. (to "python-list@python\\.org" "lists.python") (to ,(concat "\\(jump-\\(announce\\|discuss\\)\\)@" - "\\(lists\\.\\|\\)" "jump\\.net\\.uk") + "\\(lists\\.\\)?" "jump\\.net\\.uk") "lists.\\1") (to "cambridgecryptowhiskyclub@gmail\\.com" "lists.cambridge-crypto-whisky") @@ -183,20 +188,21 @@ ;; Other splits I've not given a per-sender address. (from "@\\(.*\\.\\)?lovefilm\\.com\\>" "crap.lovefilm" t) - (from "@\\(\\|.*\\.\\)amazon\\." "crap.amazon" t) + (from "@\\(.*\\.\\)?amazon\\." "crap.amazon" t) (from "@cineworldmail\\.com\\>" "crap.cineworld" t) (from "@picturehouses\\.co\\.uk\\>" "crap.picturehouse" t) (from "@nationwide" "crap.nationwide" t) (from "nationwide@securesuiteemail\\.com\\>" "crap.nationwide" t) - (from "@news\\.spotifymail\\.com\\>" "crap.spotify" t) + (from "@\\(.*\\.\\)?spotify\\(mail\\)?\\.com\\>" "crap.spotify" t) (from "@action\\.openrightsgroup\\.org\\>" "crap.org" t) (from "unlimited@cineworld\\.com\\>" "crap.cineworld" t) (from "@tshirthell\\.com\\>" "crap.tshirt-hell" t) (from "campaigns@jolla\\.com\\>" "crap.jolla" t) (from "@thomann\\.de\\>" "crap.thomann" t) (from "@wikimedia\\.org\\>" "crap.wikimedia" t) - (from "@gandi\\.net\\>" "crap.gandi" t) + (from "@\\(.*\\.\\)?gandi\\.net\\>" "crap.gandi" t) (from "@mythic-beasts\\.com\\>" "crap.mythic-beasts" t) + (from "@accounts\\.google\\.com\\>" "crap.google" t) ;; Default. "mail.misc")) @@ -208,6 +214,7 @@ (setq gnus-secondary-select-methods `((nnimap "distorted" (nnimap-address "mail.distorted.org.uk") + (nnimap-user "mdw") (nnimap-stream starttls) (nnimap-inbox ("INBOX" "to.split")) (nnimap-split-methods nnimap-split-fancy) @@ -215,6 +222,7 @@ (nnimap-unsplittable-articles (%Deleted))) (nnimap "markw-distorted" (nnimap-address "mail.distorted.org.uk") + (nnimap-user "markw") (nnimap-stream starttls) (nnimap-inbox ("INBOX" "to.split")) (nnimap-split-methods nnimap-split-fancy) @@ -222,6 +230,7 @@ (nnimap-unsplittable-articles (%Deleted))) (nnimap "mdw-chiark" (nnimap-address "imap.dovecot.chiark.greenend.org.uk") + (nnimap-user "mdw") (nnimap-stream starttls) (nnimap-inbox ("INBOX" "to.split")) (nnimap-split-methods nnimap-split-fancy) @@ -229,6 +238,7 @@ (nnimap-unsplittable-articles (%Deleted))) (nnimap "mwooding-chiark" (nnimap-address "imap.dovecot.chiark.greenend.org.uk") + (nnimap-user "mwooding") (nnimap-stream starttls) (nnimap-inbox ("INBOX" "to.split")) (nnimap-split-methods nnimap-split-fancy)