Mercurial > dovecot > core-2.2
changeset 10338:d7e946e3c0c4 HEAD
mail_cache_register_fields(): Update caching decisions from input fields.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 16 Nov 2009 19:59:41 -0500 |
parents | 69c2aa08cf2c |
children | 278d4da53141 |
files | src/lib-index/mail-cache-fields.c src/lib-index/mail-cache.h |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-cache-fields.c Mon Nov 16 19:38:13 2009 -0500 +++ b/src/lib-index/mail-cache-fields.c Mon Nov 16 19:59:41 2009 -0500 @@ -69,6 +69,7 @@ struct mail_cache_field *fields, unsigned int fields_count) { + struct mail_cache_field *orig_field; void *orig_key, *orig_value; char *name; unsigned int new_idx; @@ -83,6 +84,11 @@ fields[i].idx = POINTER_CAST_TO(orig_value, unsigned int); + + orig_field = &cache->fields[fields[i].idx].field; + if (orig_field->decision == MAIL_CACHE_DECISION_NO) + orig_field->decision = fields[i].decision; + (void)field_type_verify(cache, fields[i].idx, fields[i].type, fields[i].field_size);
--- a/src/lib-index/mail-cache.h Mon Nov 16 19:38:13 2009 -0500 +++ b/src/lib-index/mail-cache.h Mon Nov 16 19:59:41 2009 -0500 @@ -44,7 +44,9 @@ struct mail_cache *mail_cache_create(struct mail_index *index); void mail_cache_free(struct mail_cache **cache); -/* Register fields. fields[].idx is updated to contain field index. */ +/* Register fields. fields[].idx is updated to contain field index. + If field already exists and its caching decision is NO, the decision is + updated to the input field's decision. */ void mail_cache_register_fields(struct mail_cache *cache, struct mail_cache_field *fields, unsigned int fields_count);