]> git.siccegge.de Git - dotfiles/emacs.git/blob - gnus.el
89cb4a67a7e08a1c8d785e580f7aaad7cb8a8e05
[dotfiles/emacs.git] / gnus.el
1 (require 'epa)
2 ;(require 'external-abook)
3 ;(setq external-abook-command "pc_query -m '%s' | cut -f 1,2")
4 (require 'bbdb)
5 (bbdb-initialize 'gnus)
6 (require 'gnus)
7
8 (eval-after-load "message"
9 '(progn
10 (add-to-list 'message-mode-hook
11 '(lambda ()
12 (define-key message-mode-map "\C-c\t" 'external-abook-try-expand)))))
13 (require 'epa-file)
14 (epa-file-enable)
15 (setq epg-debug t)
16
17 (setq mm-decrypt-option 'always)
18 (setq mm-verify-option 'always)
19 (setq mml-smime-use 'epg)
20
21 (setq message-send-mail-function 'message-send-mail-with-sendmail)
22 (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
23
24 (gnus-demon-add-handler 'gnus-demon-scan-news 5 t)
25 (gnus-demon-init)
26
27 ;(setq bbdb-ignore-some-messages-alist '(("To" . "admins@sieglitzhof.net")))
28
29 (setq user-mail-address "christoph@christoph-egger.org"
30 user-full-name "Christoph Egger"
31 mm-verify-option 'known
32 mm-decrypt-option 'known
33 gnus-buttonized-mime-types '("multipart/signed" "multipart/encrypted")
34 gnus-select-method '(nntp "news.gmane.org")
35 mail-user-agent 'sendmail-user-agent)
36 ; bbdb-send-mail-style 'message)
37
38 (add-hook 'kill-emacs-hook (lambda () (let ((gnus-interactive-exit nil)) (gnus-group-exit))))
39
40 (setq-default gnus-group-line-format "%P%M%S%m %4U/%-5y:%B%(%g%)\n"
41 gnus-sum-thread-tree-false-root ""
42 gnus-sum-thread-tree-indent " "
43 gnus-sum-thread-tree-leaf-with-other "├► "
44 gnus-sum-thread-tree-root ""
45 gnus-sum-thread-tree-single-leaf "╰► "
46 gnus-sum-thread-tree-vertical "│")
47
48
49 (setq gnus-secondary-select-methods '((nnimap "Main"
50 (nnimap-address "oteiza.siccegge.de")
51 (nnimap-authenticator login)
52 (nnimap-stream tls)
53 (nnimap-logout-timeout 5.0)
54 (nnimap-authinfo-file "/home/christoph/.imap-authinfo"))
55 ;; (nnimap "UCSB"
56 ;; (nnimap-address "mail.engr.ucsb.edu")
57 ;; (nnimap-authenticator plain)
58 ;; (nnimap-stream tls))
59 (nntp "USENET"
60 (nntp-address "news.eternal-september.org")
61 (nntp-authenticator plain)
62 (nntp-stream ssl))))
63
64 (setq gnus-posting-styles
65 '((".*"
66 (organization "Privat")
67 ("Gcc" "nnimap+Main:SENT")
68 (address "christoph@christoph-egger.org"))
69 ("debian.*"
70 (orgainzation "The Debian Project")
71 (address "christoph@debian.org"))
72 ("sh.*"
73 (orgainzation "Studentenwohnheim Sieglitzhof Netzteam")
74 (address "christoph@sieglitzhof.net"))
75 ("uni.ucsb"
76 (address "siccegge@cs.fau.de"))
77 ("fsi.*"
78 (organization "Fachschaft Informatik, FAU Erlangen-Nürnberg")
79 (address "siccegge@cip.cs.fau.de")
80 ("reply-to" "fsi@cs.fau.de")
81 ("cc" "fsi@cs.fau.de")
82 (signature-file "~/.signature.fsi"))
83 ("fsi.kif.orga"
84 (organization "Fachschaft Informatik, FAU Erlangen-Nürnberg")
85 (address "siccegge@cip.cs.fau.de")
86 ("reply-to" "kif415-orga@fsi.cs.fau.de")
87 ("cc" "kif415-orga@fsi.cs.fau.de")
88 (signature-file "~/.signature.fsi"))))
89
90 (mml-signencrypt-style "pgpmime" 'combined)
91
92 (setq gnus-extra-headers '(To Cc Newsgroups Keywords List-Id Message-Id)
93 nnmail-extra-headers gnus-extra-headers)
94
95 (require 'mm-url)
96 (defadvice mm-url-insert (after DE-convert-atom-to-rss () )
97 "Converts atom to RSS by calling xsltproc."
98 (when (re-search-forward "xmlns=\"http://www.w3.org/.*/Atom\""
99 nil t)
100 (goto-char (point-min))
101 (message "Converting Atom to RSS... ")
102 (call-process-region (point-min) (point-max)
103 "xsltproc"
104 t t nil
105 (expand-file-name "~/atom2rss.xsl") "-")
106 (goto-char (point-min))
107 (message "Converting Atom to RSS... done")))
108
109 (ad-activate 'mm-url-insert)
110
111 (defun my-crm114-learn ()
112 (interactive)
113 (unless (gnus-buffer-live-p gnus-article-buffer)
114 (error "No article buffer available"))
115 (save-excursion
116 (set-buffer gnus-article-buffer)
117 (save-restriction
118 (let ((commandsplit (split-string "ssh oteiza.siccegge.de /usr/share/crm114/mailreaver.crm -u /home/christoph/.crm114/"))
119 (outbuf (get-buffer-create "*crm114 output*"))
120 (spamflag (y-or-n-p "Is this spam? ")))
121 (gnus-summary-toggle-header 1)
122 (message-narrow-to-headers-or-head)
123 (unless (re-search-forward "^X-CRM114-CacheID:" nil t)
124 (error "No CRM144-CacheID header found"))
125 (nconc commandsplit
126 (if spamflag
127 '("--spam")
128 '("--good")))
129 (beginning-of-line)
130 (if (zerop (apply 'call-process-region
131 (point) (progn (end-of-line) (point))
132 (car commandsplit) nil outbuf
133 nil (cdr commandsplit)))
134 (progn
135 (set-buffer outbuf)
136 (goto-char (point-max))
137 (re-search-backward "^X-CRM114-Action: \\(.*\\)" nil t)
138 (message (match-string 1))
139 (erase-buffer))
140 (error "Calling crm failed"))))))
141
142 (define-key gnus-summary-mode-map
143 (kbd "C-M-s") 'my-crm114-learn)
144
145 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)