mailbox-attribute.c revision bf79967ee56a3f7c99012997c1834452594fed41
/* Copyright (c) 2003-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "istream.h"
#include "mail-storage-private.h"
#include "bsearch-insert-pos.h"
static pool_t mailbox_attribute_pool;
void mailbox_attributes_init(void)
{
}
void mailbox_attributes_deinit(void)
{
}
/*
* Internal attributes
*/
static int
const struct mailbox_attribute_internal *reg1,
const struct mailbox_attribute_internal *reg2)
{
}
const struct mailbox_attribute_internal *iattr)
{
struct mailbox_attribute_internal ireg;
unsigned int insert_idx;
}
static const struct mailbox_attribute_internal *
const char *key)
{
struct mailbox_attribute_internal dreg;
unsigned int insert_idx;
&insert_idx))
return NULL;
}
static void
{
const struct mailbox_attribute_internal *regs;
struct mailbox_attribute_internal dreg;
char *bare_prefix;
unsigned int count, i;
plen--;
}
&dreg, mailbox_attribute_internal_cmp, &i);
for (; i < count; i++) {
return;
if (plen > 0) {
return;
return;
/* remove prefix */
}
}
}
/*
* Attribute API
*/
static int
const struct mail_attribute_value *value)
{
const struct mailbox_attribute_internal *iattr;
/* allow internal server attribute only for inbox */
/* handle internal attribute */
/* notify about assignment */
return -1;
break;
"The /%s/%s attribute cannot be changed",
return -1;
}
/* assign internal attribute */
default:
i_unreached();
}
}
}
int mailbox_attribute_set(struct mailbox_transaction_context *t,
const struct mail_attribute_value *value)
{
}
int mailbox_attribute_unset(struct mailbox_transaction_context *t,
{
struct mail_attribute_value value;
}
const struct mail_attribute_value *value,
const char **str_r)
{
const unsigned char *data;
return 0;
}
"Attribute string value has NULs");
return -1;
}
}
return -1;
}
return 0;
}
static int
struct mail_attribute_value *value_r)
{
const struct mailbox_attribute_internal *iattr;
int ret;
/* allow internal server attributes only for the inbox */
/* internal attribute */
if (ret < 0)
return -1;
return 1;
}
break;
return ret;
return 1;
default:
i_unreached();
}
}
/* user entries */
return ret;
/* default entries */
return ret;
if (ret > 0) {
return 1;
}
break;
default:
i_unreached();
}
}
return 0;
}
int mailbox_attribute_get(struct mailbox_transaction_context *t,
struct mail_attribute_value *value_r)
{
int ret;
return ret;
return 1;
}
int mailbox_attribute_get_stream(struct mailbox_transaction_context *t,
struct mail_attribute_value *value_r)
{
int ret;
return ret;
return 1;
}
struct mailbox_attribute_internal_iter {
struct mailbox_attribute_iter iter;
unsigned int extra_attr_idx;
struct mailbox_attribute_iter *real_iter;
};
struct mailbox_attribute_iter *
{
struct mailbox_attribute_internal_iter *intiter;
struct mailbox_attribute_iter *iter;
const char *const *attr;
/* check which internal attributes may apply */
/* any extra internal attributes to add? */
if (array_count(&extra_attrs) == 0) {
/* no */
return iter;
}
/* yes */
/* copy relevant attributes */
/* skip internal server attributes unless we're interating inbox */
continue;
}
}
{
struct mailbox_attribute_internal_iter *intiter;
const char *const *attrs;
unsigned int count, i;
const char *result;
/* no internal attributes to add */
}
/* filter out duplicate results */
for (i = 0; i < count; i++) {
break;
}
if (i == count) {
/* return normally */
return result;
}
/* this attribute name is also to be returned as extra;
skip now */
}
/* return extra attributes at the end */
return NULL;
}
{
struct mailbox_attribute_internal_iter *intiter;
int ret;
/* not wrapped */
}
/* wrapped */
return ret;
}