]> granicus.if.org Git - mutt/commitdiff
Remove deleted entries from header cache on CLOSE.
authorBrendan Cully <brendan@kublai.com>
Tue, 20 Dec 2005 17:42:44 +0000 (17:42 +0000)
committerBrendan Cully <brendan@kublai.com>
Tue, 20 Dec 2005 17:42:44 +0000 (17:42 +0000)
imap/imap.c

index 51de3db50db893885c1d5c93ac2555b98528beba..0d1a0ffd38b3966647803d44eca367b757602224 100644 (file)
@@ -1076,7 +1076,11 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int* index_hint)
   int deleted;
   int n;
   int rc;
-
+#if USE_HCACHE
+  void* hc = NULL;
+  char uidbuf[32];
+#endif
+  
   idata = (IMAP_DATA*) ctx->data;
 
   if (idata->state < IMAP_SELECTED)
@@ -1120,9 +1124,22 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int* index_hint)
     }
   }
 
+
+#if USE_HCACHE
+  if (expunge && ctx->closing)
+    hc = mutt_hcache_open (HeaderCache, idata->ctx->path);
+#endif
+
   /* save messages with real (non-flag) changes */
   for (n = 0; n < ctx->msgcount; n++)
   {
+#if USE_HCACHE
+    if (hc && ctx->hdrs[n]->deleted)
+    {
+      sprintf (uidbuf, "/%u", HEADER_DATA(ctx->hdrs[n])->uid);
+      mutt_hcache_delete (hc, uidbuf, imap_hcache_keylen);
+    }
+#endif    
     if (ctx->hdrs[n]->active && ctx->hdrs[n]->changed)
     {
       /* if the message has been rethreaded or attachments have been deleted
@@ -1200,6 +1217,9 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int* index_hint)
 
   rc = 0;
  out:
+#if USE_HCACHE
+  mutt_hcache_close (hc);
+#endif
   if (cmd.data)
     FREE (&cmd.data);
   if (appendctx)