Commit 7b066136 7b066136682706f5a296d295fefcb477b7419988 by Sergey Poznyakoff

Remove state check.

1 parent c841c9ed
......@@ -27,9 +27,6 @@ imap4d_append (struct imap4d_command *command, char *arg)
mailbox_t dest_mbox = NULL;
int status;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
mboxname = util_getword (arg, &sp);
if (!mboxname)
return util_finish (command, RESP_BAD, "Too few arguments");
......
......@@ -37,9 +37,6 @@ imap4d_authenticate (struct imap4d_command *command, char *arg)
struct imap_auth *ap;
char *username = NULL;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
auth_type = util_getword (arg, &sp);
util_unquote (&auth_type);
if (!auth_type)
......
......@@ -27,7 +27,5 @@ int
imap4d_check (struct imap4d_command *command, char *arg)
{
(void)arg;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
return util_finish (command, RESP_OK, "Completed");
}
......
......@@ -24,8 +24,6 @@ int
imap4d_close (struct imap4d_command *command, char *arg)
{
(void)arg;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
/* FIXME: Check and report errors. */
/* The CLOSE command permanently removes from the currently selected
mailbox all messages that have the \\Deleted flag set, and returns
......
......@@ -27,9 +27,6 @@ imap4d_copy (struct imap4d_command *command, char *arg)
int rc;
char buffer[64];
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
rc = imap4d_copy0 (arg, 0, buffer, sizeof buffer);
if (rc == RESP_NONE)
{
......
......@@ -35,9 +35,6 @@ imap4d_create (struct imap4d_command *command, char *arg)
int rc = RESP_OK;
const char *msg = "Completed";
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
name = util_getword (arg, &sp);
if (!name)
return util_finish (command, RESP_BAD, "Too few arguments");
......
......@@ -30,9 +30,6 @@ imap4d_delete (struct imap4d_command *command, char *arg)
const char *delim = "/";
char *name;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
name = util_getword (arg, &sp);
util_unquote (&name);
if (!name || *name == '\0')
......
......@@ -24,7 +24,5 @@
int
imap4d_examine (struct imap4d_command *command, char *arg)
{
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
return imap4d_select0 (command, arg, MU_STREAM_READ);
}
......
......@@ -26,8 +26,6 @@ imap4d_expunge (struct imap4d_command *command, char *arg)
{
char *sp = NULL;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
if (util_getword (arg, &sp))
return util_finish (command, RESP_NO, "Too many args");
......
......@@ -126,9 +126,6 @@ imap4d_fetch (struct imap4d_command *command, char *arg)
int rc;
char buffer[64];
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
rc = imap4d_fetch0 (arg, 0, buffer, sizeof buffer);
return util_finish (command, rc, buffer);
}
......
......@@ -85,8 +85,6 @@ imap4d_login (struct imap4d_command *command, char *arg)
int pamerror;
#endif /* !USE_LIBPAM */
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
username = util_getword (arg, &sp);
pass = util_getword (NULL, &sp);
......
......@@ -25,8 +25,6 @@ int
imap4d_logout (struct imap4d_command *command, char *arg)
{
char *sp = NULL;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
if (util_getword (arg, &sp))
return util_finish (command, RESP_BAD, "Too many args");
imap4d_bye0 (OK, command);
......
......@@ -32,9 +32,6 @@ imap4d_lsub (struct imap4d_command *command, char *arg)
const char *delim = "/";
FILE *fp;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
ref = util_getword (arg, &sp);
wcard = util_getword (NULL, &sp);
if (!ref || !wcard)
......
......@@ -115,8 +115,6 @@ namespace_enumerate_all(nsfp_t f, void *closure)
int
imap4d_namespace(struct imap4d_command *command, char *arg)
{
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
if (*arg)
return util_finish (command, RESP_BAD, "Too many arguments");
......@@ -171,7 +169,7 @@ char *
namespace_checkfullpath (char *name, const char *pattern, const char *delim)
{
struct namespace_info info;
char *path = util_getfullpath(name, delim);
char *path = util_getfullpath (name, delim);
if (!path)
return path;
......
......@@ -23,8 +23,6 @@ imap4d_noop (struct imap4d_command *command, char *arg)
{
char *sp = NULL;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
if (util_getword (arg, &sp))
return util_finish (command, RESP_BAD, "Too many args");
......
......@@ -32,9 +32,6 @@ imap4d_rename (struct imap4d_command *command, char *arg)
struct stat newst;
const char *delim = "/";
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
oldname = util_getword (arg, &sp);
newname = util_getword (NULL, &sp);
if (!newname || !oldname)
......
......@@ -194,9 +194,6 @@ imap4d_search (struct imap4d_command *command, char *arg)
int rc;
char buffer[64];
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
rc = imap4d_search0 (arg, 0, buffer, sizeof buffer);
return util_finish (command, rc, buffer);
}
......
......@@ -24,8 +24,6 @@ static int select_flags;
int
imap4d_select (struct imap4d_command *command, char *arg)
{
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
return imap4d_select0 (command, arg, MU_STREAM_RDWR);
}
......
......@@ -64,9 +64,6 @@ imap4d_status (struct imap4d_command *command, char *arg)
int count = 0;
char *err_msg = NULL;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
name = util_getword (arg, &sp);
util_unquote (&name);
if (!name || *name == '\0' || !sp || *sp == '\0')
......
......@@ -27,9 +27,6 @@ imap4d_store (struct imap4d_command *command, char *arg)
int rc;
char buffer[64];
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
rc = imap4d_store0 (arg, 0, buffer, sizeof buffer);
return util_finish (command, rc, buffer);
}
......
......@@ -29,9 +29,6 @@ imap4d_subscribe (struct imap4d_command *command, char *arg)
char *file;
FILE *fp;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
name = util_getword (arg, &sp);
util_unquote (&name);
if (!name || *name == '\0')
......
......@@ -30,9 +30,6 @@ imap4d_uid (struct imap4d_command *command, char *arg)
int rc = RESP_NO;
char buffer[64];
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
cmd = util_getword (arg, &sp);
if (!cmd)
util_finish (command, RESP_BAD, "Too few args");
......
......@@ -29,9 +29,6 @@ imap4d_unsubscribe (struct imap4d_command *command, char *arg)
char *file;
FILE *fp;
if (! (command->states & state))
return util_finish (command, RESP_BAD, "Wrong state");
name = util_getword (arg, &sp);
util_unquote (&name);
if (!name || *name == '\0')
......