X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/48c5ccb30f4b590329b6509675e0ac8a06e442f6..161ca534b9551db731f4d70f41c6cbbe49b34ad4:/dot/gnus-local.el.distorted diff --git a/dot/gnus-local.el.distorted b/dot/gnus-local.el.distorted index 64dced6..2e64c00 100644 --- a/dot/gnus-local.el.distorted +++ b/dot/gnus-local.el.distorted @@ -6,16 +6,47 @@ ;;; ;;;-------------------------------------------------------------------------- +;;; Random configuration. + +(setq auth-sources '("~/.gnus.authinfo")) + +(remove-hook 'gnus-mark-article-hook + 'gnus-summary-mark-read-and-unread-as-read) +(add-hook 'gnus-mark-article-hook 'gnus-summary-mark-unread-as-read) + +(setq gnus-level-unsubscribed 6) + +;;;-------------------------------------------------------------------------- ;;; How to send mail. -(and nil - (setq smtpmail-smtp-server "mail.distorted.org.uk" - smtpmail-sendto-domain "distorted.org.uk" - smtpmail-smtp-service 587 - smtpmail-auth-credentials "~/.gnus.authinfo" - message-send-mail-function 'smtpmail-send-it - smtpmail-starttls-credentials - '(("mail.distorted.org.uk" 587 "" "")))) +(setq smtpmail-smtp-service 587 + smtpmail-auth-credentials "~/.gnus.authinfo") + +(setq mdw-send-mail-alist + `((distorted-smtp + (send-mail-function . smtpmail-send-it) + (smtpmail-smtp-server . "mail.distorted.org.uk") + (smtpmail-starttls-credentials + ("mail.distorted.org.uk" 587 nil nil))) + (chiark-smtp + (send-mail-function . smtpmail-send-it) + (smtpmail-smtp-server . "smtp.dovecot.chiark.greenend.org.uk") + (starttls-extra-arguments "--insecure") + (smtpmail-starttls-credentials + ("smtp.dovecot.chiark.greenend.org.uk" 587 nil nil))) + (gmail-smtp + (send-mail-function . smtpmail-send-it) + (smtpmail-smtp-server . "smtp.gmail.com") + (smtpmail-starttls-credentials + ("smtp.gmail.com" 587 nil nil)))) + mdw-guess-send-mail-alist + `((,(concat "@\\(" "\\(chiark\\|slimy\\|coriolis\\)" + "\\.greenend\\.org\\.uk" + "\\|" "evade\\.org\\.uk" + "\\|" "fyvzl\\.net" + "\\)$") . chiark-smtp) + ("@g\\(\\|oogle\\)mail\\.com$" . gmail-smtp)) + mdw-default-send-mail-method nil) ;;;-------------------------------------------------------------------------- ;;; News via chiark. @@ -24,39 +55,14 @@ (setq gnus-select-method '(nntp "chiark-ssh-kludge" (nntp-open-connection-function nntp-open-authinfo-kludge) - (nntp-address "localhost:10119") - (nntp-authinfo-generic "md5cookie1way chiark"))) - -;;;-------------------------------------------------------------------------- -;;; Where we get mail from. - -;; Read mail on the IMAP server. -(setq gnus-secondary-select-methods - '((nnimap "distorted" - (nnimap-address "mail.distorted.org.uk") - (nnimap-stream tls) - (nnimap-authinfo-file "~/.gnus.authinfo")) - (nnimap "markw-distorted" - (nnimap-address "mail.distorted.org.uk") - (nnimap-stream tls) - (nnimap-authinfo-file "~/.gnus.authinfo.markw")) - (nnimap "google" - (nnimap-address "imap.gmail.com") - (nnimap-stream tls) - (nnimap-authinfo-file "~/.gnus.authinfo")))) - -;; Send sent mail back to me. -(setq gnus-message-archive-method "mail" - gnus-gcc-mark-as-read t - gnus-message-archive-group "nnimap+distorted:mail.sent") + (nntp-address "tunnel.chiark.greenend.org.uk") + (nntp-authinfo-generic "md5cookie1way mdw"))) ;;;-------------------------------------------------------------------------- ;;; Mail group configuration. ;; General splitting configuration. -(setq nnimap-split-inbox '("INBOX" "to.split") - nnimap-split-rule 'nnimap-split-fancy - nnimap-split-methods 'nnimap-split-fancy +(setq nnimap-split-rule 'nnimap-split-fancy nnmail-split-methods 'nnmail-split-fancy nnimap-split-predicate "UNDELETED" nnimap-split-crosspost t @@ -65,7 +71,11 @@ ;; Automatic expiry for particular groups. (setq gnus-auto-expirable-newsgroups - "^nnimap\\+distorted:\\(crap\\|spam\\|admin\\|lists\\|nag\\)\\..*") + (concat "^" + "\\(nnimap\\+[^:]+\\|nnvirtual\\):" + "\\(" "\\(admin\\|crap\\|lists\\|nag\\|spam\\)\\." + "\\|" "spam\\.oubliette" + "\\)")) ;; My various email addresses. (setq message-alternative-emails bbdb-user-mail-names @@ -73,29 +83,57 @@ ;; Mail sent to `mdw-nospam-THING' should appear to come from this address. (setq gnus-posting-styles - '(((and (string-match "^nnimap\\+distorted:crap\\.\\(.*\\)$" - gnus-newsgroup-name) - (setq mdw-from-address - (replace-match "mdw-nospam-\\1@distorted.org.uk" - nil nil gnus-newsgroup-name))) - ("From" mdw-from-address)))) + '(("^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")))) + +(defvar mdw-odin-parse-regexp + (concat "^" + "\\S-+" "\\s-+" ; time limit + "\\(" "\\S-+" "\\)" "\\s-+" ; local part + "\\S-+" "\\s-+" ; recipient email address + "=" "\\(" "\\S-+" "\\)" ; mailbox tag + "\\(" "$" "\\|" "\\s-" "\\)")) + +(defun mdw-odin-splits () + (let ((list nil)) + (with-temp-buffer + (call-process "ssh" nil t nil + "stratocaster" "userv" "odin" "mail" "list") + (goto-char (point-min)) + (while (< (point) (point-max)) + (when (looking-at mdw-odin-parse-regexp) + (let ((local-part (match-string 1)) + (tag (match-string 2))) + (push `(to ,(format "%s@odin\\.gg" local-part) + ,(format "crap.%s" tag)) + list))) + (forward-line))) + (nreverse list))) ;; The actual splitting rules. (setq nnmail-split-fancy - '(| + `(| ;; Administrative boxes. - (to "\\(root\\|postgres\\|ca\\|noc\\)@" "admin.misc" t) - (to "\\(jukebox\\|nobody\\|darchive\\)@" "admin.misc" t) - (to "\\(hostmaster\\)@" "admin.dns" t) - (to "\\(news\\|newsmaster\\|usenet\\)@" "admin.news" t) - (to "\\(postmaster\\|spamd\\|mailer-daemon\\)@" "admin.mail" t) - (to "\\(irc\\|blight\\|ircbot\\)@" "admin.irc" t) - (to "\\(www\\|webmaster\\|mtos\\)@" "admin.web" t) - (to "\\(ftp\\|ftpadmin\\|mirror\\)@" "admin.ftp" t) - (to "\\(abuse\\|security\\)@" "admin.keep" t) + (to "\\<\\(root\\|postgres\\|ca\\|noc\\)@" "admin.misc" t) + (to "\\<\\(jukebox\\|nobody\\|darchive\\)@" "admin.misc" t) + (to "\\<\\(hostmaster\\)@" "admin.dns" t) + (to "\\<\\(news\\|newsmaster\\|usenet\\)@" "admin.news" t) + (to "\\<\\(postmaster\\|spamd\\|mailer-daemon\\)@" "admin.mail" t) + (to "\\<\\(irc\\|blight\\|ircbot\\)@" "admin.irc" t) + (to "\\<\\(www\\|webmaster\\|mtos\\)@" "admin.web" t) + (to "\\<\\(ftp\\|ftpadmin\\|mirror\\)@" "admin.ftp" t) + (to "\\\<\\(abuse\\|security\\)@" "admin.keep" t) (from "cron daemon" "admin.misc") (from "uucp@distorted\\.org\\.uk" "admin.uucp") (from "darchive@.*\\.distorted\\.org\\.uk" "admin.misc") + (from "support@aa\\.net\\.uk" "admin.aaisp") (from "bugs@distorted\\.org\\.uk" "admin.bugs") ;; Colo provider. @@ -103,38 +141,77 @@ ;; Mailing lists, not split out earlier. (to "python-list@python\\.org" "lists.python") - (to "jump-announce@jump\\.net\\.uk" "lists.jump-announce") + (to "\\(jump-\\(announce\\|discuss\\)\\)@\\(lists\\.\\)jump\\.net\\.uk" + "lists.jump-\\1") ;; Per-sender addresses. - (to "mdw-nospam-justgviing@" "crap.justgiving" t) - (to "mdw-nospam-\\([^@]+\\)@" "crap.\\1" t) - (to "mdw-nopspam-\\([^@]+\\)@" "crap.\\1" t) + (to "\\" "spam.lovefilm" t) + (from "@\\(\\|.*\\.\\)amazon\\." "spam.amazon" t) + (from "@cineworldmail\\.com\\>" "spam.cineworld" t) + (from "@picturehouses\\.co\\.uk\\>" "spam.picturehouse" t) (from "@nationwide" "spam.nationwide" t) - (from "@news\\.spotifymail\\.com" "spam.spotify" t) - (from "@action\\.openrightsgroup\\.org" "spam.org" t) - (from "unlimited@cineworld\\.com" "spam.cineworld" t) - (from "nationwide@securesuiteemail\\.com" "spam.nationwide" t) - (from "@liberty-human-rights\\.org\\.uk" "spam.liberty" t) - (from "@libertymail\\.org\\.uk" "spam.liberty" t) - (from "@openrightsgroup\\.org" "spam.org" t) - (from "@tshirthell\\.com" "spam.tshirt-hell" t) - (from "campaigns@jolla\\.com" "crap.jolla" t) + (from "@news\\.spotifymail\\.com\\>" "spam.spotify" t) + (from "@action\\.openrightsgroup\\.org\\>" "spam.org" t) + (from "unlimited@cineworld\\.com\\>" "spam.cineworld" t) + (from "nationwide@securesuiteemail\\.com\\>" "spam.nationwide" t) + (from "@liberty-human-rights\\.org\\.uk\\>" "spam.liberty" t) + (from "@libertymail\\.org\\.uk\\>" "spam.liberty" t) + (from "@openrightsgroup\\.org\\>" "spam.org" t) + (from "@tshirthell\\.com\\>" "spam.tshirt-hell" t) + (from "campaigns@jolla\\.com\\>" "crap.jolla" t) ;; Default. - "mail.misc") - nnimap-split-fancy nnmail-split-fancy) + "mail.misc")) + +;;;-------------------------------------------------------------------------- +;;; Where we get mail from. + +;; Read mail on the IMAP server. +(setq gnus-secondary-select-methods + `((nnimap "distorted" + (nnimap-address "mail.distorted.org.uk") + (nnimap-stream starttls) + (nnimap-inbox ("INBOX" "to.split")) + (nnimap-split-methods nnimap-split-fancy) + (nnimap-split-fancy ,nnmail-split-fancy) + (nnimap-unsplittable-articles (%Deleted))) + (nnimap "markw-distorted" + (nnimap-address "mail.distorted.org.uk") + (nnimap-stream starttls) + (nnimap-inbox ("INBOX" "to.split")) + (nnimap-split-methods nnimap-split-fancy) + (nnimap-split-fancy ,nnmail-split-fancy) + (nnimap-unsplittable-articles (%Deleted))) + (nnimap "mwooding-chiark" + (nnimap-address "imap.dovecot.chiark.greenend.org.uk") + (nnimap-stream starttls) + (nnimap-inbox "INBOX") + (nnimap-unsplittable-articles (%Deleted))) + (nnimap "google" + (nnimap-address "imap.gmail.com") + (nnimap-stream tls) + (nnimap-inbox "INBOX") + (nnimap-unsplittable-articles (%Deleted))))) + +;; Send sent mail back to me. +(setq gnus-message-archive-method "mail" + gnus-gcc-mark-as-read t + gnus-message-archive-group "nnimap+distorted:mail.sent") ;;;----- That's all, folks --------------------------------------------------