diff options
author | Kevin McCarthy <kevin@8t8.us> | 2021-09-09 09:24:51 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2021-09-09 09:24:51 -0700 |
commit | 395a5a1d2e6b0e2910b0d6fd44739b7e4d177df9 (patch) | |
tree | 8a2d1ff15ae028d5ac82476f6adfac6470e6bc35 | |
parent | a6d83ff61c1f9c26fa504e27c8fefbc6f675a6b9 (diff) | |
parent | a547111ac4d73029cf1e23e429f3a0cff1ec0d50 (diff) |
Merge branch 'stable'
-rw-r--r-- | imap/imap.c | 6 | ||||
-rw-r--r-- | imap/message.c | 30 |
2 files changed, 33 insertions, 3 deletions
diff --git a/imap/imap.c b/imap/imap.c index 349590cc..a419abb6 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1135,7 +1135,11 @@ static int compare_uid (const void *a, const void *b) HEADER **pa = (HEADER **) a; HEADER **pb = (HEADER **) b; - return HEADER_DATA(*pa)->uid - HEADER_DATA(*pb)->uid; + if (HEADER_DATA(*pa)->uid < HEADER_DATA(*pb)->uid) + return -1; + if (HEADER_DATA(*pa)->uid > HEADER_DATA(*pb)->uid) + return 1; + return 0; } /* Note: headers must be in SORT_UID. See imap_exec_msgset for args. diff --git a/imap/message.c b/imap/message.c index 64f5cea0..376b91dc 100644 --- a/imap/message.c +++ b/imap/message.c @@ -32,6 +32,8 @@ #include "mutt.h" #include "imap_private.h" #include "mx.h" +#include "globals.h" +#include "sort.h" #ifdef HAVE_PGP #include "pgp.h" @@ -623,9 +625,22 @@ static int read_headers_qresync_eval_cache (IMAP_DATA *idata, char *uid_seqset) ctx->size += h->content->length; ctx->hdrs[ctx->msgcount++] = h; - } - msn++; + msn++; + } + /* A non-zero uid missing from the header cache is either the + * result of an expunged message (not recorded in the uid seqset) + * or a hole in the header cache. + * + * We have to assume it's an earlier expunge and compact the msn's + * in that case, because cmd_parse_vanished() won't find it in the + * uid_hash and decrement later msn's there. + * + * Thus we only increment the uid if the uid was 0: an actual + * stored "blank" in the uid seqset. + */ + else if (!uid) + msn++; } mutt_seqset_iterator_free (&iter); @@ -713,8 +728,13 @@ static int read_headers_condstore_qresync_updates (IMAP_DATA *idata, /* VANISHED handling: we need to empty out the messages */ if (idata->reopen & IMAP_EXPUNGE_PENDING) { + short old_sort; imap_hcache_close (idata); + + old_sort = Sort; + Sort = SORT_ORDER; imap_expunge_mailbox (idata); + Sort = old_sort; idata->hcache = imap_hcache_open (idata, NULL); idata->reopen &= ~IMAP_EXPUNGE_PENDING; @@ -773,6 +793,11 @@ fail: hash_destroy (&idata->uid_hash, NULL); + hash_destroy (&ctx->subj_hash, NULL); + hash_destroy (&ctx->id_hash, NULL); + hash_destroy (&ctx->label_hash, NULL); + mutt_clear_threads (ctx); + for (i = 0; i < ctx->msgcount; i++) { if (ctx->hdrs[i] && ctx->hdrs[i]->data) @@ -780,6 +805,7 @@ fail: mutt_free_header (&ctx->hdrs[i]); } ctx->msgcount = 0; + ctx->size = 0; mutt_hcache_delete (idata->hcache, "/MODSEQ", imap_hcache_keylen); imap_hcache_clear_uid_seqset (idata); |