On Tue, 21 Jan 2003, Patrice Neff told this: > Xavier MAILLARD writes: > > > So I am :) Please gimme the tricks ;-) > > Well, dunno about the code quality, but here is the modified Nevermind the quality code :) It's tricky code ;-) > function: > (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 field bbdb-pgp-field." (save-restriction > (save-excursion (message-narrow-to-headers) (let* ((to-field > (mail-fetch-field "To" nil t)) (address > (mail-extract-address-components (or to-field "")))) (widen) (if > (not (equal address `(nil nil))) (let ((pgp-p (bbdb/pgp-get-pgp > (car address) (car (cdr address))))) (cond ((string= "encrypt" > pgp-p) (and (y-or-n-p "Encrypt message ? ") (call-interactively > 'mml-secure-encrypt-pgpmime))) ((string= "sign" pgp-p) (and > (y-or-n-p "Sign message ? ") (call-interactively > 'mml-secure-sign-pgpmime))) (t nil)))))))) Looks good to me. At least it does its job :) Thanx zeDek