]> granicus.if.org Git - neomutt/commitdiff
patch-bac.expunge-2
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 30 Aug 2000 08:43:12 +0000 (08:43 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 30 Aug 2000 08:43:12 +0000 (08:43 +0000)
imap/command.c
imap/imap.c
imap/message.c
imap/message.h

index bc8df99489b2237772c68266bea069dbef99340c..74c5318380a80495eaca51b50020dd88c1f76964 100644 (file)
@@ -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;
index 558833df842fe7e3b897e5e6a002d10548aa077c..fa0525acf563cbad6dbe5d77eb201d88b55308a8 100644 (file)
@@ -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));
 
index 9db78bb1a542084a356814648be6afa903a512b8..3a317fe1939c44d936c14049de8dffbaffa669f3 100644 (file)
@@ -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);
index af7ebd7fd0ca6470bf79ae2a01abc8b7cab9d596..78c5dc3e33fa066bd6d5f5de3766174437810600 100644 (file)
@@ -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;