commands-util.c revision ab0155cbec1286e1cd00a0e01d78e0f3ca34cea6
/* Copyright (C) 2002-2003 Timo Sirainen */
#include "common.h"
#include "array.h"
#include "buffer.h"
#include "str.h"
#include "mail-storage.h"
#include "commands-util.h"
#include "imap-parser.h"
#include "imap-sync.h"
#include "imap-util.h"
#include "namespace.h"
/* Maximum length for mailbox name, including it's path. This isn't fully
exact since the user can create folder hierarchy with small names, then
rename them to larger names. Mail storages should set more strict limits
#define MAILBOX_MAX_NAME_LEN 512
struct mail_storage *
{
return NULL;
}
const char *mailbox,
int should_exist, int should_not_exist)
{
struct mail_storage *storage;
const char *p;
char sep;
return FALSE;
/* make sure it even looks valid */
return FALSE;
}
/* make sure two hierarchy separators aren't next to each others */
return FALSE;
}
}
return FALSE;
}
/* check what our storage thinks of it */
&mailbox_status) < 0) {
return FALSE;
}
switch (mailbox_status) {
case MAILBOX_NAME_EXISTS:
if (should_exist || !should_not_exist)
return TRUE;
break;
case MAILBOX_NAME_VALID:
if (!should_exist)
return TRUE;
"NO [TRYCREATE] Mailbox doesn't exist: ",
break;
case MAILBOX_NAME_INVALID:
break;
case MAILBOX_NAME_NOINFERIORS:
"NO Mailbox parent doesn't allow inferior mailboxes.");
break;
default:
i_unreached();
}
return FALSE;
}
{
return TRUE;
else {
return FALSE;
}
}
struct mail_storage *storage)
{
const char *error;
int syntax, temporary_error;
/* we can't do forced CLOSE, so have to disconnect */
"Mailbox is in inconsistent state, please relogin.");
return;
}
}
struct mail_storage *storage)
{
const char *error;
int syntax, temporary_error;
/* we can't do forced CLOSE, so have to disconnect */
"Mailbox is in inconsistent state, please relogin.");
return;
}
}
const char *keyword)
{
const char *const *names;
unsigned int i, count;
/* if it already exists, skip validity checks */
for (i = 0; i < count; i++) {
return TRUE;
}
}
t_strdup_printf("BAD Invalid keyword name '%s': "
"Maximum length is %u characters",
return FALSE;
}
return TRUE;
}
const char *const **keywords_r)
{
const char *const *keywords;
char *atom;
*flags_r = 0;
*keywords_r = NULL;
"Flags list contains non-atoms.");
return FALSE;
}
if (*atom == '\\') {
/* system flag */
*flags_r |= MAIL_ANSWERED;
*flags_r |= MAIL_FLAGGED;
*flags_r |= MAIL_DELETED;
*flags_r |= MAIL_DRAFT;
else {
"BAD Invalid system flag ",
return FALSE;
}
} else {
/* keyword - first make sure it's not a duplicate */
size /= sizeof(const char *);
for (i = 0; i < size; i++) {
break;
}
if (i == size) {
return FALSE;
}
}
args++;
}
return TRUE;
}
{
ARRAY_SET_TYPE(keywords, const char *);
const char *const *names;
unsigned int i, count;
if (array_count(keywords) == 0)
return "";
for (i = 0; i < count; i++) {
}
}
#define SYSTEM_FLAGS "\\Answered \\Flagged \\Deleted \\Seen \\Draft"
{
const char *str;
if (mailbox_is_readonly(box)) {
"Read-only mailbox.");
} else {
}
}
{
ARRAY_SET_TYPE(keywords, const char *);
int changed;
/* first check if anything changes */
else {
else {
for (i = 0; i < count; i++) {
break;
}
}
}
}
if (!changed)
return FALSE;
const char *, array_count(keywords));
for (i = 0; i < count; i++) {
}
return TRUE;
}
const char *name2)
{
const char *name1;
return FALSE;
return TRUE;
}
{
}
{
;
else {
}
}
}
{
else
}