imapc-list.c revision 71e88fae3be360e9a93b3398e743f99a6f05d2ed
/* Copyright (c) 2011-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "imap-arg.h"
#include "imap-match.h"
#include "imap-utf7.h"
#include "mailbox-tree.h"
#include "mailbox-list-subscriptions.h"
#include "imapc-client.h"
#include "imapc-storage.h"
#include "imapc-list.h"
struct imapc_mailbox_list_iterate_context {
struct mailbox_list_iterate_context ctx;
struct mailbox_tree_context *tree;
struct mailbox_node *ns_root;
struct mailbox_tree_iterate_context *iter;
struct mailbox_info info;
};
extern struct mailbox_list imapc_mailbox_list;
static struct mailbox_list *imapc_list_alloc(void)
{
struct imapc_mailbox_list *list;
/* separator is set when storage is created */
}
{
}
void *context)
{
const char *str;
enum mail_error error;
}
}
static struct mailbox_node *
struct mailbox_tree_context *tree,
{
struct mailbox_node *node;
enum mailbox_info_flags info_flags = 0;
bool created;
return NULL;
flags++;
}
T_BEGIN {
const char *vname =
if ((info_flags & MAILBOX_NONEXISTENT) != 0)
else
} T_END;
return node;
}
struct imapc_storage *storage)
{
/* we haven't asked for the separator yet.
lets see if this is the reply for its request. */
return;
/* we can't handle NIL separator yet */
} else {
}
}
struct imapc_storage *storage)
{
struct mailbox_node *node;
/* we haven't asked for the separator yet */
return;
}
else {
/* LSUB \Noselect means that the mailbox isn't
subscribed, but it has children that are */
}
}
}
{
}
static bool
const char *pattern ATTR_UNUSED)
{
return TRUE;
}
static bool
const char *name ATTR_UNUSED)
{
return TRUE;
}
static bool
const char *name ATTR_UNUSED)
{
return TRUE;
}
{
/* storage should have looked this up when it was created */
}
static const char *
{
const char *storage_name;
}
return storage_name;
}
static const char *
{
unsigned int prefix_len;
}
}
{
struct mailbox_list_settings list_set;
/* indexes disabled */
i_error("imapc: Couldn't create %s mailbox list: %s",
}
}
return list->index_list;
}
static const char *
{
const char *vname;
return name;
}
static const char *
enum mailbox_list_path_type type)
{
const char *fs_name;
} else {
if (type == MAILBOX_LIST_PATH_TYPE_INDEX)
return "";
return NULL;
}
}
static const char *
{
return global ?
} else {
i_panic("imapc: Can't return a temp prefix for '%s'",
return NULL;
}
}
static const char *
{
}
static struct imapc_command *
struct imapc_mailbox_list *list)
{
}
{
struct mailbox_list_iterate_context *iter;
const struct mailbox_info *info;
const char *fs_name;
return;
}
}
(void)mailbox_list_iter_deinit(&iter);
}
{
struct imapc_command *cmd;
struct imapc_simple_context ctx;
struct mailbox_node *node;
const char *pattern;
if (list->refreshed_mailboxes)
return 0;
pattern = "*";
else {
}
/* INBOX always exists in IMAP server. since this namespace is
marked with inbox=yes, show the INBOX even if
imapc_list_prefix doesn't match it */
bool created;
/* this listing didn't include the INBOX itself, but
might have included its children. make sure there
aren't any extra flags in it (especially
\NonExistent) */
}
}
}
}
static void
{
struct imapc_mailbox_list *list =
struct mailbox_tree_iterate_context *iter;
struct mailbox_node *node;
const char *name;
}
}
static struct mailbox_list_iterate_context *
enum mailbox_list_iter_flags flags)
{
struct mailbox_list_iterate_context *_ctx;
struct imapc_mailbox_list_iterate_context *ctx;
const char *ns_root_name;
char sep;
int ret = 0;
if ((flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) == 0 ||
(flags & MAILBOX_LIST_ITER_RETURN_NO_FLAGS) == 0)
list->iter_count++;
if ((flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) {
/* we're listing only subscriptions. just use the cached
subscriptions list. */
flags);
if (ret < 0)
return _ctx;
}
}
if (ret < 0)
}
static const struct mailbox_info *
{
struct imapc_mailbox_list_iterate_context *ctx =
(struct imapc_mailbox_list_iterate_context *)_ctx;
struct mailbox_node *node;
const char *vname;
return NULL;
return mailbox_list_subscriptions_iter_next(_ctx);
do {
return NULL;
}
{
struct imapc_mailbox_list_iterate_context *ctx =
(struct imapc_mailbox_list_iterate_context *)_ctx;
struct imapc_mailbox_list *list =
if (--list->iter_count == 0) {
}
return ret;
}
static int
struct mailbox_list *dest_list)
{
struct imapc_mailbox_list *src_list =
(struct imapc_mailbox_list *)_src_list;
struct imapc_simple_context ctx;
struct imapc_command *cmd;
const char *pattern;
char sep;
if (src_list->refreshed_subscriptions) {
}
return 0;
}
pattern = "*";
else {
}
/* replace subscriptions tree in destination */
return 0;
}
{
struct imapc_command *cmd;
struct imapc_simple_context ctx;
}
static int
const char *name ATTR_UNUSED,
{
/* this gets called just before mailbox.create().
we don't need to do anything. */
return 0;
}
static int
{
struct imapc_command *cmd;
struct imapc_simple_context ctx;
}
}
static int
{
}
return 0;
}
static int
const char *name ATTR_UNUSED)
{
return -1;
}
static int
{
struct imapc_command *cmd;
struct imapc_simple_context ctx;
"Can't rename mailboxes across storages.");
return -1;
}
}
}
enum mailbox_info_flags *flags_r)
{
struct imapc_command *cmd;
struct imapc_simple_context sctx;
struct mailbox_node *node;
const char *vname;
if (!list->refreshed_mailboxes) {
/* refresh the mailbox flags */
return -1;
}
else
return 0;
}
struct mailbox_list imapc_mailbox_list = {
{
NULL,
NULL,
NULL,
}
};