comparison lisp/gnus/gnus-nocem.el @ 90199:bb71c6cf2009

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-67 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 447-458) - Update from CVS - Update from CVS: lisp/subr.el (add-to-ordered-list): Doc fix. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 83-85) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 30 Jun 2005 00:31:46 +0000
parents cce1c0ee76ee e903f947651d
children f9a65d7ebd29
comparison
equal deleted inserted replaced
90198:97f6c3a96df1 90199:bb71c6cf2009
1 ;;; gnus-nocem.el --- NoCeM pseudo-cancellation treatment 1 ;;; gnus-nocem.el --- NoCeM pseudo-cancellation treatment
2 2
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2004 3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2004, 2005
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 6
7 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 7 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; Keywords: news 8 ;; Keywords: news
72 (defcustom gnus-nocem-expiry-wait 15 72 (defcustom gnus-nocem-expiry-wait 15
73 "*Number of days to keep NoCeM headers in the cache." 73 "*Number of days to keep NoCeM headers in the cache."
74 :group 'gnus-nocem 74 :group 'gnus-nocem
75 :type 'integer) 75 :type 'integer)
76 76
77 (defcustom gnus-nocem-verifyer 'mc-verify 77 (defcustom gnus-nocem-verifyer 'pgg-verify
78 "*Function called to verify that the NoCeM message is valid. 78 "*Function called to verify that the NoCeM message is valid.
79 One likely value is `mc-verify'. If the function in this variable 79 One likely value is `pgg-verify'. If the function in this variable
80 isn't bound, the message will be used unconditionally." 80 isn't bound, the message will be used unconditionally."
81 :group 'gnus-nocem 81 :group 'gnus-nocem
82 :type '(radio (function-item mc-verify) 82 :type '(radio (function-item pgg-verify)
83 (function-item mc-verify)
83 (function :tag "other"))) 84 (function :tag "other")))
84 85
85 (defcustom gnus-nocem-liberal-fetch nil 86 (defcustom gnus-nocem-liberal-fetch nil
86 "*If t try to fetch all messages which have @@NCM in the subject. 87 "*If t try to fetch all messages which have @@NCM in the subject.
87 Otherwise don't fetch messages which have references or whose message-id 88 Otherwise don't fetch messages which have references or whose message-id
244 (when (and (setq b (search-forward "\n@@BEGIN NCM HEADERS\n" nil t)) 245 (when (and (setq b (search-forward "\n@@BEGIN NCM HEADERS\n" nil t))
245 (setq e (search-forward "\n@@BEGIN NCM BODY\n" nil t))) 246 (setq e (search-forward "\n@@BEGIN NCM BODY\n" nil t)))
246 ;; We get the name of the issuer. 247 ;; We get the name of the issuer.
247 (narrow-to-region b e) 248 (narrow-to-region b e)
248 (setq issuer (mail-fetch-field "issuer") 249 (setq issuer (mail-fetch-field "issuer")
249 type (mail-fetch-field "issuer")) 250 type (mail-fetch-field "type"))
250 (widen) 251 (widen)
251 (if (not (gnus-nocem-message-wanted-p issuer type)) 252 (if (not (gnus-nocem-message-wanted-p issuer type))
252 (message "invalid NoCeM issuer: %s" issuer) 253 (message "invalid NoCeM issuer: %s" issuer)
253 (and (gnus-nocem-verify-issuer issuer) ; She is who she says she is. 254 (and (gnus-nocem-verify-issuer issuer) ; She is who she says she is.
254 (gnus-nocem-enter-article) ; We gobble the message. 255 (gnus-nocem-enter-article) ; We gobble the message.
265 ((setq conditions (cdr (assoc issuer issuers))) 266 ((setq conditions (cdr (assoc issuer issuers)))
266 ;; Check whether we want this type. 267 ;; Check whether we want this type.
267 (while (setq condition (pop conditions)) 268 (while (setq condition (pop conditions))
268 (cond 269 (cond
269 ((stringp condition) 270 ((stringp condition)
270 (setq wanted (string-match condition type))) 271 (when (string-match condition type)
272 (setq wanted t)))
271 ((and (consp condition) 273 ((and (consp condition)
272 (eq (car condition) 'not) 274 (eq (car condition) 'not)
273 (stringp (cadr condition))) 275 (stringp (cadr condition)))
274 (setq wanted (not (string-match (cadr condition) type)))) 276 (when (string-match (cadr condition) type)
277 (setq wanted nil)))
275 (t 278 (t
276 (error "Invalid NoCeM condition: %S" condition)))) 279 (error "Invalid NoCeM condition: %S" condition))))
277 wanted)))) 280 wanted))))
278 281
279 (defun gnus-nocem-verify-issuer (person) 282 (defun gnus-nocem-verify-issuer (person)
280 "Verify using PGP that the canceler is who she says she is." 283 "Verify using PGP that the canceler is who she says she is."
281 (if (fboundp gnus-nocem-verifyer) 284 (if (functionp gnus-nocem-verifyer)
282 (ignore-errors 285 (ignore-errors
283 (funcall gnus-nocem-verifyer)) 286 (funcall gnus-nocem-verifyer))
284 ;; If we don't have Mailcrypt, then we use the message anyway. 287 ;; If we don't have Mailcrypt, then we use the message anyway.
285 t)) 288 t))
286 289
313 ;; Valid group. 316 ;; Valid group.
314 (beginning-of-line) 317 (beginning-of-line)
315 (while (eq (char-after) ?\t) 318 (while (eq (char-after) ?\t)
316 (forward-line -1)) 319 (forward-line -1))
317 (setq id (buffer-substring (point) (1- (search-forward "\t")))) 320 (setq id (buffer-substring (point) (1- (search-forward "\t"))))
318 (unless (gnus-gethash id gnus-nocem-hashtb) 321 (unless (if gnus-nocem-hashtb
322 (gnus-gethash id gnus-nocem-hashtb)
323 (setq gnus-nocem-hashtb (gnus-make-hashtable))
324 nil)
319 ;; only store if not already present 325 ;; only store if not already present
320 (gnus-sethash id t gnus-nocem-hashtb) 326 (gnus-sethash id t gnus-nocem-hashtb)
321 (push id ncm)) 327 (push id ncm))
322 (forward-line 1) 328 (forward-line 1)
323 (while (eq (char-after) ?\t) 329 (while (eq (char-after) ?\t)