]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Rename mail_attachment_detection_options=add-flags-on-save to add-flags
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 17 Sep 2020 10:09:54 +0000 (13:09 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 7 Oct 2020 11:43:37 +0000 (11:43 +0000)
Keep add-flags-on-save for backwards compatibility.

doc/example-config/conf.d/10-mail.conf
src/lib-storage/index/index-mail.c
src/lib-storage/mail-storage-settings.c
src/lib-storage/mail-storage-settings.h
src/lib-storage/mail-storage.c

index 41b4a5e66c98f0b43fb8473ac23be4795d62e457..de48f92d18880c24c0a74d8e476cae3cb9931cc5 100644 (file)
@@ -406,7 +406,8 @@ protocol !indexer-worker {
 # Settings to control adding $HasAttachment or $HasNoAttachment keywords.
 # By default, all MIME parts with Content-Disposition=attachment, or inlines
 # with filename parameter are consired attachments.
-#   add-flags-on-save - Add the keywords when saving new mails.
+#   add-flags - Add the keywords when saving new mails or when fetching can
+#      do it efficiently.
 #   content-type=type or !type - Include/exclude content type. Excluding will
 #     never consider the matched MIME part as attachment. Including will only
 #     negate an exclusion (e.g. content-type=!foo/* content-type=foo/bar).
index 428f5c58d9945c8595a48dd09d3a11c16a780ea9..830dca558a5812146ed1d86bc91ea857c812a5e4 100644 (file)
@@ -110,7 +110,7 @@ index_mail_want_attachment_keywords_on_fetch(struct index_mail *mail)
        const struct mail_storage_settings *mail_set =
                mailbox_get_settings(mail->mail.mail.box);
 
-       return mail_set->parsed_mail_attachment_detection_add_flags_on_save &&
+       return mail_set->parsed_mail_attachment_detection_add_flags &&
                !mail_set->parsed_mail_attachment_detection_no_flags_on_fetch &&
                !mail_has_attachment_keywords(&mail->mail.mail);
 }
@@ -1183,7 +1183,7 @@ index_mail_parse_body_finish(struct index_mail *mail,
        index_mail_body_parsed_cache_bodystructure(mail, field);
        index_mail_cache_sizes(mail);
        index_mail_cache_dates(mail);
-       if (mail_set->parsed_mail_attachment_detection_add_flags_on_save &&
+       if (mail_set->parsed_mail_attachment_detection_add_flags &&
            !mail_has_attachment_keywords(&mail->mail.mail))
                index_mail_try_set_attachment_keywords(mail);
        return 0;
@@ -1971,7 +1971,7 @@ void index_mail_update_access_parts_pre(struct mail *_mail)
           The attachment flag detection is done while parsing BODYSTRUCTURE.
           We want to do this for mails that are being saved, but also when
           we need to open the mail body anyway. */
-       if (mail_set->parsed_mail_attachment_detection_add_flags_on_save &&
+       if (mail_set->parsed_mail_attachment_detection_add_flags &&
            (_mail->saving || data->access_part != 0) &&
            !mail_has_attachment_keywords(&mail->mail.mail)) {
                data->save_bodystructure_header = TRUE;
index 8853fa182b3352be946cebfdb98f62dca186db7c..da22fb386c56d825ed7ee40d6e07045ede4b8fe9 100644 (file)
@@ -551,8 +551,9 @@ static bool mail_storage_settings_check(void *_set, pool_t pool,
                while(*options != NULL) {
                        const char *opt = *options;
 
-                       if (strcmp(opt, "add-flags-on-save") == 0) {
-                               set->parsed_mail_attachment_detection_add_flags_on_save = TRUE;
+                       if (strcmp(opt, "add-flags") == 0 ||
+                           strcmp(opt, "add-flags-on-save") == 0) {
+                               set->parsed_mail_attachment_detection_add_flags = TRUE;
                        } else if (strcmp(opt, "no-flags-on-fetch") == 0) {
                                set->parsed_mail_attachment_detection_no_flags_on_fetch = TRUE;
                        } else if (strcmp(opt, "exclude-inlined") == 0) {
index 30dfcc242603c172dde873f2ea499aad1d03cf60..e09fe84519c3cd92bd7798ce8bc667807d55c03d 100644 (file)
@@ -81,7 +81,7 @@ struct mail_storage_settings {
 
        const char *const *parsed_mail_attachment_content_type_filter;
        bool parsed_mail_attachment_exclude_inlined;
-       bool parsed_mail_attachment_detection_add_flags_on_save;
+       bool parsed_mail_attachment_detection_add_flags;
        bool parsed_mail_attachment_detection_no_flags_on_fetch;
 };
 
index 3561c149a92d32907c5bdde2da0778c6b7075910..8ab84ce8e2c0fc224b0b026e0c8afc49e862f9f3 100644 (file)
@@ -2570,7 +2570,7 @@ int mailbox_save_begin(struct mail_save_context **ctx, struct istream *input)
        /* make sure parts get parsed early on */
        const struct mail_storage_settings *mail_set =
                mailbox_get_settings(box);
-       if (mail_set->parsed_mail_attachment_detection_add_flags_on_save)
+       if (mail_set->parsed_mail_attachment_detection_add_flags)
                mail_add_temp_wanted_fields((*ctx)->dest_mail,
                                            MAIL_FETCH_MESSAGE_PARTS, NULL);