maildir-list.c revision 4cb38584c37bf1428f631de1b1cd9de2bab8baa7
/* 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 <dirent.h>
#define MAILBOX_FLAG_MATCHED 0x40000000
struct maildir_list_context {
struct mailbox_list_context mailbox_ctx;
struct mail_storage *storage;
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;
int created;
return FALSE;
}
}
/* INBOX exists always */
}
if (fname[0] != MAILDIR_FS_SEP)
continue;
/* skip . and .. */
if (fname[0] == '.' &&
continue;
/* FIXME: kludges. these files must be renamed later */
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;
continue; /* ignore inboxes */
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;
}
return TRUE;
}
struct imap_match_glob *glob)
{
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 *
{
struct maildir_list_context *ctx;
struct imap_match_glob *glob;
const char *dir, *p;
/* this will never match, return nothing */
return &ctx->mailbox_ctx;
}
if ((flags & MAILBOX_LIST_SUBSCRIBED) != 0) {
return NULL;
}
}
if ((flags & MAILBOX_LIST_SUBSCRIBED) == 0 ||
return NULL;
}
}
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)
}