static int maildir_parse_entry (CONTEXT * ctx, struct maildir ***last,
const char *subdir, const char *fname,
- int *count, int is_old, ino_t inode)
+ int *count, int is_old, ino_t inode,
+ void *hc)
{
struct maildir *entry;
HEADER *h = NULL;
char buf[_POSIX_PATH_MAX];
+#if USE_HCACHE
+ void *data;
+#endif
if (subdir)
snprintf (buf, sizeof (buf), "%s/%s/%s", ctx->path, subdir, fname);
snprintf (buf, sizeof (buf), "%s/%s", ctx->path, fname);
if (ctx->magic == M_MH)
+ {
+#ifdef USE_HCACHE
+ if (hc && (data = mutt_hcache_fetch (hc, fname, strlen)))
+ h = mutt_hcache_restore ((unsigned char *) data, NULL);
+ else
+#endif
h = maildir_parse_message (ctx->magic, buf, is_old, NULL);
+ }
else
{
h = mutt_new_header ();
struct dirent *de;
char buf[_POSIX_PATH_MAX];
int is_old = 0;
+ void *hc = NULL;
if (subdir)
{
if ((dirp = opendir (buf)) == NULL)
return -1;
+#ifdef USE_HCACHE
+ if (ctx && ctx->magic == M_MH)
+ hc = mutt_hcache_open (HeaderCache, ctx->path);
+#endif
+
while ((de = readdir (dirp)) != NULL)
{
#else
0
#endif
- );
+ , hc);
}
closedir (dirp);
+
+#if USE_HCACHE
+ mutt_hcache_close (hc);
+#endif
+
return 0;
}
return i;
#if USE_HCACHE
- if (ctx->magic == M_MAILDIR)
+ if (ctx->magic == M_MAILDIR || ctx->magic == M_MH)
hc = mutt_hcache_open(HeaderCache, ctx->path);
#endif /* USE_HCACHE */
#if USE_HCACHE
if (ctx->magic == M_MAILDIR)
mutt_hcache_delete (hc, ctx->hdrs[i]->path + 3, &maildir_hcache_keylen);
+ else if (ctx->magic == M_MH)
+ mutt_hcache_delete (hc, ctx->hdrs[i]->path, strlen);
#endif /* USE_HCACHE */
unlink (path);
}
}
#if USE_HCACHE
- if (ctx->magic == M_MAILDIR)
+ if (ctx->magic == M_MAILDIR || ctx->magic == M_MH)
mutt_hcache_close (hc);
#endif /* USE_HCACHE */
err:
#if USE_HCACHE
- if (ctx->magic == M_MAILDIR)
+ if (ctx->magic == M_MAILDIR || ctx->magic == M_MH)
mutt_hcache_close (hc);
#endif /* USE_HCACHE */
return -1;