/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "dict.h"
#include "index-storage.h"
struct index_storage_attribute_iter {
char *prefix;
bool dict_disabled;
};
static struct mail_namespace *
{
return ns;
return ns;
}
return NULL;
}
static int
{
const char *error;
return 0;
}
if (user->attr_dict_failed) {
return -1;
}
/* probably never happens? */
"Mailbox attributes not available for this mailbox");
return -1;
}
"Mailbox attributes not enabled");
return -1;
}
"mail_attribute_dict: dict_init(%s) failed: %s",
return -1;
}
return 0;
}
static int
{
const char *error;
return -1;
if (type == MAIL_ATTRIBUTE_TYPE_PRIVATE) {
/* private attributes are stored in user's own dict */
/* user owns the mailbox. shared attributes are stored in
the same dict. */
/* accessing shared attribute of a shared mailbox.
use the owner's dict. */
}
/* accessing shared attributes of a public mailbox. no user owns it,
so use the storage's dict. */
return 0;
}
"Mailbox attributes not enabled");
return -1;
}
if (storage->shared_attr_dict_failed) {
return -1;
}
"mail_attribute_dict: dict_init(%s) failed: %s",
return -1;
}
return 0;
}
static const char *
const char *key)
{
switch (type) {
}
i_unreached();
}
static int
enum mail_attribute_type type,
struct dict_transaction_context **dtrans_r,
const char **mailbox_prefix_r)
{
switch (type) {
dtransp = &t->attr_pvt_trans;
break;
dtransp = &t->attr_shared_trans;
break;
}
/* transaction already created */
&metadata) < 0)
return -1;
return 0;
}
return -1;
return 0;
}
const struct mail_attribute_value *value)
{
const char *mailbox_prefix;
int ret = 0;
&mailbox_prefix) < 0)
return -1;
T_BEGIN {
const char *prefixed_key =
const char *value_str;
&value_str) < 0) {
ret = -1;
} else {
}
} T_END;
return ret;
}
struct mail_attribute_value *value_r)
{
int ret;
return -1;
if (ret < 0) {
return -1;
}
return ret;
}
struct mailbox_attribute_iter *
enum mail_attribute_type type,
const char *prefix)
{
const char *mailbox_prefix;
} else {
prefix));
}
}
const char *
{
(struct index_storage_attribute_iter *)_iter;
return NULL;
return key;
}
{
(struct index_storage_attribute_iter *)_iter;
const char *error;
int ret;
} else {
"dict_iterate(%s) failed: %s",
}
}
return ret;
}