mailbox-alias-plugin.c revision 49b6ea58565e72b44b1e5cee6fb7619d54150347
/* Copyright (c) 2013-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "mail-storage-hooks.h"
#include "mail-storage-private.h"
#include "mailbox-list-private.h"
#include "mailbox-alias-plugin.h"
#define MAILBOX_ALIAS_USER_CONTEXT(obj) \
#define MAILBOX_ALIAS_CONTEXT(obj) \
#define MAILBOX_ALIAS_LIST_CONTEXT(obj) \
struct mailbox_alias {
};
struct mailbox_alias_user {
};
struct mailbox_alias_mailbox_list {
};
struct mailbox_alias_mailbox {
union mailbox_module_context module_ctx;
};
enum mailbox_symlink_existence {
};
const char *mailbox_alias_plugin_version = DOVECOT_ABI_VERSION;
static const char *
{
const struct mailbox_alias *alias;
}
return NULL;
}
{
struct mailbox_alias_mailbox_list *alist =
const char *symlink_name, *symlink_path;
int ret;
if (ret < 0)
return -1;
return 0;
}
"lstat(%s) failed: %m", symlink_path);
return -1;
}
else
return 0;
}
{
return 0;
return -1;
}
}
static int
{
struct mailbox_alias_user *auser =
const struct mailbox_alias *alias;
int ret = 0;
&existence) < 0)
ret = -1;
else if (existence == MAILBOX_SYMLINK_EXISTENCE_SYMLINK)
return 1;
}
}
return ret;
}
static int
{
int ret;
if (ret > 0) {
&new_path);
}
if (ret < 0)
return -1;
if (ret == 0) {
"Mailbox aliases not supported by storage");
return -1;
}
fname++;
"Mailbox already exists");
return -1;
}
return -1;
}
return 0;
}
static const char *
{
struct mailbox_alias_mailbox_list *alist =
const char *old_vname;
/* access the old mailbox so that e.g. full text search won't
index the mailbox twice. this also means that deletion must be
careful to delete the symlink, box->name. */
}
static int
bool directory)
{
struct mailbox_alias_mailbox_list *alist =
const char *symlink_name;
int ret;
return ret;
return ret;
/* all the code so far has actually only created the original
mailbox. now we'll create the symlink if it's missing. */
}
{
struct mailbox_alias_mailbox_list *alist =
const char *symlink_name;
int ret;
if (ret < 0)
return -1;
if (ret > 0) {
"Can't delete mailbox while it has aliases");
return -1;
}
return -1;
if (ret > 0) {
/* we're deleting an alias mailbox. we'll need to handle this
explicitly since box->name points to the original mailbox */
return -1;
}
return 0;
}
}
{
int ret;
return -1;
else if (ret > 0) {
"Can't rename alias mailboxes");
return -1;
}
return -1;
else if (ret > 0) {
"Can't rename to mailbox alias");
return -1;
}
if (ret < 0)
return -1;
if (ret > 0) {
"Can't rename mailbox while it has aliases");
return -1;
}
}
{
struct mailbox_alias_user *auser;
struct mailbox_alias *alias;
unsigned int i;
for (i = 2;; i++) {
break;
str_truncate(oldkey, 0);
str_truncate(newkey, 0);
}
}
{
struct mailbox_alias_mailbox_list *alist;
}
{
struct mailbox_alias_mailbox *abox;
}
static struct mail_storage_hooks mailbox_alias_mail_storage_hooks = {
};
{
}
void mailbox_alias_plugin_deinit(void)
{
}