Aaron Roydhouse wrote:
>
> Tom> Sometimes I get mail from someone with a loargish CC: list.  I
> Tom> already have the sender in my BBDB, but I want to automatically
> Tom> put all of the CC: addresses into the BBDB.
>
> Your suggestion prompted me to think of another possible feature. It
> would be useful, when viewing a message sent to many recipients, to be
> able to query bbdb for any records for all the recipients, not just
> the sender. Essentially roll over the to and cc lines pulling records
> in the bbdb buffer.

bbdb-show-all-recipients does that; but I don't know whether that's something
I added before or after 1.50.  I'll do another release one of these days,
really.

        == Jamie

(defun bbdb-show-all-recipients ()
  "*Display BBDB records for all recipients of the message in this buffer."
  (interactive)
  (let ((marker (bbdb-header-start))
        addrs)
    (message "Searching...")
    (save-excursion
      (set-buffer (marker-buffer marker))
      (goto-char marker)
      (setq addrs
            (append
             (save-excursion
               (bbdb-split (or (bbdb-extract-field-value "from") "") ","))
             (save-excursion
               (bbdb-split (or (bbdb-extract-field-value "to") "") ","))
             (save-excursion
               (bbdb-split (or (bbdb-extract-field-value "cc") "") ","))
             (save-excursion
               (bbdb-split (or (bbdb-extract-field-value "bcc") "") ",")))))
    (let ((rest addrs)
          (records '())
          record)
      (while rest
        (setq record (bbdb-annotate-message-sender (car rest) t t t))
        (if record (setq records (cons record records)))
        (setq rest (cdr rest)))
      (message "Sorting...")
      (setq records (sort records '(lambda (x y) (bbdb-record-lessp x y))))
      (bbdb-display-records records))))

Reply via email to