diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-06-28 19:07:26 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-06-28 19:07:26 +0400 |
commit | b3c36d4946f675619b81c9223f5ac1a86c55c55c (patch) | |
tree | 6cdd79cae18ce387f6c00f8ce23aef65b4a5c02b /src/statfile.c | |
parent | 0e6a4235b1794a61d12fcde33cffaf8dd83c51f0 (diff) | |
download | rspamd-b3c36d4946f675619b81c9223f5ac1a86c55c55c.tar.gz rspamd-b3c36d4946f675619b81c9223f5ac1a86c55c55c.zip |
* Add correcting factor to statistics.
Now learning increments version of a statfile.
Avoid learning and classifying of similar text parts if a message has 2 text parts.
Several fixes to statistics.
Diffstat (limited to 'src/statfile.c')
-rw-r--r-- | src/statfile.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/statfile.c b/src/statfile.c index 0359c0c4d..65da15033 100644 --- a/src/statfile.c +++ b/src/statfile.c @@ -789,6 +789,22 @@ statfile_set_revision (stat_file_t *file, guint64 rev, time_t time) } gboolean +statfile_inc_revision (stat_file_t *file) +{ + struct stat_file_header *header; + + if (file == NULL || file->map == NULL) { + return FALSE; + } + + header = (struct stat_file_header *)file->map; + + header->revision ++; + + return TRUE; +} + +gboolean statfile_get_revision (stat_file_t *file, guint64 *rev, time_t *time) { struct stat_file_header *header; @@ -799,8 +815,12 @@ statfile_get_revision (stat_file_t *file, guint64 *rev, time_t *time) header = (struct stat_file_header *)file->map; - *rev = header->revision; - *time = header->rev_time; + if (rev != NULL) { + *rev = header->revision; + } + if (time != NULL) { + *time = header->rev_time; + } return TRUE; } |