comparison lisp/gnus/gnus-nocem.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents 4be1180a9e89
children fe104dbd9147
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
33 33
34 (defgroup gnus-nocem nil 34 (defgroup gnus-nocem nil
35 "NoCeM pseudo-cancellation treatment" 35 "NoCeM pseudo-cancellation treatment"
36 :group 'gnus-score) 36 :group 'gnus-score)
37 37
38 (defcustom gnus-nocem-groups 38 (defcustom gnus-nocem-groups
39 '("news.lists.filters" "news.admin.net-abuse.bulletins" 39 '("news.lists.filters" "news.admin.net-abuse.bulletins"
40 "alt.nocem.misc" "news.admin.net-abuse.announce") 40 "alt.nocem.misc" "news.admin.net-abuse.announce")
41 "List of groups that will be searched for NoCeM messages." 41 "List of groups that will be searched for NoCeM messages."
42 :group 'gnus-nocem 42 :group 'gnus-nocem
43 :type '(repeat (string :tag "Group"))) 43 :type '(repeat (string :tag "Group")))
44 44
45 (defcustom gnus-nocem-issuers 45 (defcustom gnus-nocem-issuers
46 '("AutoMoose-1" "Automoose-1" ; CancelMoose[tm] 46 '("AutoMoose-1" "Automoose-1" ; CancelMoose[tm]
47 "rbraver@ohww.norman.ok.us" ; Robert Braver 47 "rbraver@ohww.norman.ok.us" ; Robert Braver
48 "clewis@ferret.ocunix.on.ca;" ; Chris Lewis 48 "clewis@ferret.ocunix.on.ca;" ; Chris Lewis
49 "jem@xpat.com;" ; Despammer from Korea 49 "jem@xpat.com;" ; Despammer from Korea
50 "snowhare@xmission.com" ; Benjamin "Snowhare" Franz 50 "snowhare@xmission.com" ; Benjamin "Snowhare" Franz
52 ) 52 )
53 "List of NoCeM issuers to pay attention to." 53 "List of NoCeM issuers to pay attention to."
54 :group 'gnus-nocem 54 :group 'gnus-nocem
55 :type '(repeat string)) 55 :type '(repeat string))
56 56
57 (defcustom gnus-nocem-directory 57 (defcustom gnus-nocem-directory
58 (nnheader-concat gnus-article-save-directory "NoCeM/") 58 (nnheader-concat gnus-article-save-directory "NoCeM/")
59 "*Directory where NoCeM files will be stored." 59 "*Directory where NoCeM files will be stored."
60 :group 'gnus-nocem 60 :group 'gnus-nocem
61 :type 'directory) 61 :type 'directory)
62 62
108 (and (file-exists-p (gnus-nocem-active-file)) 108 (and (file-exists-p (gnus-nocem-active-file))
109 (not gnus-nocem-active) 109 (not gnus-nocem-active)
110 (ignore-errors 110 (ignore-errors
111 (load (gnus-nocem-active-file) t t t))) 111 (load (gnus-nocem-active-file) t t t)))
112 ;; Go through all groups and see whether new articles have 112 ;; Go through all groups and see whether new articles have
113 ;; arrived. 113 ;; arrived.
114 (while (setq group (pop groups)) 114 (while (setq group (pop groups))
115 (if (not (setq gactive (gnus-activate-group group))) 115 (if (not (setq gactive (gnus-activate-group group)))
116 () ; This group doesn't exist. 116 () ; This group doesn't exist.
117 (setq active (nth 1 (assoc group gnus-nocem-active))) 117 (setq active (nth 1 (assoc group gnus-nocem-active)))
118 (when (and (not (< (cdr gactive) (car gactive))) ; Empty group. 118 (when (and (not (< (cdr gactive) (car gactive))) ; Empty group.
124 (let ((dependencies (make-vector 10 nil)) 124 (let ((dependencies (make-vector 10 nil))
125 headers header) 125 headers header)
126 (nnheader-temp-write nil 126 (nnheader-temp-write nil
127 (setq headers 127 (setq headers
128 (if (eq 'nov 128 (if (eq 'nov
129 (gnus-retrieve-headers 129 (gnus-retrieve-headers
130 (setq articles 130 (setq articles
131 (gnus-uncompress-range 131 (gnus-uncompress-range
132 (cons 132 (cons
133 (if active (1+ (cdr active)) 133 (if active (1+ (cdr active))
134 (car gactive)) 134 (car gactive))
135 (cdr gactive)))) 135 (cdr gactive))))
136 group)) 136 group))
137 (gnus-get-newsgroup-headers-xover 137 (gnus-get-newsgroup-headers-xover
138 articles nil dependencies) 138 articles nil dependencies)
139 (gnus-get-newsgroup-headers dependencies))) 139 (gnus-get-newsgroup-headers dependencies)))
140 (while (setq header (pop headers)) 140 (while (setq header (pop headers))
141 ;; We take a closer look on all articles that have 141 ;; We take a closer look on all articles that have
142 ;; "@@NCM" in the subject. Unless we already read 142 ;; "@@NCM" in the subject. Unless we already read
165 (gnus-message 7 "Checking article %d in %s for NoCeM..." 165 (gnus-message 7 "Checking article %d in %s for NoCeM..."
166 (mail-header-number header) group) 166 (mail-header-number header) group)
167 (let ((date (mail-header-date header)) 167 (let ((date (mail-header-date header))
168 issuer b e) 168 issuer b e)
169 (when (or (not date) 169 (when (or (not date)
170 (nnmail-time-less 170 (nnmail-time-less
171 (nnmail-time-since (nnmail-date-to-time date)) 171 (nnmail-time-since (nnmail-date-to-time date))
172 (nnmail-days-to-time gnus-nocem-expiry-wait))) 172 (nnmail-days-to-time gnus-nocem-expiry-wait)))
173 (gnus-request-article-this-buffer (mail-header-number header) group) 173 (gnus-request-article-this-buffer (mail-header-number header) group)
174 (goto-char (point-min)) 174 (goto-char (point-min))
175 (when (re-search-forward "-----BEGIN PGP MESSAGE-----" nil t) 175 (when (re-search-forward "-----BEGIN PGP MESSAGE-----" nil t)
243 (defun gnus-nocem-load-cache () 243 (defun gnus-nocem-load-cache ()
244 "Load the NoCeM cache." 244 "Load the NoCeM cache."
245 (interactive) 245 (interactive)
246 (unless gnus-nocem-alist 246 (unless gnus-nocem-alist
247 ;; The buffer doesn't exist, so we create it and load the NoCeM 247 ;; The buffer doesn't exist, so we create it and load the NoCeM
248 ;; cache. 248 ;; cache.
249 (when (file-exists-p (gnus-nocem-cache-file)) 249 (when (file-exists-p (gnus-nocem-cache-file))
250 (load (gnus-nocem-cache-file) t t t) 250 (load (gnus-nocem-cache-file) t t t)
251 (gnus-nocem-alist-to-hashtb)))) 251 (gnus-nocem-alist-to-hashtb))))
252 252
253 (defun gnus-nocem-save-cache () 253 (defun gnus-nocem-save-cache ()
254 "Save the NoCeM cache." 254 "Save the NoCeM cache."
255 (when (and gnus-nocem-alist 255 (when (and gnus-nocem-alist
256 gnus-nocem-touched-alist) 256 gnus-nocem-touched-alist)
257 (nnheader-temp-write (gnus-nocem-cache-file) 257 (nnheader-temp-write (gnus-nocem-cache-file)