On Sat, 21 Jun 2003, [EMAIL PROTECTED] muttered
drunkenly:
> I've got bbdb (2.35) set up to notice posters to some newsgroups and as a
> result of some spam in gnu.emacs.help I've just noticed the following two
> entries in my .bbdb
> 
> fbilxx - -= Belgacom Usenet Service =-
>             net: [EMAIL PROTECTED]
>      newsgroups: alt.binaries.erotica.amateur.female
> nevuej - -= Belgacom Usenet Service =-
>             net: [EMAIL PROTECTED]
>      newsgroups: japan.sukisuki.seifuku
> 
> It looks as if bbdb uses the first newsgroup to fill in the newsgroups
> line, I'd prefer it if it were to use the current group? or does it not
> know the group name?

Is there something in bbdb to do this automatically? I have

(defun nix-gnus-newsgroup-name (field)
  "Get the current newsgroup name."
  gnus-newsgroup-name)

(setq bbdb-auto-notes-alist `(("Newsgroups" (".*" newsgroups 
nix-gnus-newsgroup-name))))

(defun nix-bbdb-refile-newsgroups-unique-commafied (string1 string2)
  "Merge two newsgroups lists together, eliminating common entries."
  (let ((first-newsgroup-list (split-string string1 "[, ]+"))
        (second-newsgroup-list (split-string string2 "[, ]+")))
    (set 'first-newsgroup-list
                 (append first-newsgroup-list
                         (mapcar (lambda (el) (if (find el first-newsgroup-list :test 
'equal)
                                                  nil el))
                         second-newsgroup-list)))
    (mapconcat 'identity (remove* nil first-newsgroup-list) ", ")))

(setq bbdb-refile-notes-generate-alist
      (append bbdb-refile-notes-generate-alist
              '((newsgroups . nix-bbdb-refile-newsgroups-unique-commafied))))

(add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook)

and it does just as you suggested.

(Well, actually, my code is more complex --- see
<http://www.esperi.demon.co.uk/nix/xemacs/personal/init-messages-modes.html> ---
but this is a reasonable simplification of it.)

-- 
`It is an unfortunate coincidence that the date locarchive.h was
 written (in hex) matches Ritchie's birthday (in octal).'
               -- Roland McGrath on the libc-alpha list


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to