From: Timo Sirainen Date: Thu, 17 Sep 2020 10:09:54 +0000 (+0300) Subject: lib-storage: Rename mail_attachment_detection_options=add-flags-on-save to add-flags X-Git-Tag: 2.3.13~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fa7052a5d9cd65d779d45b422b0f2c3b581fbe2;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Rename mail_attachment_detection_options=add-flags-on-save to add-flags Keep add-flags-on-save for backwards compatibility. --- diff --git a/doc/example-config/conf.d/10-mail.conf b/doc/example-config/conf.d/10-mail.conf index 41b4a5e66c..de48f92d18 100644 --- a/doc/example-config/conf.d/10-mail.conf +++ b/doc/example-config/conf.d/10-mail.conf @@ -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). diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index 428f5c58d9..830dca558a 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -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; diff --git a/src/lib-storage/mail-storage-settings.c b/src/lib-storage/mail-storage-settings.c index 8853fa182b..da22fb386c 100644 --- a/src/lib-storage/mail-storage-settings.c +++ b/src/lib-storage/mail-storage-settings.c @@ -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) { diff --git a/src/lib-storage/mail-storage-settings.h b/src/lib-storage/mail-storage-settings.h index 30dfcc2426..e09fe84519 100644 --- a/src/lib-storage/mail-storage-settings.h +++ b/src/lib-storage/mail-storage-settings.h @@ -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; }; diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index 3561c149a9..8ab84ce8e2 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -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);