Here's a patch against CVS head for a split fancy function:
"Search for bbdb records with addresses in the address-class (as per
bbdb-get-addresses-headers) of the message and who have bbdb-field
in their bbdb record. fancy Return splits for each matching record
with the bbdb-field. If the bbdb-field for that record contains
something that looks like an s-expression, it is read and returned
as an s-expression to be used as a split.
For example to reproduct bbdb/gnus-split-method's behavior put the
following in your .emacs:
(setq nnmail-split-fancy
'(| (: bbdb/gnus-split-fancy 'gnus-public 'recipients)
(: bbdb/gnus-split-fancy 'gnus-private 'authors)))"
cvs diff: Diffing lisp
Index: lisp/bbdb-com.el
===================================================================
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb-com.el,v
retrieving revision 1.174
diff -r1.174 bbdb-com.el
3616a3617,3650
> (defun bbdb-get-records-for-message
> (only-first-address
> uninteresting-senders
> get-header-content-function
> &optional address-class
> &rest get-header-content-function-args)
> "Returns the bbdb records corresponding to the addresses in the
> mesage headers possibly limited to certain headers by
> address-class."
> (let ((bbdb-get-addresses-headers
> (if address-class
> (list (assoc address-class bbdb-get-addresses-headers))
> bbdb-get-addresses-headers))
> ;; there is no case for nets
> (bbdb-case-fold-search t)
> (bbdb-records (bbdb-records)))
> (bbdb-get-records-for-addresses
> (apply 'bbdb-get-addresses
> only-first-address
> uninteresting-senders
> get-header-content-function
> get-header-content-function-args))))
>
> (defun bbdb-get-records-for-addresses (addrs)
> "Recursively assemble records for the given addresses."
> (if addrs
> (append
> (let ((net (concat "^"
> (regexp-quote
> (cadr (caddr (car addrs))))
> "$")))
> (bbdb-search bbdb-records nil nil net))
> (bbdb-get-records-for-addresses (cdr addrs)))))
>
cvs diff: cannot remove temp file /tmp/cvshRTLlW: Operation not permitted
Index: lisp/bbdb-gnus.el
===================================================================
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb-gnus.el,v
retrieving revision 1.99
diff -r1.99 bbdb-gnus.el
696a697,733
> (defun bbdb/gnus-split-fancy (bbdb-field
> &optional address-class)
> "Search for bbdb records with addresses in the address-class (as per
> bbdb-get-addresses-headers) of the message and who have bbdb-field
> in their bbdb record. fancy Return splits for each matching record
> with the bbdb-field. If the bbdb-field for that record contains
> something that looks like an s-expression, it is read and returned
> as an s-expression to be used as a split.
>
> For example to reproduct bbdb/gnus-split-method's behavior put the
> following in your .emacs:
>
> (setq nnmail-split-fancy
> '(| (: bbdb/gnus-split-fancy 'gnus-public 'recipients)
> (: bbdb/gnus-split-fancy 'gnus-private 'authors)))"
> (cons
> '&
> (bbdb/gnus-get-splits-for-records
> bbdb-field
> (bbdb-get-records-for-message
> bbdb-get-only-first-address-p
> (or (if (boundp 'gnus-ignored-from-addresses)
> gnus-ignored-from-addresses)
> bbdb-user-mail-names)
> 'gnus-fetch-field
> address-class))))
>
> (defun bbdb/gnus-get-splits-for-records (bbdb-field records)
> "Recursively retrieve splits from BBDB records."
> (if records
> (cons
> (let* ((field (bbdb-record-getprop (car records) bbdb-field))
> (sexp (if field (read field))))
> (if (symbolp sexp) field sexp))
> (bbdb/gnus-get-splits-for-records bbdb-field
> (cdr records)))))
>
cvs diff: cannot remove temp file /tmp/cvsJsj2qP: Operation not permitted
Hope someone likes this,
Ross Patterson