commands-util.c revision 18d06b7e210b3855420f41144ea36f332c480af8
/* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "temp-string.h"
#include "commands-util.h"
#include "imap-util.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
int should_exist, int should_not_exist)
{
const char *p;
char sep;
/* 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)) {
return FALSE;
}
switch (mailbox_status) {
case MAILBOX_NAME_VALID:
if (!should_exist)
return TRUE;
"NO [TRYCREATE] Mailbox doesn't exist: ",
break;
case MAILBOX_NAME_INVALID:
break;
case MAILBOX_NAME_EXISTS:
if (should_exist || !should_not_exist)
return TRUE;
break;
default:
i_unreached();
}
return FALSE;
}
{
return TRUE;
else {
return FALSE;
}
}
{
}
{
}
{
/* we can't do forced CLOSE, so have to disconnect */
"state, please relogin.");
return;
}
}
const char *custflags[MAIL_CUSTOM_FLAGS_COUNT])
{
char *atom;
int i, custpos;
"Flags list contains non-atoms.");
return FALSE;
}
if (*atom == '\\') {
/* system flag */
*flags |= MAIL_ANSWERED;
*flags |= MAIL_FLAGGED;
*flags |= MAIL_DELETED;
*flags |= MAIL_DRAFT;
else {
return FALSE;
}
} else {
/* custom flag - first make sure it's not a duplicate */
for (i = 0; i < custpos; i++) {
break;
}
if (i == MAIL_CUSTOM_FLAGS_COUNT) {
"Maximum number of different custom "
"flags exceeded");
return FALSE;
}
if (i == custpos) {
}
}
}
return TRUE;
}
static const char *get_custom_flags_string(const char *custom_flags[],
unsigned int custom_flags_count)
{
unsigned int i;
/* first see if there even is custom flags */
for (i = 0; i < custom_flags_count; i++) {
if (custom_flags[i] != NULL)
break;
}
if (i == custom_flags_count)
return "";
for (; i < custom_flags_count; i++) {
if (custom_flags[i] != NULL) {
}
}
}
#define SYSTEM_FLAGS "\\Answered \\Flagged \\Deleted \\Seen \\Draft"
const char *custom_flags[],
unsigned int custom_flags_count)
{
const char *str;
"Read-only mailbox.");
} else {
")] Flags permitted.", NULL));
}
}