Commit 7b066136 7b066136682706f5a296d295fefcb477b7419988 by Sergey Poznyakoff

Remove state check.

1 parent c841c9ed
...@@ -27,9 +27,6 @@ imap4d_append (struct imap4d_command *command, char *arg) ...@@ -27,9 +27,6 @@ imap4d_append (struct imap4d_command *command, char *arg)
27 mailbox_t dest_mbox = NULL; 27 mailbox_t dest_mbox = NULL;
28 int status; 28 int status;
29 29
30 if (! (command->states & state))
31 return util_finish (command, RESP_BAD, "Wrong state");
32
33 mboxname = util_getword (arg, &sp); 30 mboxname = util_getword (arg, &sp);
34 if (!mboxname) 31 if (!mboxname)
35 return util_finish (command, RESP_BAD, "Too few arguments"); 32 return util_finish (command, RESP_BAD, "Too few arguments");
......
...@@ -37,9 +37,6 @@ imap4d_authenticate (struct imap4d_command *command, char *arg) ...@@ -37,9 +37,6 @@ imap4d_authenticate (struct imap4d_command *command, char *arg)
37 struct imap_auth *ap; 37 struct imap_auth *ap;
38 char *username = NULL; 38 char *username = NULL;
39 39
40 if (! (command->states & state))
41 return util_finish (command, RESP_BAD, "Wrong state");
42
43 auth_type = util_getword (arg, &sp); 40 auth_type = util_getword (arg, &sp);
44 util_unquote (&auth_type); 41 util_unquote (&auth_type);
45 if (!auth_type) 42 if (!auth_type)
......
...@@ -27,7 +27,5 @@ int ...@@ -27,7 +27,5 @@ int
27 imap4d_check (struct imap4d_command *command, char *arg) 27 imap4d_check (struct imap4d_command *command, char *arg)
28 { 28 {
29 (void)arg; 29 (void)arg;
30 if (! (command->states & state))
31 return util_finish (command, RESP_BAD, "Wrong state");
32 return util_finish (command, RESP_OK, "Completed"); 30 return util_finish (command, RESP_OK, "Completed");
33 } 31 }
......
...@@ -24,8 +24,6 @@ int ...@@ -24,8 +24,6 @@ int
24 imap4d_close (struct imap4d_command *command, char *arg) 24 imap4d_close (struct imap4d_command *command, char *arg)
25 { 25 {
26 (void)arg; 26 (void)arg;
27 if (! (command->states & state))
28 return util_finish (command, RESP_BAD, "Wrong state");
29 /* FIXME: Check and report errors. */ 27 /* FIXME: Check and report errors. */
30 /* The CLOSE command permanently removes from the currently selected 28 /* The CLOSE command permanently removes from the currently selected
31 mailbox all messages that have the \\Deleted flag set, and returns 29 mailbox all messages that have the \\Deleted flag set, and returns
......
...@@ -27,9 +27,6 @@ imap4d_copy (struct imap4d_command *command, char *arg) ...@@ -27,9 +27,6 @@ imap4d_copy (struct imap4d_command *command, char *arg)
27 int rc; 27 int rc;
28 char buffer[64]; 28 char buffer[64];
29 29
30 if (! (command->states & state))
31 return util_finish (command, RESP_BAD, "Wrong state");
32
33 rc = imap4d_copy0 (arg, 0, buffer, sizeof buffer); 30 rc = imap4d_copy0 (arg, 0, buffer, sizeof buffer);
34 if (rc == RESP_NONE) 31 if (rc == RESP_NONE)
35 { 32 {
......
...@@ -35,9 +35,6 @@ imap4d_create (struct imap4d_command *command, char *arg) ...@@ -35,9 +35,6 @@ imap4d_create (struct imap4d_command *command, char *arg)
35 int rc = RESP_OK; 35 int rc = RESP_OK;
36 const char *msg = "Completed"; 36 const char *msg = "Completed";
37 37
38 if (! (command->states & state))
39 return util_finish (command, RESP_BAD, "Wrong state");
40
41 name = util_getword (arg, &sp); 38 name = util_getword (arg, &sp);
42 if (!name) 39 if (!name)
43 return util_finish (command, RESP_BAD, "Too few arguments"); 40 return util_finish (command, RESP_BAD, "Too few arguments");
......
...@@ -30,9 +30,6 @@ imap4d_delete (struct imap4d_command *command, char *arg) ...@@ -30,9 +30,6 @@ imap4d_delete (struct imap4d_command *command, char *arg)
30 const char *delim = "/"; 30 const char *delim = "/";
31 char *name; 31 char *name;
32 32
33 if (! (command->states & state))
34 return util_finish (command, RESP_BAD, "Wrong state");
35
36 name = util_getword (arg, &sp); 33 name = util_getword (arg, &sp);
37 util_unquote (&name); 34 util_unquote (&name);
38 if (!name || *name == '\0') 35 if (!name || *name == '\0')
......
...@@ -24,7 +24,5 @@ ...@@ -24,7 +24,5 @@
24 int 24 int
25 imap4d_examine (struct imap4d_command *command, char *arg) 25 imap4d_examine (struct imap4d_command *command, char *arg)
26 { 26 {
27 if (! (command->states & state))
28 return util_finish (command, RESP_BAD, "Wrong state");
29 return imap4d_select0 (command, arg, MU_STREAM_READ); 27 return imap4d_select0 (command, arg, MU_STREAM_READ);
30 } 28 }
......
...@@ -26,8 +26,6 @@ imap4d_expunge (struct imap4d_command *command, char *arg) ...@@ -26,8 +26,6 @@ imap4d_expunge (struct imap4d_command *command, char *arg)
26 { 26 {
27 char *sp = NULL; 27 char *sp = NULL;
28 28
29 if (! (command->states & state))
30 return util_finish (command, RESP_BAD, "Wrong state");
31 if (util_getword (arg, &sp)) 29 if (util_getword (arg, &sp))
32 return util_finish (command, RESP_NO, "Too many args"); 30 return util_finish (command, RESP_NO, "Too many args");
33 31
......
...@@ -126,9 +126,6 @@ imap4d_fetch (struct imap4d_command *command, char *arg) ...@@ -126,9 +126,6 @@ imap4d_fetch (struct imap4d_command *command, char *arg)
126 int rc; 126 int rc;
127 char buffer[64]; 127 char buffer[64];
128 128
129 if (! (command->states & state))
130 return util_finish (command, RESP_BAD, "Wrong state");
131
132 rc = imap4d_fetch0 (arg, 0, buffer, sizeof buffer); 129 rc = imap4d_fetch0 (arg, 0, buffer, sizeof buffer);
133 return util_finish (command, rc, buffer); 130 return util_finish (command, rc, buffer);
134 } 131 }
......
...@@ -85,8 +85,6 @@ imap4d_login (struct imap4d_command *command, char *arg) ...@@ -85,8 +85,6 @@ imap4d_login (struct imap4d_command *command, char *arg)
85 int pamerror; 85 int pamerror;
86 #endif /* !USE_LIBPAM */ 86 #endif /* !USE_LIBPAM */
87 87
88 if (! (command->states & state))
89 return util_finish (command, RESP_BAD, "Wrong state");
90 username = util_getword (arg, &sp); 88 username = util_getword (arg, &sp);
91 pass = util_getword (NULL, &sp); 89 pass = util_getword (NULL, &sp);
92 90
......
...@@ -25,8 +25,6 @@ int ...@@ -25,8 +25,6 @@ int
25 imap4d_logout (struct imap4d_command *command, char *arg) 25 imap4d_logout (struct imap4d_command *command, char *arg)
26 { 26 {
27 char *sp = NULL; 27 char *sp = NULL;
28 if (! (command->states & state))
29 return util_finish (command, RESP_BAD, "Wrong state");
30 if (util_getword (arg, &sp)) 28 if (util_getword (arg, &sp))
31 return util_finish (command, RESP_BAD, "Too many args"); 29 return util_finish (command, RESP_BAD, "Too many args");
32 imap4d_bye0 (OK, command); 30 imap4d_bye0 (OK, command);
......
...@@ -32,9 +32,6 @@ imap4d_lsub (struct imap4d_command *command, char *arg) ...@@ -32,9 +32,6 @@ imap4d_lsub (struct imap4d_command *command, char *arg)
32 const char *delim = "/"; 32 const char *delim = "/";
33 FILE *fp; 33 FILE *fp;
34 34
35 if (! (command->states & state))
36 return util_finish (command, RESP_BAD, "Wrong state");
37
38 ref = util_getword (arg, &sp); 35 ref = util_getword (arg, &sp);
39 wcard = util_getword (NULL, &sp); 36 wcard = util_getword (NULL, &sp);
40 if (!ref || !wcard) 37 if (!ref || !wcard)
......
...@@ -115,8 +115,6 @@ namespace_enumerate_all(nsfp_t f, void *closure) ...@@ -115,8 +115,6 @@ namespace_enumerate_all(nsfp_t f, void *closure)
115 int 115 int
116 imap4d_namespace(struct imap4d_command *command, char *arg) 116 imap4d_namespace(struct imap4d_command *command, char *arg)
117 { 117 {
118 if (! (command->states & state))
119 return util_finish (command, RESP_BAD, "Wrong state");
120 if (*arg) 118 if (*arg)
121 return util_finish (command, RESP_BAD, "Too many arguments"); 119 return util_finish (command, RESP_BAD, "Too many arguments");
122 120
...@@ -171,7 +169,7 @@ char * ...@@ -171,7 +169,7 @@ char *
171 namespace_checkfullpath (char *name, const char *pattern, const char *delim) 169 namespace_checkfullpath (char *name, const char *pattern, const char *delim)
172 { 170 {
173 struct namespace_info info; 171 struct namespace_info info;
174 char *path = util_getfullpath(name, delim); 172 char *path = util_getfullpath (name, delim);
175 173
176 if (!path) 174 if (!path)
177 return path; 175 return path;
......
...@@ -23,8 +23,6 @@ imap4d_noop (struct imap4d_command *command, char *arg) ...@@ -23,8 +23,6 @@ imap4d_noop (struct imap4d_command *command, char *arg)
23 { 23 {
24 char *sp = NULL; 24 char *sp = NULL;
25 25
26 if (! (command->states & state))
27 return util_finish (command, RESP_BAD, "Wrong state");
28 if (util_getword (arg, &sp)) 26 if (util_getword (arg, &sp))
29 return util_finish (command, RESP_BAD, "Too many args"); 27 return util_finish (command, RESP_BAD, "Too many args");
30 28
......
...@@ -32,9 +32,6 @@ imap4d_rename (struct imap4d_command *command, char *arg) ...@@ -32,9 +32,6 @@ imap4d_rename (struct imap4d_command *command, char *arg)
32 struct stat newst; 32 struct stat newst;
33 const char *delim = "/"; 33 const char *delim = "/";
34 34
35 if (! (command->states & state))
36 return util_finish (command, RESP_BAD, "Wrong state");
37
38 oldname = util_getword (arg, &sp); 35 oldname = util_getword (arg, &sp);
39 newname = util_getword (NULL, &sp); 36 newname = util_getword (NULL, &sp);
40 if (!newname || !oldname) 37 if (!newname || !oldname)
......
...@@ -194,9 +194,6 @@ imap4d_search (struct imap4d_command *command, char *arg) ...@@ -194,9 +194,6 @@ imap4d_search (struct imap4d_command *command, char *arg)
194 int rc; 194 int rc;
195 char buffer[64]; 195 char buffer[64];
196 196
197 if (! (command->states & state))
198 return util_finish (command, RESP_BAD, "Wrong state");
199
200 rc = imap4d_search0 (arg, 0, buffer, sizeof buffer); 197 rc = imap4d_search0 (arg, 0, buffer, sizeof buffer);
201 return util_finish (command, rc, buffer); 198 return util_finish (command, rc, buffer);
202 } 199 }
......
...@@ -24,8 +24,6 @@ static int select_flags; ...@@ -24,8 +24,6 @@ static int select_flags;
24 int 24 int
25 imap4d_select (struct imap4d_command *command, char *arg) 25 imap4d_select (struct imap4d_command *command, char *arg)
26 { 26 {
27 if (! (command->states & state))
28 return util_finish (command, RESP_BAD, "Wrong state");
29 return imap4d_select0 (command, arg, MU_STREAM_RDWR); 27 return imap4d_select0 (command, arg, MU_STREAM_RDWR);
30 } 28 }
31 29
......
...@@ -64,9 +64,6 @@ imap4d_status (struct imap4d_command *command, char *arg) ...@@ -64,9 +64,6 @@ imap4d_status (struct imap4d_command *command, char *arg)
64 int count = 0; 64 int count = 0;
65 char *err_msg = NULL; 65 char *err_msg = NULL;
66 66
67 if (! (command->states & state))
68 return util_finish (command, RESP_BAD, "Wrong state");
69
70 name = util_getword (arg, &sp); 67 name = util_getword (arg, &sp);
71 util_unquote (&name); 68 util_unquote (&name);
72 if (!name || *name == '\0' || !sp || *sp == '\0') 69 if (!name || *name == '\0' || !sp || *sp == '\0')
......
...@@ -27,9 +27,6 @@ imap4d_store (struct imap4d_command *command, char *arg) ...@@ -27,9 +27,6 @@ imap4d_store (struct imap4d_command *command, char *arg)
27 int rc; 27 int rc;
28 char buffer[64]; 28 char buffer[64];
29 29
30 if (! (command->states & state))
31 return util_finish (command, RESP_BAD, "Wrong state");
32
33 rc = imap4d_store0 (arg, 0, buffer, sizeof buffer); 30 rc = imap4d_store0 (arg, 0, buffer, sizeof buffer);
34 return util_finish (command, rc, buffer); 31 return util_finish (command, rc, buffer);
35 } 32 }
......
...@@ -29,9 +29,6 @@ imap4d_subscribe (struct imap4d_command *command, char *arg) ...@@ -29,9 +29,6 @@ imap4d_subscribe (struct imap4d_command *command, char *arg)
29 char *file; 29 char *file;
30 FILE *fp; 30 FILE *fp;
31 31
32 if (! (command->states & state))
33 return util_finish (command, RESP_BAD, "Wrong state");
34
35 name = util_getword (arg, &sp); 32 name = util_getword (arg, &sp);
36 util_unquote (&name); 33 util_unquote (&name);
37 if (!name || *name == '\0') 34 if (!name || *name == '\0')
......
...@@ -30,9 +30,6 @@ imap4d_uid (struct imap4d_command *command, char *arg) ...@@ -30,9 +30,6 @@ imap4d_uid (struct imap4d_command *command, char *arg)
30 int rc = RESP_NO; 30 int rc = RESP_NO;
31 char buffer[64]; 31 char buffer[64];
32 32
33 if (! (command->states & state))
34 return util_finish (command, RESP_BAD, "Wrong state");
35
36 cmd = util_getword (arg, &sp); 33 cmd = util_getword (arg, &sp);
37 if (!cmd) 34 if (!cmd)
38 util_finish (command, RESP_BAD, "Too few args"); 35 util_finish (command, RESP_BAD, "Too few args");
......
...@@ -29,9 +29,6 @@ imap4d_unsubscribe (struct imap4d_command *command, char *arg) ...@@ -29,9 +29,6 @@ imap4d_unsubscribe (struct imap4d_command *command, char *arg)
29 char *file; 29 char *file;
30 FILE *fp; 30 FILE *fp;
31 31
32 if (! (command->states & state))
33 return util_finish (command, RESP_BAD, "Wrong state");
34
35 name = util_getword (arg, &sp); 32 name = util_getword (arg, &sp);
36 util_unquote (&name); 33 util_unquote (&name);
37 if (!name || *name == '\0') 34 if (!name || *name == '\0')
......