index-attribute.c (dovecot-2.3.16) | : | index-attribute.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
} | } | |||
attr_storage = mail_namespace_get_default_storage(ns); | attr_storage = mail_namespace_get_default_storage(ns); | |||
if (*attr_storage->set->mail_attribute_dict == '\0') { | if (*attr_storage->set->mail_attribute_dict == '\0') { | |||
mail_storage_set_error(err_storage, MAIL_ERROR_NOTPOSSIBLE, | mail_storage_set_error(err_storage, MAIL_ERROR_NOTPOSSIBLE, | |||
"Mailbox attributes not enabled"); | "Mailbox attributes not enabled"); | |||
return -1; | return -1; | |||
} | } | |||
i_zero(&dict_set); | i_zero(&dict_set); | |||
dict_set.username = user->username; | ||||
dict_set.base_dir = user->set->base_dir; | dict_set.base_dir = user->set->base_dir; | |||
dict_set.event_parent = user->event; | dict_set.event_parent = user->event; | |||
if (dict_init(attr_storage->set->mail_attribute_dict, &dict_set, | if (dict_init(attr_storage->set->mail_attribute_dict, &dict_set, | |||
&user->_attr_dict, &error) < 0) { | &user->_attr_dict, &error) < 0) { | |||
mail_storage_set_critical(err_storage, | mail_storage_set_critical(err_storage, | |||
"mail_attribute_dict: dict_init(%s) failed: %s", | "mail_attribute_dict: dict_init(%s) failed: %s", | |||
attr_storage->set->mail_attribute_dict, error); | attr_storage->set->mail_attribute_dict, error); | |||
user->attr_dict_failed = TRUE; | user->attr_dict_failed = TRUE; | |||
return -1; | return -1; | |||
} | } | |||
skipping to change at line 135 | skipping to change at line 134 | |||
mail_storage_set_error(storage, MAIL_ERROR_NOTPOSSIBLE, | mail_storage_set_error(storage, MAIL_ERROR_NOTPOSSIBLE, | |||
"Mailbox attributes not enabled"); | "Mailbox attributes not enabled"); | |||
return -1; | return -1; | |||
} | } | |||
if (storage->shared_attr_dict_failed) { | if (storage->shared_attr_dict_failed) { | |||
mail_storage_set_internal_error(storage); | mail_storage_set_internal_error(storage); | |||
return -1; | return -1; | |||
} | } | |||
i_zero(&set); | i_zero(&set); | |||
set.username = storage->user->username; | ||||
set.base_dir = storage->user->set->base_dir; | set.base_dir = storage->user->set->base_dir; | |||
set.event_parent = storage->user->event; | set.event_parent = storage->user->event; | |||
if (mail_user_get_home(storage->user, &set.home_dir) <= 0) | ||||
set.home_dir = NULL; | ||||
if (dict_init(storage->set->mail_attribute_dict, &set, | if (dict_init(storage->set->mail_attribute_dict, &set, | |||
&storage->_shared_attr_dict, &error) < 0) { | &storage->_shared_attr_dict, &error) < 0) { | |||
mail_storage_set_critical(storage, | mail_storage_set_critical(storage, | |||
"mail_attribute_dict: dict_init(%s) failed: %s", | "mail_attribute_dict: dict_init(%s) failed: %s", | |||
storage->set->mail_attribute_dict, error); | storage->set->mail_attribute_dict, error); | |||
storage->shared_attr_dict_failed = TRUE; | storage->shared_attr_dict_failed = TRUE; | |||
return -1; | return -1; | |||
} | } | |||
*dict_r = storage->_shared_attr_dict; | *dict_r = storage->_shared_attr_dict; | |||
return 0; | return 0; | |||
skipping to change at line 206 | skipping to change at line 202 | |||
&metadata) < 0) | &metadata) < 0) | |||
return -1; | return -1; | |||
*mailbox_prefix_r = guid_128_to_string(metadata.guid); | *mailbox_prefix_r = guid_128_to_string(metadata.guid); | |||
*dtrans_r = *dtransp; | *dtrans_r = *dtransp; | |||
return 0; | return 0; | |||
} | } | |||
if (index_storage_get_dict(t->box, type_flags, &dict, mailbox_prefix_r) < 0) | if (index_storage_get_dict(t->box, type_flags, &dict, mailbox_prefix_r) < 0) | |||
return -1; | return -1; | |||
i_assert(*dtransp == NULL); | i_assert(*dtransp == NULL); | |||
*dtransp = *dtrans_r = dict_transaction_begin(dict); | ||||
struct mail_user *user = mailbox_list_get_user(t->box->list); | ||||
const struct dict_op_settings *set = mail_user_get_dict_op_settings(user) | ||||
; | ||||
*dtransp = *dtrans_r = dict_transaction_begin(dict, set); | ||||
return 0; | return 0; | |||
} | } | |||
int index_storage_attribute_set(struct mailbox_transaction_context *t, | int index_storage_attribute_set(struct mailbox_transaction_context *t, | |||
enum mail_attribute_type type_flags, | enum mail_attribute_type type_flags, | |||
const char *key, | const char *key, | |||
const struct mail_attribute_value *value) | const struct mail_attribute_value *value) | |||
{ | { | |||
enum mail_attribute_type type = type_flags & MAIL_ATTRIBUTE_TYPE_MASK; | enum mail_attribute_type type = type_flags & MAIL_ATTRIBUTE_TYPE_MASK; | |||
struct dict_transaction_context *dtrans; | struct dict_transaction_context *dtrans; | |||
skipping to change at line 260 | skipping to change at line 259 | |||
{ | { | |||
struct dict *dict; | struct dict *dict; | |||
const char *mailbox_prefix, *error; | const char *mailbox_prefix, *error; | |||
int ret; | int ret; | |||
i_zero(value_r); | i_zero(value_r); | |||
if (index_storage_get_dict(box, type_flags, &dict, &mailbox_prefix) < 0) | if (index_storage_get_dict(box, type_flags, &dict, &mailbox_prefix) < 0) | |||
return -1; | return -1; | |||
ret = dict_lookup(dict, pool_datastack_create(), | struct mail_user *user = mailbox_list_get_user(box->list); | |||
const struct dict_op_settings *set = mail_user_get_dict_op_settings(user) | ||||
; | ||||
ret = dict_lookup(dict, set, pool_datastack_create(), | ||||
key_get_prefixed(type_flags, mailbox_prefix, key), | key_get_prefixed(type_flags, mailbox_prefix, key), | |||
&value_r->value, &error); | &value_r->value, &error); | |||
if (ret < 0) { | if (ret < 0) { | |||
mailbox_set_critical(box, | mailbox_set_critical(box, | |||
"Failed to get attribute %s: %s", key, error); | "Failed to get attribute %s: %s", key, error); | |||
return -1; | return -1; | |||
} | } | |||
return ret; | return ret; | |||
} | } | |||
skipping to change at line 289 | skipping to change at line 290 | |||
iter = i_new(struct index_storage_attribute_iter, 1); | iter = i_new(struct index_storage_attribute_iter, 1); | |||
iter->iter.box = box; | iter->iter.box = box; | |||
if (index_storage_get_dict(box, type_flags, &dict, &mailbox_prefix) < 0) { | if (index_storage_get_dict(box, type_flags, &dict, &mailbox_prefix) < 0) { | |||
if (mailbox_get_last_mail_error(box) == MAIL_ERROR_NOTPOSSIBLE) | if (mailbox_get_last_mail_error(box) == MAIL_ERROR_NOTPOSSIBLE) | |||
iter->dict_disabled = TRUE; | iter->dict_disabled = TRUE; | |||
} else { | } else { | |||
iter->prefix = i_strdup(key_get_prefixed(type_flags, mailbox_pref ix, | iter->prefix = i_strdup(key_get_prefixed(type_flags, mailbox_pref ix, | |||
prefix)); | prefix)); | |||
iter->prefix_len = strlen(iter->prefix); | iter->prefix_len = strlen(iter->prefix); | |||
iter->diter = dict_iterate_init(dict, iter->prefix, | struct mail_user *user = mailbox_list_get_user(box->list); | |||
const struct dict_op_settings *set = mail_user_get_dict_op_settin | ||||
gs(user); | ||||
iter->diter = dict_iterate_init(dict, set, iter->prefix, | ||||
DICT_ITERATE_FLAG_RECURSE | | DICT_ITERATE_FLAG_RECURSE | | |||
DICT_ITERATE_FLAG_NO_VALUE); | DICT_ITERATE_FLAG_NO_VALUE); | |||
} | } | |||
return &iter->iter; | return &iter->iter; | |||
} | } | |||
const char * | const char * | |||
index_storage_attribute_iter_next(struct mailbox_attribute_iter *_iter) | index_storage_attribute_iter_next(struct mailbox_attribute_iter *_iter) | |||
{ | { | |||
struct index_storage_attribute_iter *iter = | struct index_storage_attribute_iter *iter = | |||
End of changes. 6 change blocks. | ||||
7 lines changed or deleted | 13 lines changed or added |