From: Thomas Roessler Date: Wed, 30 Aug 2000 08:43:12 +0000 (+0000) Subject: patch-bac.expunge-2 X-Git-Tag: mutt-1-3-8-rel~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c120ed2848eb3c59a320804f21d2b3fdd075f25b;p=mutt patch-bac.expunge-2 --- diff --git a/imap/command.c b/imap/command.c index bc8df994..74c53183 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 558833df..fa0525ac 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 9db78bb1..3a317fe1 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 af7ebd7f..78c5dc3e 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;