Changes committed gnus/lisp (ChangeLog gnus-nocem.el)

"Katsumi Yamaoka" <[email protected]> Wed, 18 Feb 2009 08:17:40 +0100
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog gnus-nocem.el

(gnus-nocem-groups): Remove invalid NoCeM groups.
(gnus-nocem-issuers): List currently active issuers; fix custom type.
(gnus-nocem-verifyer): Default to gnus-nocem-epg-verify.
(gnus-nocem-epg-verify): New function.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1986 gnus/lisp/ChangeLog:7.1987
--- ChangeLog:7.1986	Mon Feb 16 00:40:13 2009
+++ ChangeLog	Wed Feb 18 08:17:39 2009
@@ -1,3 +1,10 @@
+2009-02-18  Katsumi Yamaoka  <[email protected]>
+
+	* gnus-nocem.el (gnus-nocem-groups): Remove invalid NoCeM groups.
+	(gnus-nocem-issuers): List currently active issuers; fix custom type.
+	(gnus-nocem-verifyer): Default to gnus-nocem-epg-verify.
+	(gnus-nocem-epg-verify): New function.
+
 2009-02-15  Reiner Steib  <[email protected]>
 
 	* gnus-art.el (gnus-button-alist): Recognize Konqueror info links.
Index: gnus-nocem.el
diff -u gnus/lisp/gnus-nocem.el:7.16 gnus/lisp/gnus-nocem.el:7.17
--- gnus-nocem.el:7.16	Thu Jan 22 08:02:16 2009
+++ gnus-nocem.el	Wed Feb 18 08:17:39 2009
@@ -38,18 +38,21 @@
   :group 'gnus-score)
 
 (defcustom gnus-nocem-groups
-  '("news.lists.filters" "news.admin.net-abuse.bulletins"
-    "alt.nocem.misc" "news.admin.net-abuse.announce")
+  '("news.lists.filters" "alt.nocem.misc")
   "*List of groups that will be searched for NoCeM messages."
   :group 'gnus-nocem
+  :version "23.1"
   :type '(repeat (string :tag "Group")))
 
 (defcustom gnus-nocem-issuers
-  '("AutoMoose-1"			; CancelMoose[tm]
-    "[email protected]"		; Chris Lewis
-    "cosmo.roadkill"
-    "SpamHippo"
-    "[email protected]")
+  '("Adri Verhoef"
+    "[email protected]"
+    "[email protected]"
+    "[email protected]"
+    "[email protected]"
+    "[email protected]"
+    "[email protected]"
+    "[email protected]")
   "*List of NoCeM issuers to pay attention to.
 
 This can also be a list of `(ISSUER CONDITION ...)' elements.
@@ -58,7 +61,34 @@
 issuer registry."
   :group 'gnus-nocem
   :link '(url-link "http://www.xs4all.nl/~rosalind/nocemreg/nocemreg.html")
-  :type '(repeat (choice string sexp)))
+  :version "23.1"
+  :type '(repeat (cons :format "%v" (string :tag "Issuer")
+		       (repeat :tag "Condition"
+			       (group (checklist :inline t (const not))
+				      (regexp :tag "Type" :value ".*")))))
+  :get (lambda (symbol)
+	 (mapcar (lambda (elem)
+		   (if (consp elem)
+		       (cons (car elem)
+			     (mapcar (lambda (elt)
+				       (if (consp elt) elt (list elt)))
+				     (cdr elem)))
+		     (list elem)))
+		 (default-value symbol)))
+  :set (lambda (symbol value)
+	 (custom-set-default
+	  symbol
+	  (mapcar (lambda (elem)
+		    (if (consp elem)
+			(if (cdr elem)
+			    (mapcar (lambda (elt)
+				      (if (consp elt)
+					  (if (cdr elt) elt (car elt))
+					elt))
+				    elem)
+			  (car elem))
+		      elem))
+		  value))))
 
 (defcustom gnus-nocem-directory
   (nnheader-concat gnus-article-save-directory "NoCeM/")
@@ -71,12 +101,14 @@
   :group 'gnus-nocem
   :type 'integer)
 
-(defcustom gnus-nocem-verifyer 'pgg-verify
+(defcustom gnus-nocem-verifyer 'gnus-nocem-epg-verify
   "*Function called to verify that the NoCeM message is valid.
-One likely value is `pgg-verify'.  If the function in this variable
-isn't bound, the message will be used unconditionally."
+One likely value is `gnus-nocem-epg-verify'.  If the function in this
+variable isn't bound, the message will be used unconditionally."
   :group 'gnus-nocem
-  :type '(radio (function-item pgg-verify)
+  :version "23.1"
+  :type '(radio (function-item gnus-nocem-epg-verify)
+		(function-item pgg-verify)
 		(function-item mc-verify)
 		(function :tag "other")))
 
@@ -392,6 +424,21 @@
   (and gnus-nocem-hashtb
        (gethash id gnus-nocem-hashtb)))
 
+(autoload 'epg-make-context "epg")
+(eval-when-compile
+  (autoload 'epg-verify-string "epg")
+  (autoload 'epg-context-result-for "epg")
+  (autoload 'epg-signature-status "epg"))
+
+(defun gnus-nocem-epg-verify ()
+  "Return t if EasyPG verifies a signed message in the current buffer."
+  (let ((context (epg-make-context 'OpenPGP))
+	result)
+    (epg-verify-string context (buffer-string))
+    (and (setq result (epg-context-result-for context 'verify))
+	 (not (cdr result))
+	 (eq (epg-signature-status (car result)) 'good))))
+
 (provide 'gnus-nocem)
 
 ;; arch-tag: 0e0c74ea-2f8e-4f3e-8fff-09f767c1adef