On 7 Apr 2001, Jack Twilley wrote:

> >>>>> "Andrew" == Andrew J Cosgriff <Andrew> writes:
> 
> Jack> Now, I know there's a way to set bbdb such that I don't get
> Jack> asked any more about djb@*.scream.org if I set net to
> Jack> [EMAIL PROTECTED] but I can't see how.  That's not the bug,
> Jack> although if someone would like to mention how, I'd really
> Jack> appreciate it.
> 
> Andrew> I think you just need to (setq
> Andrew> bbdb-canonicalize-redundant-nets-p t) - I was about to dump my
> Andrew> bbdb-canonicalize-net-hook on you when I noticed this in the
> Andrew> manual...
> 
> I have bbdb-canonicalize-redundant-nets-p set to t.  No such luck.

I've had problems with bbdb-canonicalize-redundant-nets-p as well; I think
I've seen it work under some circumstances, but it didn't do well enough
for me, so I also use the following to trim extra components off for
particular groups of email addresses (great for groups where someone's
email address often depends on what machine the email originates from).

(setq pdf-bbdb-domain-name-list
      '(
        "cs.washington.edu"
        "transmeta.com"
        "sr.hp.com"
        "hpl.hp.com"
        "cs.cmu.edu"
        "cs.virginia.edu"
        "cs.ucdavis.edu"))
(setq pdf-bbdb-default-domain-name (car pdf-bbdb-domain-name-list))

(setq bbdb-canonicalize-net-hook 'pdf-bbdb-canonicalize-net)
                                        ;This is not a true hook

(defun pdf-bbdb-canonicalize-net (addr)
  "Make local addresses be in our domain; strip off extraneous machine names."

  (let ((dom-list pdf-bbdb-domain-name-list))
    (while dom-list
      (if (string-match (concat "^\\(.*\\)@.*\\."
                                (regexp-quote (car dom-list)) "$")
                        addr)
          (setq addr (concat (substring addr (match-beginning 1) (match-end 1))
                             "@"
                             (car dom-list))))
      (setq dom-list (cdr dom-list))))
  
  (if (string-match "@.*\\." addr)
      addr
    (string-match "^[^@]*" addr)
    (concat (substring addr (match-beginning 0) (match-end 0))
            "@"
            pdf-bbdb-default-domain-name))))



_______________________________________________
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to