mailbox-list-fs-flags.c revision 9fc97c8aa8190df87624d214bcc5d0b5362bec93
/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "mailbox-list-fs.h"
/* Assume that if atime < mtime, there are new mails. If it's good enough for
UW-IMAP, it's good enough for us. */
#define STAT_GET_MARKED_FILE(st) \
static int
enum mailbox_info_flags *flags_r)
{
const char *path, *maildir_path;
bool mailbox_files;
switch (type) {
/* non-directories aren't valid */
return 0;
break;
}
return 0;
} else {
/* non-selectable. probably either access denied, or
symlink destination not found. don't bother logging
errors. */
*flags_r |= MAILBOX_NOSELECT;
return 1;
}
}
/* temporary NFS file */
} else {
}
return 0;
}
/* ok, we've got a directory. see what we can do about it. */
/* 1st link is "."
2nd link is ".."
3rd link is either child mailbox or mailbox dir
rest of the links are child mailboxes
if mailboxes are files, then 3+ links are all child mailboxes.
*/
*flags_r |= MAILBOX_NOSELECT;
return 1;
}
/* we have at least one directory. see if this mailbox is selectable */
if (mailbox_files) {
} else {
}
} else {
/* now we know what link count 3 means. */
else
*flags_r |= MAILBOX_CHILDREN;
}
*flags_r |= MAILBOX_SELECT;
return 1;
}
static bool
{
const char *inbox_path;
return FALSE;
&inbox_path) <= 0)
i_unreached();
}
enum mailbox_list_file_type type,
enum mailbox_info_flags *flags_r)
{
const char *path;
*flags_r = 0;
/* maildir_name is set: the code is common for all
storage types */
}
/* skip internal dirs */
*flags_r |= MAILBOX_NOSELECT;
return 0;
}
switch (type) {
*flags_r |= MAILBOX_NOSELECT;
return 1;
}
break;
return 0;
}
break;
default:
break;
}
/* we've done all filtering we can before stat()ing */
return 0;
*flags_r |= MAILBOX_NOSELECT;
return 1;
} else {
/* non-selectable. probably either access denied, or
symlink destination not found. don't bother logging
errors. */
path);
return -1;
}
}
/* temporary NFS file */
return 0;
}
return 0;
}
/* looks like a valid mailbox file */
/* it's possible for INBOX to have child
mailboxes as long as the inbox file itself
isn't in <mail root>/INBOX */
} else {
}
} else {
return 1;
}
}
/* link count < 2 can happen with filesystems that don't
support link counts. we'll just ignore them for now.. */
*flags_r |= MAILBOX_CHILDREN;
}
return 1;
}