maildir-list.c revision 8153fdec343e40e2a78f5c12353e89b994b28f74
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "ioloop.h"
#include "str.h"
#include "home-expand.h"
#include "unlink-directory.h"
#include "imap-match.h"
#include "subscription-file/subscription-file.h"
#include "maildir-storage.h"
#include "mailbox-tree.h"
#include <stdlib.h>
#include <dirent.h>
#define MAILBOX_FLAG_MATCHED 0x40000000
struct maildir_list_context {
struct mailbox_list_context mailbox_ctx;
enum mailbox_list_flags flags;
struct mailbox_tree_context *tree_ctx;
struct mailbox_list list;
int failed;
};
{
if (!is_subs) {
}
}
}
}
{
struct dirent *d;
enum imap_match_result match;
struct mailbox_node *node;
}
return FALSE;
}
if (fname[0] != MAILDIR_FS_SEP)
continue;
/* skip . and .. */
if (fname[0] == '.' &&
continue;
#ifdef HAVE_DIRENT_D_TYPE
/* check the type always since there's no extra cost */
;
continue;
;
else
#endif
if (stat_dirs) {
t_push();
t_pop();
if (hide)
continue;
}
/* this mailbox is in the middle of being deleted,
or the process trying to delete it had died.
delete it ourself if it's been there longer than
one hour. don't touch it if it's outside our
mail root dir. */
t_push();
t_pop();
continue;
}
fname++;
/* make sure the mask matches */
str_truncate(mailbox, 0);
if (match != IMAP_MATCH_YES &&
continue;
if (match == IMAP_MATCH_PARENT) {
t_push();
MAILDIR_FS_SEP)) != NULL) {
break;
}
node = update_only ?
if (created)
}
t_pop();
} else {
node = update_only ?
if (created)
}
}
}
return FALSE;
}
MAILBOX_LIST_INBOX)) == MAILBOX_LIST_INBOX) {
/* make sure INBOX is there */
if (created)
else
}
return TRUE;
}
struct imap_match_glob *glob)
{
struct maildir_storage *storage =
struct subsfile_list_context *subsfile_ctx;
struct mailbox_node *node;
int created;
if (subsfile_ctx == NULL)
return FALSE;
case IMAP_MATCH_YES:
}
break;
case IMAP_MATCH_PARENT:
/* placeholder */
break;
}
break;
default:
break;
}
}
return subsfile_list_deinit(subsfile_ctx) == 0;
}
struct mailbox_list_context *
enum mailbox_list_flags flags)
{
struct maildir_list_context *ctx;
struct imap_match_glob *glob;
const char *dir, *p;
if (*ref != '\0') {
/* join reference + mask */
if (*mask == MAILDIR_FS_SEP &&
/* A. .B -> A.B */
mask++;
} else if (*mask != MAILDIR_FS_SEP &&
/* A B -> A.B */
} else {
}
}
if ((flags & MAILBOX_LIST_SUBSCRIBED) != 0) {
return &ctx->mailbox_ctx;
}
if ((flags & MAILBOX_LIST_SUBSCRIBED) == 0 ||
return &ctx->mailbox_ctx;
}
return &ctx->mailbox_ctx;
}
{
return TRUE;
}
{
struct mailbox_node *child;
return *node;
if (len != 0)
return child;
}
}
return NULL;
}
struct mailbox_list *
{
struct mailbox_node *node;
break;
}
return NULL;
return NULL;
}
if (ctx->parent_pos != 0) {
}
}