commit edbf9a35daf954ad1a032e1030269f8119b0fa78
parent 04c7126ce9770fa5953c25953cd67e0169f34500
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date: Wed, 29 Dec 2021 14:20:04 +0100
use UID EXPUNGE also when trashing remotely
amends 2f0fbcd3.
Diffstat:
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/driver.h b/src/driver.h
@@ -97,6 +97,9 @@ BIT_ENUM(
OPEN_APPEND,
OPEN_SETFLAGS,
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)
diff --git a/src/drv_imap.c b/src/drv_imap.c
@@ -2812,6 +2812,8 @@ imap_prepare_load_box( store_t *gctx, uint opts )
{
imap_store_t *ctx = (imap_store_t *)gctx;
+ if (!CAP(UIDPLUS))
+ opts &= ~OPEN_UID_EXPUNGE;
ctx->opts = opts;
return opts;
}
@@ -3129,7 +3131,7 @@ imap_close_box( store_t *gctx,
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)
imap_message_t *msg, *fmsg, *nmsg;
int bl;
diff --git a/src/drv_maildir.c b/src/drv_maildir.c
@@ -1406,7 +1406,7 @@ maildir_prepare_load_box( store_t *gctx, uint opts )
if (opts & OPEN_SETFLAGS)
opts |= OPEN_PAIRED;
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;
return opts;
}
diff --git a/src/sync.c b/src/sync.c
@@ -793,9 +793,9 @@ box_opened2( sync_vars_t *svars, int t )
if (chan->stores[t]->trash) {
if (!chan->stores[t]->trash_only_new)
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) {
- opts[t] |= OPEN_NEW|OPEN_FLAGS;
+ opts[t] |= OPEN_NEW | OPEN_FLAGS | OPEN_UID_EXPUNGE;
}
}
}