Aldo Valente <[EMAIL PROTECTED]> says:

> One of the reasons i get really upset about Spam is that i am forced
> to delete some Spammerpigs from my BBDB manually every day.

I have a reasonably painless way of dealing with these; I have a
keybinding which merges them into a single spammer record.


      (defconst pcp-bbdb-spam-record "ZZZspam" 
        "The name of the BBDB record for auto-spam-refiling 
      using \\[pcp-bbdb-refile-spam].")

      (defun pcp-bbdb-refile-spam (old-record)
        "Merge the current BBDB record silently into `pcp-bbdb-spam-record', 
      discarding the name of the original even if `bbdb-use-alternate-names' 
      is set, and saving the bbdb."
        (interactive (list (bbdb-current-record)))
        (bbdb-records)                  ; make sure database is loaded
        (set-buffer bbdb-buffer-name)
        (bbdb-record-set-firstname old-record nil)
        (bbdb-record-set-lastname old-record nil)
        (bbdb-record-set-namecache old-record nil)
        (bbdb-refile-record old-record 
                            (bbdb-search-simple pcp-bbdb-spam-record nil))
        (bbdb-record-set-deleted-p old-record t)
        (bbdb-save-db))

      (defun pcp-bbdb/rmail-zap-spam ()
        "Merges the BBDB record corresponding to the current message silently 
      into `pcp-bbdb-spam-record'."
        (interactive)
        (let ((record (bbdb/rmail-update-record t)))
          (if record
              (pcp-bbdb-refile-spam record))))

      ;; bindings for BBDB and Rmail modes
      (define-key bbdb-mode-map  [(z)]  'pcp-bbdb-refile-spam)
      (add-hook 
       'rmail-mode-hook 
       '(lambda () 
          (progn
            (define-key rmail-summary-mode-map [(z)] 'pcp-bbdb/rmail-zap-spam)
            (define-key rmail-mode-map [(z)]  'pcp-bbdb/rmail-zap-spam)))
       t)


One advantage of keeping the addresses in a special record is that it
makes it immediately clear when you get repeat spam from the same
sender.  The BBDB copes quite happily with hundreds and hundreds of
addresses in a single record, although making sure it's the last in
the file might help.

Can anyone tell me a more elegant way of doing the refiling, or spot
any problem with my implementation?  Just sometimes (infrequently
enough that I have yet to characterise the exact conditions under
which it happens), I get a "nasty nasty deleted record nasty" error,
which is presumably a problem with the cache; quitting and restarting
the BBDB gets rid of it.

Patrick


_______________________________________________
bbdb-info mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/bbdb-info

Reply via email to