Hi people.

I don't remember if I sent this already. Here is a patch so bbdb-pgp.el
use mml-* function instead of mailcrypt. Works perfect for Oort
0.05/Gnus.

You can choose between inline or MIME sign/encrypt as explained at the
beginning of the code.

Might help.

Attachment: msg02691/pgp00000.pgp
Description: PGP signature

--- /home/penso/bbdb/bits/bbdb-pgp.el	Wed Jan 24 22:19:08 2001
+++ .elisp/bbdb-pgp.el	Thu Jan 24 17:43:26 2002
@@ -8,6 +8,17 @@
 ;; Version: $Revision: 1.1 $
 ;; Keywords: PGP BBDB message mailcrypt
 
+;; Modified by fabien penso <[EMAIL PROTECTED]>
+;;
+;; bbdb-dont-default: t or nil 
+;;    don't do the default
+;; bbdb/pgp-default-action: sencrypt, encrypt, ssign, sign
+;;    Default to use. 's' in front means inline instead of MIME
+;; bbdb-force-default: t or nil
+;;    Force the default without asking the user
+;;
+;; It will use inline instead of MIME by default for usenet messages.
+;;
  
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -93,7 +104,6 @@
 
 (require 'message)
 (require 'bbdb)
-(require 'mailcrypt)
 
 (defconst bbdb/pgp-version (substring "$Revision: 1.1 $" 11 -2)
   "$Id: bbdb-pgp.el,v 1.1 2001/01/24 21:19:08 waider Exp $
@@ -133,25 +143,54 @@
       (let* ((to-field (mail-fetch-field "To" nil t))
 	     (address (mail-extract-address-components (or to-field ""))))
 	(widen)
+	;if
 	(if (not (equal address '(nil nil)))
 	    (let ((pgp-p (bbdb/pgp-get-pgp (car address) (car (cdr address)))))
 	      (cond
+
+	       ((string= "sencrypt" pgp-p) 
+		(and (y-or-n-p "Encrypt message (body) ? ")
+		     (mml-secure-encrypt-pgp)))
 	       ((string= "encrypt" pgp-p) 
 		(and (y-or-n-p "Encrypt message ? ")
-		     (mc-encrypt 0)))
+		     (mml-secure-encrypt-pgpmime)))
+
+	       ((string= "ssign" pgp-p)
+		(and (y-or-n-p "Sign message (body) ? ")
+		     (mml-secure-sign-pgp)))
 	       ((string= "sign" pgp-p)
 		(and (y-or-n-p "Sign message ? ")
-		     (mc-sign 0)))
+		     (mml-secure-sign-pgpmime)))
+
 	       (t
-		(cond
-		 ((eq bbdb/pgp-default-action 'encrypt)
-		  (and (y-or-n-p "Encrypt message ? ")
-		       (mc-encrypt 0)))
-		 ((eq bbdb/pgp-default-action 'sign)
-		  (and (y-or-n-p "Sign message ? ")
-		       (mc-sign 0)))
+		(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))
+			   ))
 		 (t
-		  nil))))))))))
+		  nil))) )))
+		)
+	
+	))))
 
 (add-hook 'message-send-hook 'bbdb/pgp-hook-fun)
 (add-hook 'mail-send-hook 'bbdb/pgp-hook-fun)


-- 
Fabien Penso <[EMAIL PROTECTED]> | LinuxFr a toujours besoin de :
http://perso.LinuxFR.org/penso/  | http://linuxfr.org/dons/

Reply via email to