if (file->storage->attachment_dir == NULL) {
mail_storage_set_critical(&file->storage->storage,
"%s contains references to external attachments, "
- "but mail_attachment_dir is unset", file->cur_path);
+ "but mail_ext_attachment_path is unset",
+ file->cur_path);
return -1;
}
const struct mail_storage_settings *set = _storage->set;
const char *error;
- if (*set->mail_attachment_dir != '\0') {
+ if (*set->mail_ext_attachment_path != '\0') {
const char *dir;
int ret;
dir = mail_user_home_expand(_storage->user,
- set->mail_attachment_dir);
+ set->mail_ext_attachment_path);
storage->attachment_dir = p_strdup(_storage->pool, dir);
struct event *event = event_create(_storage->event);
event_set_ptr(event, SETTINGS_EVENT_FILTER_NAME,
- "mail_attachment");
+ "mail_ext_attachment");
ret = mailbox_list_init_fs(ns->list, event,
storage->attachment_dir,
&storage->attachment_fs, &error);
event_unref(&event);
if (ret == 0) {
- *error_r = "mail_attachment_dir is set, "
- "but mail_attachment { fs_driver } is missing";
+ *error_r = "mail_ext_attachment_path is set, "
+ "but mail_ext_attachment { fs_driver } is missing";
return -1;
}
if (ret < 0) {
- *error_r = t_strdup_printf("mail_attachment: %s",
+ *error_r = t_strdup_printf("mail_ext_attachment: %s",
error);
return -1;
}
dest_storage->attachment_dir) != 0 ||
strcmp(fs_get_driver(src_storage->attachment_fs),
fs_get_driver(dest_storage->attachment_fs)) != 0 ||
- strcmp(src_storage->storage.set->mail_attachment_hash,
- dest_storage->storage.set->mail_attachment_hash) != 0) {
+ strcmp(src_storage->storage.set->mail_ext_attachment_hash,
+ dest_storage->storage.set->mail_ext_attachment_hash) != 0) {
/* different attachment dirs/settings between storages.
have to copy the slow way. */
return 0;
if (storage->attachment_fs != NULL) {
props = fs_get_properties(storage->attachment_fs);
if ((props & FS_PROPERTY_RENAME) == 0) {
- *error_r = "mail_attachment: "
+ *error_r = "mail_ext_attachment: "
"FS driver doesn't support renaming";
return -1;
}
ARRAY_TYPE(mail_attachment_extref) extrefs;
};
-static const char *index_attachment_dir_get(struct mail_storage *storage)
-{
- return mail_user_home_expand(storage->user,
- storage->set->mail_attachment_dir);
-}
-
static bool index_attachment_want(const struct istream_attachment_header *hdr,
void *context)
{
struct mail_storage *storage = ctx->transaction->box->storage;
struct mail_attachment_extref *extref;
enum fs_open_flags flags = 0;
- const char *attachment_dir, *path, *digest = info->hash;
+ const char *path, *digest = info->hash;
guid_128_t guid_128;
i_assert(attach->cur_file == NULL);
}
guid_128_generate(guid_128);
- attachment_dir = index_attachment_dir_get(storage);
- path = t_strdup_printf("%s/%c%c/%c%c/%s-%s", attachment_dir,
+ path = t_strdup_printf("%s/%c%c/%c%c/%s-%s",
+ storage->set->mail_ext_attachment_path,
digest[0], digest[1],
digest[2], digest[3], digest,
guid_128_to_string(guid_128));
extref = array_append_space(&attach->extrefs);
extref->start_offset = info->start_offset;
extref->size = info->encoded_size;
- extref->path = p_strdup(attach->pool,
- path + strlen(attachment_dir) + 1);
+ extref->path = p_strdup(attach->pool, path +
+ strlen(storage->set->mail_ext_attachment_path) + 1);
extref->base64_blocks_per_line = info->base64_blocks_per_line;
extref->base64_have_crlf = info->base64_have_crlf;
i_assert(ctx->data.attach == NULL);
- if (*storage->set->mail_attachment_dir == '\0')
+ if (*storage->set->mail_ext_attachment_path == '\0')
return;
i_zero(&set);
- set.min_size = storage->set->mail_attachment_min_size;
- if (hash_format_init(storage->set->mail_attachment_hash,
+ set.min_size = storage->set->mail_ext_attachment_min_size;
+ if (hash_format_init(storage->set->mail_ext_attachment_hash,
&set.hash_format, &error) < 0) {
/* we already checked this when verifying settings */
i_panic("mail_attachment_hash=%s unexpectedly failed: %s",
- storage->set->mail_attachment_hash, error);
+ storage->set->mail_ext_attachment_hash, error);
}
set.want_attachment = index_attachment_want;
set.open_temp_fd = index_attachment_open_temp_fd;
const char *path;
int ret;
- path = t_strdup_printf("%s/%s", index_attachment_dir_get(storage), name);
+ path = t_strdup_printf("%s/%s", storage->set->mail_ext_attachment_path, name);
file = fs_file_init(fs, path, FS_OPEN_MODE_READONLY);
if ((ret = fs_delete(file)) < 0)
mail_storage_set_critical(storage, "%s", fs_file_last_error(file));
{ .type = SET_FILTER_NAME, .key = "layout_maildir++" },
{ .type = SET_FILTER_NAME, .key = "layout_imapdir" },
{ .type = SET_FILTER_NAME, .key = "layout_fs" },
- { .type = SET_FILTER_NAME, .key = "mail_attachment",
+ { .type = SET_FILTER_NAME, .key = "mail_ext_attachment",
.required_setting = "fs_driver", },
- DEF(STR, mail_attachment_dir),
- DEF(STR_NOVARS_HIDDEN, mail_attachment_hash),
- DEF(SIZE, mail_attachment_min_size),
+ DEF(STR, mail_ext_attachment_path),
+ DEF(STR_NOVARS_HIDDEN, mail_ext_attachment_hash),
+ DEF(SIZE, mail_ext_attachment_min_size),
DEF(STR, mail_attachment_detection_options),
{ .type = SET_FILTER_NAME, .key = "mail_attribute",
.required_setting = "dict_driver", },
};
const struct mail_storage_settings mail_storage_default_settings = {
- .mail_attachment_dir = "",
- .mail_attachment_hash = "%{sha1}",
- .mail_attachment_min_size = 1024*128,
+ .mail_ext_attachment_path = "",
+ .mail_ext_attachment_hash = "%{sha1}",
+ .mail_ext_attachment_min_size = 1024*128,
.mail_attachment_detection_options = "",
.mail_prefetch_count = 0,
.mail_cache_fields = "flags",
return FALSE;
}
- if (strchr(set->mail_attachment_hash, '/') != NULL) {
+ if (strchr(set->mail_ext_attachment_hash, '/') != NULL) {
*error_r = "mail_attachment_hash setting "
"must not contain '/' characters";
return FALSE;
}
- if (hash_format_init(set->mail_attachment_hash, &format, &error) < 0) {
+ if (hash_format_init(set->mail_ext_attachment_hash,
+ &format, &error) < 0) {
*error_r = t_strconcat("Invalid mail_attachment_hash setting: ",
error, NULL);
return FALSE;
}
- if (strchr(set->mail_attachment_hash, '-') != NULL) {
+ if (strchr(set->mail_ext_attachment_hash, '-') != NULL) {
*error_r = "mail_attachment_hash setting "
"must not contain '-' characters";
return FALSE;
struct mail_storage_settings {
pool_t pool;
const char *mail_driver;
- const char *mail_attachment_dir;
- const char *mail_attachment_hash;
- uoff_t mail_attachment_min_size;
+ const char *mail_ext_attachment_path;
+ const char *mail_ext_attachment_hash;
+ uoff_t mail_ext_attachment_min_size;
unsigned int mail_prefetch_count;
const char *mail_cache_fields;
const char *mail_always_cache_fields;