On Mon, 21 Jun 2004, Michael Richardson stipulated:
> I want to then do a LRU algorithm to clear out my .bbdb. Anyone I
> haven't talked to in a year gets purged.

In bbdb-expire, set `bbdb-expire-this-old' to 365 (assuming that
`bbdb-expire-record-old-p' is on the `bbdb-expire-expiry-functions'
list, which is the default).

(bbdb-expire lets you use, well, whatever algorithm you like, or
a combination of them: several are provided, mostly on the LRU
principle, but not all. Sometimes I consider adding LFU, but I've
not done that yet.)

>                                          Also, anyone whose
> creation-date==timestamp (i.e. I heard from them once) was likely a
> spammer that I added inadvertedly.

That's an interesting algorithm. You probably also want the constraint
that the user must be at least, ooh, a week old, otherwise you'd have
trouble adding new records at all.

It's tricky, actually: the default BBDB date format is too
low-resolution to indicate hits reasonably by comparing
creation-dates. The two simplest methods that spring to mind are to
create a hit counter for each record, or to create a tag on record
creation that's updated by the timestamp-access code and erased by it
on the second access.

This is in priciple quite easy to do, but it's thrown off by the way the
bbdb-notice-hook is called. It's called from
`bbdb-annotate-message-sender', which is called from
`bbdb-update-records' once for each relevant address: so it could
perfectly well be called multiple times for a single record in a single
display; so you can't safely stick something on that hook that's not
idempotent.

This is, IMHO, a bug in BBDB: if a record has a dozen addresses on it and
all dozen match some email you just read, the bbdb-notice-hook should
still only be called once for that message.


I've just released
<http://www.esperi.demon.co.uk/nix/downloads/bbdb-expire-1.7.tar.gz>,
with a workaround for this bug, the feature you asked for (which I think
is nifty too), and some other non-user-visible changes: handle with
care, may have bugs (although I've been using it for a few hours and it
seems to be OK).


The zap-single-hit stuff is turned off by default to avoid surprising
existing users: to turn it on, run

(add-hook bbdb-expire-initialize-hook 
'bbdb-expire-initialize-bbdb-expire-record-single-hit-p)
(add-hook bbdb-expire-expiry-functions 'bbdb-record-single-hit-p)

immediately after requiring bbdb-expire and before calling
`bbdb-expire-initialize'.


(You might also find `bbdb-expire-record-noname-p' useful on the
`bbdb-expire-expiry-functions'.)

-- 
`We in no way believe that this Christ was a space alien.'
                    --- A creationist website goes completely bonkers


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to