after [TRYCREATE], just resend the same command instead of cloning it

This commit is contained in:
Oswald Buddenhagen 2010-11-20 10:17:41 +01:00
parent 83efbe327d
commit 17dc64b414

View File

@ -509,6 +509,7 @@ v_submit_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd,
if (!cmd) if (!cmd)
cmd = new_imap_cmd(); cmd = new_imap_cmd();
cmd->tag = ++ctx->nexttag; cmd->tag = ++ctx->nexttag;
if (fmt)
nfvasprintf( &cmd->cmd, fmt, ap ); nfvasprintf( &cmd->cmd, fmt, ap );
if (!cmd->param.data) { if (!cmd->param.data) {
buffmt = "%d %s\r\n"; buffmt = "%d %s\r\n";
@ -996,7 +997,7 @@ parse_list_rsp( imap_store_t *ctx, char *cmd )
static int static int
get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd ) get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
{ {
struct imap_cmd *cmdp, **pcmdp, *ncmdp; struct imap_cmd *cmdp, **pcmdp;
char *cmd, *arg, *arg1, *p; char *cmd, *arg, *arg1, *p;
int n, resp, resp2, tag; int n, resp, resp2, tag;
@ -1095,19 +1096,13 @@ get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
} }
/* not waiting here violates the spec, but a server that does not /* not waiting here violates the spec, but a server that does not
grok this nonetheless violates it too. */ grok this nonetheless violates it too. */
ncmdp = nfmalloc( sizeof(*ncmdp) ); cmdp->param.create = 0;
memcpy( &ncmdp->param, &cmdp->param, sizeof(cmdp->param) ); if (!submit_imap_cmd( ctx, cmdp, 0 )) {
ncmdp->param.create = 0;
if (!submit_imap_cmd( ctx, ncmdp, "%s", cmdp->cmd )) {
resp = RESP_BAD; resp = RESP_BAD;
goto normal; goto abnormal;
} }
free( cmdp->cmd );
free( cmdp );
if (!tcmd) if (!tcmd)
return 0; /* ignored */ return 0; /* ignored */
if (cmdp == tcmd)
tcmd = ncmdp;
continue; continue;
} }
resp = RESP_NO; resp = RESP_NO;
@ -1125,6 +1120,7 @@ get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
free( cmdp->param.data ); free( cmdp->param.data );
free( cmdp->cmd ); free( cmdp->cmd );
free( cmdp ); free( cmdp );
abnormal:
if (!tcmd || tcmd == cmdp) if (!tcmd || tcmd == cmdp)
return resp; return resp;
} }