[cvs] bogofilter/src register.c,1.32,1.33
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2004-05-30 14:39:02
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6975 Modified Files: register.c Log Message: Fixed registration. When multiple wordlists are specified, registration is to first regular wordlist. Index: register.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/register.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- register.c 25 May 2004 04:07:22 -0000 1.32 +++ register.c 30 May 2004 14:38:52 -0000 1.33 @@ -31,7 +31,9 @@ u_int32_t g = 0, b = 0; u_int32_t wordcount = h->count; /* use number of unique tokens */ - wordlist_t *list; + dsv_t val; + wordlist_t *list = word_list; /* use default wordlist for registration */ + sh_t incr = IX_UNDF, decr = IX_UNDF; /* If update directory explicity supplied, setup the wordlists. */ @@ -61,9 +63,9 @@ for (node = wordhash_first(h); node != NULL; node = wordhash_next(h)) { - dsv_t val; + wordprop = node->buf; - ds_read(word_list->dsh, node->key, &val); + ds_read(list->dsh, node->key, &val); if (incr != IX_UNDF) { u_int32_t *counts = val.count; counts[incr] += wordprop->freq; @@ -72,18 +74,9 @@ u_int32_t *counts = val.count; counts[decr] = ((long)counts[decr] < wordprop->freq) ? 0 : counts[decr] - wordprop->freq; } - ds_write(word_list->dsh, node->key, &val); + ds_write(list->dsh, node->key, &val); } - for (list = word_lists; list != NULL; list = list->next) - { - dsv_t val; - - /* - if (!list->active) - continue; - */ - ds_get_msgcounts(list->dsh, &val); list->msgcount[IX_SPAM] = val.spamcount; list->msgcount[IX_GOOD] = val.goodcount; @@ -111,7 +104,6 @@ if (DEBUG_REGISTER(1)) (void)fprintf(dbgout, "bogofilter: list %s (%s) - %ul spam, %ul good\n", list->listname, list->filepath, list->msgcount[IX_SPAM], list->msgcount[IX_GOOD]); - } set_msg_counts(g, b); |