Appended is the code I use to interface Supercite and BBDB.  I
originally sent this to the Supercite list (somewhat arbitrarily), but
I've been informed that it is rather low-volume, and perhaps more
people on the BBDB list would be interested.

Here's how I install it:

* Add "bbdb-attribution" to sc-preferred-attribution-list.  I add it
  after "x-attribution".

* (add-hook 'sc-attribs-preselect-hook 'bbdb/supercite)

* Put an "attribution" field in the BBDB record of anyone whose
  attribution you want to set.

Tom
---
[EMAIL PROTECTED]             Member, League for Programming Freedom
Let no one tell me that silence gives consent, because whoever is
silent dissents.
        -- Maria Isabel Barreno

(defun bbdb/supercite ()
  "Extract citing information from BBDB."
  (let ((from (sc-mail-field "from"))
        attr
        record)
    (if (or (null from)
            (string-match (bbdb-user-mail-names)
                          ;; mail-strip-quoted-names is too broken!
                          ;;(mail-strip-quoted-names from)
                          (car (cdr (mail-extract-address-components
                                     from)))))
        ;; if logged in user sent this, use recipients.
        (setq from (or (sc-mail-field "to") from)))
    (if from
        (setq record (bbdb-annotate-message-sender from t nil nil)))
    (setq attr (and record
                    (bbdb-record-getprop record 'attribution)))
    (and attr
         (setq sc-attributions
               (cons (cons "bbdb-attribution" attr) sc-attributions)))))

Reply via email to