time_t ts = value->last_change != 0 ? value->last_change : ioloop_time;
int ret = 0;
- if (!MAILBOX_ATTRIBUTE_KEY_IS_USER_ACCESSIBLE(key)) {
+ if (!t->internal_attribute &&
+ !MAILBOX_ATTRIBUTE_KEY_IS_USER_ACCESSIBLE(key)) {
mail_storage_set_error(t->box->storage, MAIL_ERROR_PARAMS,
"Internal attributes cannot be changed directly");
return -1;
memset(value_r, 0, sizeof(*value_r));
- if (!MAILBOX_ATTRIBUTE_KEY_IS_USER_ACCESSIBLE(key))
+ if (!t->internal_attribute &&
+ !MAILBOX_ATTRIBUTE_KEY_IS_USER_ACCESSIBLE(key))
return 0;
if (index_storage_get_dict(t->box, type, &dict, &mailbox_prefix) < 0)
unsigned int stats_track:1;
/* We've done some non-transactional (e.g. dovecot-uidlist updates) */
unsigned int nontransactional_changes:1;
+ /* FIXME: v2.3: this should be in attribute_get/set() parameters */
+ unsigned int internal_attribute:1;
};
union mail_search_module_context {
const struct mail_attribute_value *value)
{
const struct mailbox_attribute_internal *iattr;
-
+ int ret;
+
iattr = mailbox_internal_attribute_get(type, key);
/* allow internal server attribute only for inbox */
}
}
- return t->box->v.attribute_set(t, type, key, value);
+ /* FIXME: v2.3 should move the internal_attribute to attribute_set()
+ parameter (as flag). not done yet for API backwards compatibility */
+ t->internal_attribute = iattr != NULL &&
+ iattr->rank != MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY;
+ ret = t->box->v.attribute_set(t, type, key, value);
+ t->internal_attribute = FALSE;
+ return ret;
}
int mailbox_attribute_set(struct mailbox_transaction_context *t,
}
}
- /* user entries */
- if ((ret = t->box->v.attribute_get(t, type, key, value_r)) != 0)
+ /* user entries - FIXME: v2.3 should move the internal_attribute to
+ attribute_get() parameter (as flag). not done yet for API backwards
+ compatibility */
+ t->internal_attribute = iattr != NULL &&
+ iattr->rank != MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY;
+ ret = t->box->v.attribute_get(t, type, key, value_r);
+ t->internal_attribute = FALSE;
+ if (ret != 0)
return ret;
/* default entries */