mailbox-list-maildir-iter.c revision f97cacf16251b42f530c6a28686cc8c9aa7df3a2
/* Copyright (C) 2002-2006 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "home-expand.h"
#include "imap-match.h"
#include "subscription-file.h"
#include "mailbox-tree.h"
#include "mailbox-list-maildir.h"
#include <dirent.h>
#define MAILBOX_FLAG_MATCHED 0x40000000
struct maildir_list_iterate_context {
struct mailbox_list_iterate_context ctx;
struct mailbox_tree_context *tree_ctx;
struct mailbox_info info;
};
{
if (!is_subs) {
}
}
}
}
static int
{
struct dirent *d;
const char *p, *mailbox_c;
enum mailbox_info_flags flags;
enum imap_match_result match;
struct mailbox_node *node;
bool created;
char hierarchy_sep;
int ret;
return -1;
}
return 0;
}
t_push();
if (fname[0] != hierarchy_sep)
continue;
/* skip . and .. */
if (fname[0] == '.' &&
continue;
/* make sure the mask matches */
str_truncate(mailbox, 0);
if (match != IMAP_MATCH_YES &&
continue;
/* check if this is an actual mailbox */
flags = 0;
mailbox_list_get_file_type(d), &flags);
if (ret < 0) {
t_pop();
return -1;
}
if (ret == 0)
continue;
if (match == IMAP_MATCH_PARENT) {
t_push();
hierarchy_sep)) != NULL) {
break;
}
node = update_only ?
if (created)
}
t_pop();
} else {
node = update_only ?
if (created)
}
}
}
}
t_pop();
return -1;
}
/* make sure INBOX is there */
if (created)
else
case IMAP_MATCH_YES:
case IMAP_MATCH_PARENT:
break;
default:
break;
}
}
return 0;
}
struct imap_match_glob *glob)
{
struct subsfile_list_context *subsfile_ctx;
struct mailbox_node *node;
char hierarchy_sep;
bool created;
case IMAP_MATCH_YES:
MAILBOX_LIST_ITER_FAST_FLAGS) == 0) {
}
break;
case IMAP_MATCH_PARENT:
/* placeholder */
break;
}
break;
default:
break;
}
}
return subsfile_list_deinit(subsfile_ctx);
}
struct mailbox_list_iterate_context *
enum mailbox_list_iter_flags flags)
{
struct maildir_list_iterate_context *ctx;
struct imap_match_glob *glob;
const char *dir, *p;
if ((flags & MAILBOX_LIST_ITER_SUBSCRIBED) != 0) {
}
}
if ((flags & MAILBOX_LIST_ITER_SUBSCRIBED) == 0 ||
}
}
}
{
struct maildir_list_iterate_context *ctx =
(struct maildir_list_iterate_context *)_ctx;
return ret;
}
{
struct mailbox_node *child;
return *node;
if (len != 0)
return child;
}
}
return NULL;
}
struct mailbox_info *
{
struct maildir_list_iterate_context *ctx =
(struct maildir_list_iterate_context *)_ctx;
struct mailbox_node *node;
break;
}
return NULL;
return NULL;
}
if (ctx->parent_pos != 0)
}