The following patch allows bbdb-pgp.el to be configured to use
message.el MML tags to perform the signing and encryption, instead of
only plain Mailcrypt which is not MIME-aware.
--- bbdb-pgp.el.orig 2002-10-18 01:03:15.000000000 +0000
+++ bbdb-pgp.el 2002-10-18 04:48:36.000000000 +0000
@@ -105,6 +105,13 @@
If this field's value in a record is \"encrypt\" then messages are
encrypted. If it is \"sign\" then messages are signed.")
+(defvar bbdb/pgp-method 'mailcrypt
+ "*How to sign or encrypt messages.
+'mailcrypt means use Mailcrypt.
+'mml-pgp means add MML tags for Message to use old PGP format
+'mml-pgpmime means add MML tags for Message to use PGP/MIME
+'mml-smime means add MML tags for Message to use S/MIME")
+
(defvar bbdb/pgp-default-action nil
"*Default action when sending a message and the recipient is not in BBDB.
nil means do nothing.
@@ -118,6 +125,36 @@
(bbdb-record-getprop record bbdb/pgp-field))))
pgp))
+(defun bbdb/pgp-sign ()
+ "Sign a message.
+bbdb/pgp-method controls the method used."
+ (cond
+ ((eq bbdb/pgp-method 'mailcrypt)
+ (mc-sign 0))
+ ((eq bbdb/pgp-method 'mml-pgp)
+ (mml-secure-message-sign-pgp))
+ ((eq bbdb/pgp-method 'mml-pgpmime)
+ (mml-secure-message-sign-pgpmime))
+ ((eq bbdb/pgp-method 'mml-smime)
+ (mml-secure-message-sign-smime))
+ (t
+ (error 'invalid-state "bbdb/pgp-method"))))
+
+(defun bbdb/pgp-encrypt ()
+ "Encrypt and sign a message.
+bbdb/pgp-method controls the method used."
+ (cond
+ ((eq bbdb/pgp-method 'mailcrypt)
+ (mc-encrypt 0))
+ ((eq bbdb/pgp-method 'mml-pgp)
+ (mml-secure-message-encrypt-pgp))
+ ((eq bbdb/pgp-method 'mml-pgpmime)
+ (mml-secure-message-encrypt-pgpmime))
+ ((eq bbdb/pgp-method 'mml-smime)
+ (mml-secure-message-encrypt-smime))
+ (t
+ (error 'invalid-state "bbdb/pgp-method"))))
+
(defun bbdb/pgp-hook-fun ()
"Function to be added to message-send-hook
Uses PGP to encrypt messages to users marked in the BBDB with the
@@ -137,19 +174,19 @@
(let ((pgp-p (bbdb/pgp-get-pgp (car address) (car (cdr address)))))
(cond
((string= "encrypt" pgp-p)
- (and (y-or-n-p "Encrypt message ? ")
- (mc-encrypt 0)))
+ (and (y-or-n-p "Encrypt message? ")
+ (bbdb/pgp-encrypt)))
((string= "sign" pgp-p)
- (and (y-or-n-p "Sign message ? ")
- (mc-sign 0)))
+ (and (y-or-n-p "Sign message? ")
+ (bbdb/pgp-sign)))
(t
(cond
((eq bbdb/pgp-default-action 'encrypt)
- (and (y-or-n-p "Encrypt message ? ")
- (mc-encrypt 0)))
+ (and (y-or-n-p "Encrypt message? ")
+ (bbdb/pgp-encrypt)))
((eq bbdb/pgp-default-action 'sign)
- (and (y-or-n-p "Sign message ? ")
- (mc-sign 0)))
+ (and (y-or-n-p "Sign message? ")
+ (bbdb/pgp-sign)))
(t
nil))))))))))
--
Shields.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/