mbox-list.c revision 7c424aa51c956c628e3512055841aa2f9eef4833
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "unlink-directory.h"
#include "imap-match.h"
#include "subscription-file/subscription-file.h"
#include "mbox-index.h"
#include "mbox-storage.h"
#include <dirent.h>
struct find_subscribed_context {
void *context;
};
struct imap_match_glob *glob,
const char *relative_dir)
{
struct dirent *d;
t_push();
if (relative_dir == NULL)
else {
return FALSE;
}
}
t_pop();
if (relative_dir != NULL &&
/* probably just race condition with other client
deleting the mailbox. */
return TRUE;
}
"opendir(%s) failed: %m", dir);
return FALSE;
}
/* skip all hidden files */
if (fname[0] == '.')
continue;
/* skip all .lock files */
continue;
/* check the mask */
if (relative_dir == NULL)
else {
relative_dir, fname) < 0) {
"Path too long: %s/%s",
break;
}
}
continue;
/* see if it's a directory */
"Path too long: %s/%s",
break;
}
continue; /* just deleted, ignore */
"%m", fullpath);
break;
}
/* subdirectory, scan it too */
t_push();
t_pop();
break;
}
} else if (match > 0 &&
t_push();
t_pop();
}
}
t_pop();
return !failed;
}
static const char *mask_get_dir(const char *mask)
{
const char *p, *last_dir;
if (*p == '/')
last_dir = p;
}
}
{
struct imap_match_glob *glob;
const char *relative_dir;
/* check that we're not trying to do any "../../" lists */
if (!mbox_is_valid_mask(mask)) {
return FALSE;
}
/* if we're matching only subdirectories, don't bother scanning the
parent directories */
/* INBOX exists always, even if the file doesn't. */
}
return FALSE;
return TRUE;
}
void *context)
{
enum mailbox_flags flags;
/* see if the mailbox exists, don't bother with the marked flags */
/* inbox always exists */
flags = 0;
} else {
0 : MAILBOX_NOSELECT;
}
return TRUE;
}
{
struct find_subscribed_context ctx;
return FALSE;
return TRUE;
}