I had left a bug in there which caused mail to not get handled
properly.

Here's the diff to Fabian Penso's version.

Thanks!
Jack.
-- 
Jack Twilley
jmt at twilley dot org
http colon slash slash www dot twilley dot org slash tilde jmt slash
115a116,120
> (defvar bbdb/pgp-ask t
>   "*Flag to determine whether or not to ask to sign or encrypt.
> nil         means don't ask.
> t           means ask.")
> 
135,136c140,143
<       (let* ((to-field (mail-fetch-field "To" nil t))
< 	     (address (mail-extract-address-components (or to-field ""))))
---
>       (let* ((to-field (message-fetch-field "to"))
> 	     (ngpair (cons (message-fetch-field "newsgroups") '(nil)))
> 	     (address (mail-extract-address-components (or to-field "")))
> 	     (target (if (equal ngpair '(nil nil)) address ngpair)))
138,140c145,146
< 	;if
< 	(if (not (equal address '(nil nil)))
< 	    (let ((pgp-p (bbdb/pgp-get-pgp (car address) (car (cdr address)))))
---
> 	(if (not (equal target '(nil nil)))
> 	    (let ((pgp-p (bbdb/pgp-get-pgp (car target) (car (cdr target)))))
142c148
< 
---
> 	       
144,145c150,152
< 		(and (y-or-n-p "Encrypt message (body) ? ")
< 		     (mml-secure-encrypt-pgp)))
---
> 		(if (or (not bbdb/pgp-ask)
> 			(y-or-n-p "Encrypt message (body) ? "))
> 		    (mml-secure-message-encrypt-pgp)))
147,148c154,156
< 		(and (y-or-n-p "Encrypt message ? ")
< 		     (mml-secure-encrypt-pgpmime)))
---
> 		(if (or (not bbdb/pgp-ask)
> 			(y-or-n-p "Encrypt message ? "))
> 		    (mml-secure-message-encrypt-pgpmime)))
151,152c159,161
< 		(and (y-or-n-p "Sign message (body) ? ")
< 		     (mml-secure-sign-pgp)))
---
> 		(if (or (not bbdb/pgp-ask)
> 			(y-or-n-p "Sign message (body) ? "))
> 		    (mml-secure-message-sign-pgp)))
154,180c163,191
< 		(and (y-or-n-p "Sign message ? ")
< 		     (mml-secure-sign-pgpmime)))
< 
< 	       (t
< 		(if (or (not (boundp 'bbdb-dont-default))
< 			     (not bbdb-dont-default))
< 
< 		    (cond
< 		     ((eq bbdb/pgp-default-action 'sencrypt)
< 		      (and (y-or-n-p "Encrypt message (body) ? ")
< 			   (mml-secure-encrypt-pgp)))
< 		     ((eq bbdb/pgp-default-action 'encrypt)
< 		      (and (y-or-n-p "Encrypt message ? ")
< 			   (mml-secure-encrypt-pgpmime)))
< 		     ((eq bbdb/pgp-default-action 'ssign)
< 		      (and (y-or-n-p "Sign message (body) ? ")
< 			   (mml-secure-sign-pgp)))
< 
< 		     ((eq bbdb/pgp-default-action 'sign)
< 		      (and (or (not (or (not (boundp 'bbdb-force-default))
< 				    (not bbdb-force-default)))
< 			       (y-or-n-p "Sign message ? "))
< 
< 			   (if (message-news-p)
< 			       (mml-secure-sign-pgp)
< 			     (mml-secure-sign-pgpmime))
< 			   ))
---
> 		(if (or (not bbdb/pgp-ask)
> 			(y-or-n-p "Sign message ? "))
> 		    (mml-secure-message-sign-pgpmime)))
> 
> 	       ((string= "none" pgp-p)
> 		nil)
> 
> 	       (t  ;; anything else, or no field at all
> 
> 		(cond
> 		 ((eq bbdb/pgp-default-action 'sencrypt)
> 		  (if (or (not bbdb/pgp-ask)
> 			  (y-or-n-p "Encrypt message (body) ? "))
> 		      (mml-secure-message-encrypt-pgp)))
> 		 ((eq bbdb/pgp-default-action 'encrypt)
> 		  (if (or (not bbdb/pgp-ask)
> 			  (y-or-n-p "Encrypt message ? "))
> 		      (mml-secure-message-encrypt-pgpmime)))
> 		 ((eq bbdb/pgp-default-action 'ssign)
> 		  (if (or (not bbdb/pgp-ask)
> 			  (y-or-n-p "Sign message (body) ? "))
> 		      (mml-secure-message-sign-pgp)))
> 	       
> 		 ((eq bbdb/pgp-default-action 'sign)
> 		  (if (or (not bbdb/pgp-ask)
> 			  (y-or-n-p "Sign message ? "))
> 		      (if (message-news-p)
> 			  (mml-secure-message-sign-pgp)
> 			(mml-secure-message-sign-pgpmime))))
182,185c193,195
< 		  nil))) )))
< 		)
< 	
< 	))))
---
> 		  nil)
> 		 ))))
> 	  )))))

Attachment: msg02825/pgp00000.pgp
Description: PGP signature

Reply via email to