Here's something off the internet that I've been using with gnus to
automatically encrypt email based on a contact's S/MIME certificate, the
path to that certificate being stored in a 'certfile field in their
BBDB record. It doesn't work now, with the CVS version of BBDB. I know
"bbdb-search-simple" will have to be switched to bbdb-search, but
"bbdb-get-field" doesn't seem to exist anymore, and also this function
returns "name must be atomic" before it even gets to that point. I
assume that's because it's trying to find certfiles for all of "To" "Cc"
and "From"? I tried stepping through with the debugger, but I'm not
particularly good at using the debugger, and didn't have the patience,
whacking "d" over and over again, to get to where the error was raised.
Any advice?

#+begin_src lisp
(defun DE-get-certificate-files-from-bbdb () 
  (let ((certfiles nil))
    (save-excursion
      (save-restriction
        (message-narrow-to-headers-or-head)
        (let ((names (remq nil (mapcar 'message-fetch-field '("To" "Cc" 
"From")))))
          (mapc (function (lambda (arg)
                            (let ((rec (bbdb-search-simple nil (cdr arg))))
                              (when rec
                                (let ((cert (bbdb-get-field rec 'certfile)))
                                  (when (and (> (length cert) 0) (not (member 
cert certfiles)))
                                    (push cert certfiles)(push 'certfile 
certfiles)))))))
              (mail-extract-address-components (mapconcat 'identity names ",") 
t)))
        (if (y-or-n-p (concat (mapconcat 'file-name-nondirectory (remq 
'certfile certfiles) ", ") ".  Add more certificates? "))
            (nconc (mml-smime-encrypt-query) certfiles)
          certfiles)))))
#+end_src


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to