]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mail_cache_register_fields(): Update caching decisions from input fields.
authorTimo Sirainen <tss@iki.fi>
Tue, 17 Nov 2009 00:59:41 +0000 (19:59 -0500)
committerTimo Sirainen <tss@iki.fi>
Tue, 17 Nov 2009 00:59:41 +0000 (19:59 -0500)
--HG--
branch : HEAD

src/lib-index/mail-cache-fields.c
src/lib-index/mail-cache.h

index 0687eb4e3b4047794db35a5072e9dbab5b27dee2..1d7f9b6fd066dfc45441dd44223922a9ec8cc607 100644 (file)
@@ -69,6 +69,7 @@ void mail_cache_register_fields(struct mail_cache *cache,
                                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 @@ void mail_cache_register_fields(struct mail_cache *cache,
 
                        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);
index 46d9239bfcc86b7f4b6a00f527c3dc0c8d587784..21e3303a1c27d89b419c7cc010c2324902996a6d 100644 (file)
@@ -44,7 +44,9 @@ struct mail_cache *mail_cache_open_or_create(struct mail_index *index);
 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);