On Mon, 21 Jul 2003 13:26:58 +0100 Ronan Waide wrote:

Ronan> On July 20, [EMAIL PROTECTED] said:

>> There is bbdb-pgp.el in bbdb/bits. I use a slightly modified version
>> (i.e. no mailcrypt required, configurable to ask less questions...).
>> 
>> I am not sure how the "no-mailcrypt" issue should be handled
>> correctly. Once it is, I would like to see it updated in bbdb cvs.

Ronan> Feel free to contribute a patch; if nothing else, it'll be kept
Ronan> in the mailing list archive for people to look at.

Attached.

Greetings,
Jochen
-- 
FOM-Institute for Plasma Physics "Rijnhuizen" + Fritz-Haber-Institut der MPG
Postbus 1207                                                  Faradayweg 4-6
NL-3430 BE Nieuwegein                                         D-14195 Berlin
The Netherlands                                                      Germany

phone: +31-30-6096756                                        +49-30-84135686
fax: +31-30-6031204                                      GnuPG key: CC1B0B4D
? autom4te.cache
? testing/Makefile
Index: bits/bbdb-pgp.el
===================================================================
RCS file: /cvsroot/bbdb/bbdb/bits/bbdb-pgp.el,v
retrieving revision 1.3
diff -u -u -r1.3 bbdb-pgp.el
--- bits/bbdb-pgp.el	20 Oct 2002 18:03:42 -0000	1.3
+++ bits/bbdb-pgp.el	24 Jul 2003 20:54:21 -0000
@@ -101,10 +107,10 @@
 
 (require 'message)
 (require 'bbdb)
-(require 'mailcrypt)
+(condition-case nil (require 'mailcrypt) (error nil))
 
-(defconst bbdb/pgp-version (substring "$Revision: 1.3 $" 11 -2)
-  "$Id: bbdb-pgp.el,v 1.3 2002/10/20 18:03:42 waider Exp $
+(defconst bbdb/pgp-version (substring "$Revision: 1.5 $" 11 -2)
+  "$Id: bbdb-pgp.el,v 1.5 2003/07/14 18:46:14 jochen Exp $
 
 Report bugs to: Kevin Davidson [EMAIL PROTECTED]")
 
@@ -153,6 +159,17 @@
   :tag "Default Action"
   :group 'bbdb-utilities-pgp)
 
+(defcustom bbdb/pgp-quite nil
+  "*Do not ask for confirmation on pgp-action.
+
+nil         means normal messages/questions.
+'t          means to be quite."
+  :type '(choice
+	  (const :tag "normal")
+	  (const :tag "quite" t))
+  :tag "Quiteness"
+  :group 'bbdb-utilities-pgp)
+
 (defun bbdb/pgp-get-pgp (name address)
   "Look up user NAME and ADDRESS in BBDB and return the PGP preference."
   (let* ((record (bbdb-search-simple name address))
@@ -209,11 +226,13 @@
 	    (let ((pgp-p (bbdb/pgp-get-pgp (car address) (car (cdr address)))))
 	      (cond
 	       ((string= "encrypt" pgp-p) 
-		(and (y-or-n-p "Encrypt message? ")
-		     (bbdb/pgp-encrypt)))
+                (and (or bbdb/pgp-quite
+                         (y-or-n-p "Encrypt message? "))
+                     (bbdb/pgp-encrypt)))
 	       ((string= "sign" pgp-p)
-		(and (y-or-n-p "Sign message? ")
-		     (bbdb/pgp-sign)))
+		(and (or bbdb/pgp-quite
+                         (y-or-n-p "Encrypt message? "))
+                     (bbdb/pgp-sign)))
 	       (t
 		(cond
 		 ((eq bbdb/pgp-default-action 'encrypt)
Index: ChangeLog
===================================================================
RCS file: /cvsroot/bbdb/bbdb/ChangeLog,v
retrieving revision 2.170
diff -u -u -r2.170 ChangeLog
--- ChangeLog	24 Jul 2003 09:43:38 -0000	2.170
+++ ChangeLog	24 Jul 2003 20:58:31 -0000
@@ -1,3 +1,9 @@
+2003-07-24  Jochen Küpper  <[EMAIL PROTECTED]>
+
+	* bits/bbdb-pgp.el: No error if mailcrypt isn't available.
+	(bbdb/pgp-quite): Added.
+	(bbdb/pgp-hook-fun): Be quite if bbdb/pgp-quite is set.
+
 2003-07-24  Robert Fenk  <Robert Fenk>
 
 	* lisp/bbdb-com.el (bbdb-send-mail-internal): 

Reply via email to