On Tuesday, June 5, 2007 at 15:26:52, Kousik Nandy wrote:
> Hi,
>
> I use %uB to display the name of the sender as per bbdb instead of
> the name sent by the user (for which I could use %f) in the
> gnus-summary-line-format. So now we use bbdb/gnus-summary-get-author
> to display the name. Pretty good, but with a little problem. When I
> open my "Sent" folder, the summary buffer displays my name as sender
> (which is right), but it'd help to know the recipient's name if *I*
> was the sender. Gnus does a nice trick, if the sender matches
> gnus-ignored-from-addresses, then it goes further, find the
> recipient's name (or newsgroup), prepend it by ->
> (gnus-summary-to-prefix, to be precise), and display it. I wonder if
> it is possible by bbdb to do the same?
The the patch below on a quick hack for this which got not
much testing ...
Robert
=== modified file 'lisp/bbdb-gnus.el'
--- lisp/bbdb-gnus.el 2007-02-21 22:46:18 +0000
+++ lisp/bbdb-gnus.el 2007-06-26 22:38:40 +0000
@@ -327,9 +327,19 @@
This function is meant to be used with the user function defined in
`bbdb/gnus-summary-user-format-letter'"
(let* ((from (mail-header-from header))
+ (to (when (and (boundp 'gnus-ignored-from-addresses)
+ gnus-ignored-from-addresses
+ (string-match gnus-ignored-from-addresses from))
+ (let* ((headers (mail-header-extra header))
+ (to (or (mail-header 'To)
+ (mail-header 'CC)
+ (mail-header 'Newsgroups))))
+ (if (and to (listp to))
+ (cdr (car to))
+ to))))
(data (and bbdb/gnus-summary-show-bbdb-names
(condition-case nil
- (mail-extract-address-components from)
+ (mail-extract-address-components (or to from))
(error nil))))
(name (car data))
(net (car (cdr data)))
@@ -339,27 +349,31 @@
(if (and net bbdb-canonicalize-net-hook)
(bbdb-canonicalize-address net)
net)))))
+
(if (and record name (member (downcase name) (bbdb-record-net record)))
- ;; bogon!
- (setq record nil))
+ ;; bogon!
+ (setq record nil))
(setq name
- (or (and bbdb/gnus-summary-prefer-bbdb-data
- (or (and bbdb/gnus-summary-prefer-real-names
- (and record (bbdb-record-name record)))
- (and record (bbdb-record-net record)
- (nth 0 (bbdb-record-net record)))))
- (and bbdb/gnus-summary-prefer-real-names
- (or (and (equal bbdb/gnus-summary-prefer-real-names 'bbdb)
- net)
- name))
- net from "**UNKNOWN**"))
- (format "%s%s"
- (or (and record bbdb/gnus-summary-mark-known-posters
- (or (bbdb-record-getprop
- record bbdb-message-marker-field)
- bbdb/gnus-summary-known-poster-mark))
- " ")
- name)))
+ (or (and bbdb/gnus-summary-prefer-bbdb-data
+ (or (and bbdb/gnus-summary-prefer-real-names
+ (and record (bbdb-record-name record)))
+ (and record (bbdb-record-net record)
+ (nth 0 (bbdb-record-net record)))))
+ (and bbdb/gnus-summary-prefer-real-names
+ (or (and (equal bbdb/gnus-summary-prefer-real-names 'bbdb)
+ net)
+ name))
+ net from "**UNKNOWN**"))
+ (format "%s%s%s"
+ (if (and to (boundp 'gnus-summary-to-prefix)
gnus-summary-to-prefix)
+ gnus-summary-to-prefix
+ "")
+ (or (and record bbdb/gnus-summary-mark-known-posters
+ (or (bbdb-record-getprop
+ record bbdb-message-marker-field)
+ bbdb/gnus-summary-known-poster-mark))
+ " ")
+ name)))
;; DEBUG: (bbdb/gnus-summary-author-in-bbdb "From: [EMAIL PROTECTED]")
(defun bbdb/gnus-summary-author-in-bbdb (header)
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/