+2007-04-02 10:02 -0700 Brendan Cully <brendan@kublai.com> (becbad651ecc)
+
+ * imap/imap.c: Cache IMAP access checks
+
+2007-04-01 23:12 -0700 Brendan Cully <brendan@kublai.com> (4f598543d7a5)
+
+ * imap/imap.c, imap/message.c: Adjust context->size on IMAP load
+ and expunge (closes #2749)
+
2007-04-01 20:00 -0700 Ambrose Li <a.c.li@ieee.org> (38e896c4c192)
* po/zh_TW.po: Updated Taiwanese translation
int count;
IMAP_STATUS *status, sb;
int olduv, oldun;
-#if USE_HCACHE
- header_cache_t *hc = NULL;
- unsigned int *uidvalidity = NULL;
- unsigned int *uidnext = NULL;
-#endif
mailbox = imap_next_word (s);
s = imap_next_word (mailbox);
dprint (3, (debugfile, "Found %s in buffy list (OV: %d ON: %d U: %d)\n",
mailbox, olduv, oldun, status->unseen));
-#if USE_HCACHE
- /* fetch seen info from hcache if we haven't seen it yet this session */
- if (!olduv && !oldun)
- {
- hc = mutt_hcache_open (HeaderCache, inc->path);
- if (hc)
- {
- uidvalidity = mutt_hcache_fetch_raw (hc, "/UIDVALIDITY", imap_hcache_keylen);
- uidnext = mutt_hcache_fetch_raw (hc, "/UIDNEXT", imap_hcache_keylen);
- olduv = uidvalidity ? *uidvalidity : 0;
- oldun = uidnext ? *uidnext : 0;
- FREE (&uidvalidity);
- FREE (&uidnext);
- mutt_hcache_close (hc);
- dprint (3, (debugfile, "hcache olduv %d, oldun %d\n", olduv, oldun));
- }
- }
-#endif
if (olduv && olduv == status->uidvalidity)
{
if (oldun < status->uidnext)
{
LIST* cur;
IMAP_STATUS* status;
+ IMAP_STATUS scache;
+#ifdef USE_HCACHE
+ header_cache_t *hc = NULL;
+ ciss_url_t url;
+ char urlstr[LONG_STRING];
+ unsigned int *uidvalidity = NULL;
+ unsigned int *uidnext = NULL;
+ char* path;
+#endif
for (cur = idata->mboxcache; cur; cur = cur->next)
{
if (!imap_mxcmp (mbox, status->name))
return status;
}
-
- return NULL;
+ status = NULL;
+
+#ifdef USE_HCACHE
+ path = safe_strdup (idata->ctx->path);
+ url_parse_ciss (&url, path);
+ url.path = (char*)mbox;
+ url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0);
+ FREE (&path);
+ hc = mutt_hcache_open (HeaderCache, urlstr);
+ if (hc)
+ {
+ uidvalidity = mutt_hcache_fetch_raw (hc, "/UIDVALIDITY", imap_hcache_keylen);
+ uidnext = mutt_hcache_fetch_raw (hc, "/UIDNEXT", imap_hcache_keylen);
+ if (uidvalidity)
+ {
+ /* lame */
+ memset (&scache, 0, sizeof (scache));
+ scache.name = (char*)mbox;
+ idata->mboxcache = mutt_add_list_n (idata->mboxcache, &scache,
+ sizeof (scache));
+ status = imap_mboxcache_get (idata, mbox);
+ status->name = safe_strdup (mbox);
+ status->uidvalidity = *uidvalidity;
+ status->uidnext = uidnext ? *uidnext: 0;
+ dprint (3, (debugfile, "mboxcache: hcache uidvalidity %d, uidnext %d\n",
+ status->uidvalidity, status->uidnext));
+ }
+ FREE (&uidvalidity);
+ FREE (&uidnext);
+ mutt_hcache_close (hc);
+ }
+#endif
+
+ return status;
}
void imap_mboxcache_free (IMAP_DATA* idata)