1 |
;;; gnus-nocem.el --- NoCeM pseudo-cancellation treatment |
;;; gnus-nocem.el --- NoCeM pseudo-cancellation treatment |
2 |
|
|
3 |
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2004 |
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2004, 2005 |
4 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
|
|
74 |
:group 'gnus-nocem |
:group 'gnus-nocem |
75 |
:type 'integer) |
:type 'integer) |
76 |
|
|
77 |
(defcustom gnus-nocem-verifyer 'mc-verify |
(defcustom gnus-nocem-verifyer 'pgg-verify |
78 |
"*Function called to verify that the NoCeM message is valid. |
"*Function called to verify that the NoCeM message is valid. |
79 |
One likely value is `mc-verify'. If the function in this variable |
One likely value is `pgg-verify'. If the function in this variable |
80 |
isn't bound, the message will be used unconditionally." |
isn't bound, the message will be used unconditionally." |
81 |
:group 'gnus-nocem |
:group 'gnus-nocem |
82 |
:type '(radio (function-item mc-verify) |
:type '(radio (function-item pgg-verify) |
83 |
|
(function-item mc-verify) |
84 |
(function :tag "other"))) |
(function :tag "other"))) |
85 |
|
|
86 |
(defcustom gnus-nocem-liberal-fetch nil |
(defcustom gnus-nocem-liberal-fetch nil |
247 |
;; We get the name of the issuer. |
;; We get the name of the issuer. |
248 |
(narrow-to-region b e) |
(narrow-to-region b e) |
249 |
(setq issuer (mail-fetch-field "issuer") |
(setq issuer (mail-fetch-field "issuer") |
250 |
type (mail-fetch-field "issuer")) |
type (mail-fetch-field "type")) |
251 |
(widen) |
(widen) |
252 |
(if (not (gnus-nocem-message-wanted-p issuer type)) |
(if (not (gnus-nocem-message-wanted-p issuer type)) |
253 |
(message "invalid NoCeM issuer: %s" issuer) |
(message "invalid NoCeM issuer: %s" issuer) |
268 |
(while (setq condition (pop conditions)) |
(while (setq condition (pop conditions)) |
269 |
(cond |
(cond |
270 |
((stringp condition) |
((stringp condition) |
271 |
(setq wanted (string-match condition type))) |
(when (string-match condition type) |
272 |
|
(setq wanted t))) |
273 |
((and (consp condition) |
((and (consp condition) |
274 |
(eq (car condition) 'not) |
(eq (car condition) 'not) |
275 |
(stringp (cadr condition))) |
(stringp (cadr condition))) |
276 |
(setq wanted (not (string-match (cadr condition) type)))) |
(when (string-match (cadr condition) type) |
277 |
|
(setq wanted nil))) |
278 |
(t |
(t |
279 |
(error "Invalid NoCeM condition: %S" condition)))) |
(error "Invalid NoCeM condition: %S" condition)))) |
280 |
wanted)))) |
wanted)))) |
281 |
|
|
282 |
(defun gnus-nocem-verify-issuer (person) |
(defun gnus-nocem-verify-issuer (person) |
283 |
"Verify using PGP that the canceler is who she says she is." |
"Verify using PGP that the canceler is who she says she is." |
284 |
(if (fboundp gnus-nocem-verifyer) |
(if (functionp gnus-nocem-verifyer) |
285 |
(ignore-errors |
(ignore-errors |
286 |
(funcall gnus-nocem-verifyer)) |
(funcall gnus-nocem-verifyer)) |
287 |
;; If we don't have Mailcrypt, then we use the message anyway. |
;; If we don't have Mailcrypt, then we use the message anyway. |
318 |
(while (eq (char-after) ?\t) |
(while (eq (char-after) ?\t) |
319 |
(forward-line -1)) |
(forward-line -1)) |
320 |
(setq id (buffer-substring (point) (1- (search-forward "\t")))) |
(setq id (buffer-substring (point) (1- (search-forward "\t")))) |
321 |
(unless (gnus-gethash id gnus-nocem-hashtb) |
(unless (if gnus-nocem-hashtb |
322 |
|
(gnus-gethash id gnus-nocem-hashtb) |
323 |
|
(setq gnus-nocem-hashtb (gnus-make-hashtable)) |
324 |
|
nil) |
325 |
;; only store if not already present |
;; only store if not already present |
326 |
(gnus-sethash id t gnus-nocem-hashtb) |
(gnus-sethash id t gnus-nocem-hashtb) |
327 |
(push id ncm)) |
(push id ncm)) |