Browse Source

fix -C for imap mailboxes:

- SELECT does not return [TRYCREATE]
- fix bit field truncation
wip/ssl-fprint
Oswald Buddenhagen 21 years ago
parent
commit
1b75236135
  1. 9
      src/drv_imap.c

9
src/drv_imap.c

@ -132,7 +132,7 @@ struct imap_cmd_cb {
char *data; char *data;
int dlen; int dlen;
int uid; int uid;
unsigned create:1; unsigned create:1, trycreate:1;
}; };
struct imap_cmd { struct imap_cmd {
@ -997,7 +997,7 @@ get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
resp = DRV_OK; resp = DRV_OK;
else { else {
if (!strcmp( "NO", arg )) { if (!strcmp( "NO", arg )) {
if (cmdp->cb.create && cmd && !memcmp( cmd, "[TRYCREATE]", 11 )) { /* SELECT, APPEND or UID COPY */ if (cmdp->cb.create && cmd && (cmdp->cb.trycreate || !memcmp( cmd, "[TRYCREATE]", 11 ))) { /* SELECT, APPEND or UID COPY */
p = strchr( cmdp->cmd, '"' ); p = strchr( cmdp->cmd, '"' );
if (!issue_imap_cmd( ctx, 0, "CREATE %.*s", strchr( p + 1, '"' ) - p + 1, p )) { if (!issue_imap_cmd( ctx, 0, "CREATE %.*s", strchr( p + 1, '"' ) - p + 1, p )) {
resp = RESP_BAD; resp = RESP_BAD;
@ -1421,7 +1421,8 @@ imap_select( store_t *gctx, int minuid, int maxuid, int *excs, int nexcs )
} }
memset( &cb, 0, sizeof(cb) ); memset( &cb, 0, sizeof(cb) );
cb.create = gctx->opts & OPEN_CREATE; cb.create = (gctx->opts & OPEN_CREATE) != 0;
cb.trycreate = 1;
if ((ret = imap_exec_b( ctx, &cb, "SELECT \"%s%s\"", prefix, gctx->name )) != DRV_OK) if ((ret = imap_exec_b( ctx, &cb, "SELECT \"%s%s\"", prefix, gctx->name )) != DRV_OK)
goto bail; goto bail;
@ -1635,7 +1636,7 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int *uid )
} else { } else {
box = gctx->name; box = gctx->name;
prefix = !strcmp( box, "INBOX" ) ? "" : ctx->prefix; prefix = !strcmp( box, "INBOX" ) ? "" : ctx->prefix;
cb.create = gctx->opts & OPEN_CREATE; cb.create = (gctx->opts & OPEN_CREATE) != 0;
/*if (ctx->currentnc) /*if (ctx->currentnc)
imap->caps = imap->rcaps & ~(1 << LITERALPLUS);*/ imap->caps = imap->rcaps & ~(1 << LITERALPLUS);*/
} }

Loading…
Cancel
Save