From 558c74a8856de633c8d64a5ceb9b9ea2466a5556 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Wed, 30 Aug 2000 08:43:12 +0000 Subject: [PATCH] patch-bac.expunge-2 --- imap/command.c | 8 ++++---- imap/imap.c | 2 +- imap/message.c | 7 +++++-- imap/message.h | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/imap/command.c b/imap/command.c index bc8df9948..74c531838 100644 --- a/imap/command.c +++ b/imap/command.c @@ -411,10 +411,10 @@ static void cmd_parse_expunge (IMAP_DATA* idata, char* s) { h = idata->ctx->hdrs[cur]; - if (HEADER_DATA (h)->sid == expno) - HEADER_DATA (h)->sid = 0; - else if (HEADER_DATA (h)->sid > expno) - HEADER_DATA (h)->sid--; + if (h->index+1 == expno) + h->index = -1; + else if (h->index+1 > expno) + h->index--; } idata->reopen |= IMAP_EXPUNGE_PENDING; diff --git a/imap/imap.c b/imap/imap.c index 558833df8..fa0525acf 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -200,7 +200,7 @@ void imap_expunge_mailbox (IMAP_DATA* idata) { h = idata->ctx->hdrs[i]; - if (!HEADER_DATA(h)->sid) + if (h->index == -1) { dprint (2, (debugfile, "Expunging message UID %d.\n", HEADER_DATA (h)->uid)); diff --git a/imap/message.c b/imap/message.c index 9db78bb1a..3a317fe19 100644 --- a/imap/message.c +++ b/imap/message.c @@ -137,8 +137,11 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) /* update context with message header */ ctx->hdrs[msgno] = mutt_new_header (); - ctx->hdrs[msgno]->index = ctx->msgcount; + ctx->hdrs[msgno]->index = ctx->msgcount; + ctx->hdrs[msgno]->index = h.sid - 1; + if (h.sid != ctx->msgcount + 1) + dprint (1, (debugfile, "imap_read_headers: msgcount and sequence ID are inconsistent!")); /* messages which have not been expunged are ACTIVE (borrowed from mh * folders) */ ctx->hdrs[msgno]->active = 1; @@ -664,7 +667,7 @@ static int msg_fetch_header (CONTEXT* ctx, IMAP_HEADER* h, char* buf, FILE* fp) /* skip to message number */ buf = imap_next_word (buf); - h->data->sid = atoi (buf); + h->sid = atoi (buf); /* find FETCH tag */ buf = imap_next_word (buf); diff --git a/imap/message.h b/imap/message.h index af7ebd7fd..78c5dc3e3 100644 --- a/imap/message.h +++ b/imap/message.h @@ -26,7 +26,6 @@ /* IMAP-specific header data, stored as HEADER->data */ typedef struct imap_header_data { - unsigned int sid; /* server message sequence number */ unsigned int uid; /* 32-bit Message UID */ LIST *keywords; } IMAP_HEADER_DATA; @@ -40,6 +39,8 @@ typedef struct unsigned int replied : 1; unsigned int changed : 1; + unsigned int sid; + IMAP_HEADER_DATA* data; time_t received; -- 2.40.0