mailbox-attribute.c revision 1228d57525281527b34e7836b1e96a8af16f8674
/* 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"
#include "mailbox-attribute-internal.h"
static pool_t mailbox_attribute_pool;
void mailbox_attributes_init(void)
{
/* internal mailbox attributes */
}
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;
}
{
unsigned int i;
for (i = 0; i < count; i++)
}
static const struct mailbox_attribute_internal *
const char *key)
{
const struct mailbox_attribute_internal *iattr;
struct mailbox_attribute_internal dreg;
unsigned int insert_idx;
&insert_idx)) {
/* exact match */
}
if (insert_idx == 0) {
/* not found at all */
return NULL;
}
/* iattr isn't a prefix of key */
return NULL;
/* iattr is a prefix of key and it wants to handle the key */
return iattr;
} else {
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;
int ret;
/* 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();
}
}
/* FIXME: v2.3 should move the internal_attribute to attribute_set()
parameter (as flag). not done yet for API backwards compatibility */
t->internal_attribute = FALSE;
return ret;
}
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 - FIXME: v2.3 should move the internal_attribute to
attribute_get() parameter (as flag). not done yet for API backwards
compatibility */
t->internal_attribute = FALSE;
if (ret != 0)
return ret;
/* default entries */
ret = 0;
else {
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;
bool have_dict;
/* 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;
}