use UID EXPUNGE also when trashing remotely

amends 2f0fbcd3.
This commit is contained in:
Oswald Buddenhagen 2021-12-29 14:20:04 +01:00
parent 04c7126ce9
commit edbf9a35da
4 changed files with 9 additions and 4 deletions

View File

@ -97,6 +97,9 @@ BIT_ENUM(
OPEN_APPEND, OPEN_APPEND,
OPEN_SETFLAGS, OPEN_SETFLAGS,
OPEN_EXPUNGE, OPEN_EXPUNGE,
// Expunge only deleted messages we know about. Relies on OPEN_{OLD,NEW,FLAGS}
// being set externally. The driver may unset it if it can't handle it.
OPEN_UID_EXPUNGE,
) )
#define UIDVAL_BAD ((uint)-1) #define UIDVAL_BAD ((uint)-1)

View File

@ -2812,6 +2812,8 @@ imap_prepare_load_box( store_t *gctx, uint opts )
{ {
imap_store_t *ctx = (imap_store_t *)gctx; imap_store_t *ctx = (imap_store_t *)gctx;
if (!CAP(UIDPLUS))
opts &= ~OPEN_UID_EXPUNGE;
ctx->opts = opts; ctx->opts = opts;
return opts; return opts;
} }
@ -3129,7 +3131,7 @@ imap_close_box( store_t *gctx,
assert( !ctx->num_wait_check ); assert( !ctx->num_wait_check );
if (ctx->conf->trash && CAP(UIDPLUS)) { if (ctx->opts & OPEN_UID_EXPUNGE) {
INIT_REFCOUNTED_STATE(imap_expunge_state_t, sts, cb, aux) INIT_REFCOUNTED_STATE(imap_expunge_state_t, sts, cb, aux)
imap_message_t *msg, *fmsg, *nmsg; imap_message_t *msg, *fmsg, *nmsg;
int bl; int bl;

View File

@ -1406,7 +1406,7 @@ maildir_prepare_load_box( store_t *gctx, uint opts )
if (opts & OPEN_SETFLAGS) if (opts & OPEN_SETFLAGS)
opts |= OPEN_PAIRED; opts |= OPEN_PAIRED;
if (opts & OPEN_EXPUNGE) if (opts & OPEN_EXPUNGE)
opts |= OPEN_PAIRED | OPEN_OLD | OPEN_NEW | OPEN_FLAGS; opts |= OPEN_PAIRED | OPEN_OLD | OPEN_NEW | OPEN_FLAGS | OPEN_UID_EXPUNGE;
ctx->opts = opts; ctx->opts = opts;
return opts; return opts;
} }

View File

@ -793,9 +793,9 @@ box_opened2( sync_vars_t *svars, int t )
if (chan->stores[t]->trash) { if (chan->stores[t]->trash) {
if (!chan->stores[t]->trash_only_new) if (!chan->stores[t]->trash_only_new)
opts[t] |= OPEN_OLD; opts[t] |= OPEN_OLD;
opts[t] |= OPEN_NEW|OPEN_FLAGS; opts[t] |= OPEN_NEW | OPEN_FLAGS | OPEN_UID_EXPUNGE;
} else if (chan->stores[t^1]->trash && chan->stores[t^1]->trash_remote_new) { } else if (chan->stores[t^1]->trash && chan->stores[t^1]->trash_remote_new) {
opts[t] |= OPEN_NEW|OPEN_FLAGS; opts[t] |= OPEN_NEW | OPEN_FLAGS | OPEN_UID_EXPUNGE;
} }
} }
} }