Keep add-flags-on-save for backwards compatibility.
# 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).
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);
}
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;
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;
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) {
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;
};
/* 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);