-2007-04-10 19:19 -0700 Brendan Cully <brendan@kublai.com> (ddd38b4cf15c)
+2007-04-10 19:28 -0700 Brendan Cully <brendan@kublai.com> (d12143e1a610)
+
+ * hcache.c: Try to unlink old header cache if open fails
+
+ * bcache.c, imap/imap.c, imap/util.c, lib.c: Fix some warnings
* hcache.c: Refactor mutt_hcache_open to share more code
The keys used are:
!: modified feature, -: deleted feature, +: new feature
+ + $message_cache_clean (clean cache on sync)
+
1.5.15 (2007-04-06)
- $imap_home_namespace (useless clutter)
idata->state = IMAP_AUTHENTICATED;
}
+ if (option (OPTMESSAGECACHECLEAN))
+ imap_cache_clean (idata);
+
rc = 0;
+
out:
if (cmd.data)
FREE (&cmd.data);
int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend);
char* imap_set_flags (IMAP_DATA* idata, HEADER* h, char* s);
int imap_cache_del (IMAP_DATA* idata, HEADER* h);
+int imap_cache_clean (IMAP_DATA* idata);
/* util.c */
#ifdef USE_HCACHE
return mutt_bcache_del (idata->bcache, id);
}
+static int msg_cache_clean_cb (const char* id, body_cache_t* bcache, void* data)
+{
+ unsigned int uv, uid, n;
+ IMAP_DATA* idata = (IMAP_DATA*)data;
+
+ if (sscanf (id, "%u-%u", &uv, &uid) != 2)
+ return 0;
+
+ /* bad UID */
+ if (uv != idata->uid_validity)
+ mutt_bcache_del (bcache, id);
+
+ /* TODO: presort UIDs, walk in order */
+ for (n = 0; n < idata->ctx->msgcount; n++)
+ {
+ if (uid == HEADER_DATA(idata->ctx->hdrs[n])->uid)
+ return 0;
+ }
+ mutt_bcache_del (bcache, id);
+
+ return 0;
+}
+
+int imap_cache_clean (IMAP_DATA* idata)
+{
+ idata->bcache = msg_cache_open (idata);
+ mutt_bcache_list (idata->bcache, msg_cache_clean_cb, idata);
+
+ return 0;
+}
+
/* imap_add_keywords: concatenate custom IMAP tags to list, if they
* appear in the folder flags list. Why wouldn't they? */
void imap_add_keywords (char* s, HEADER* h, LIST* mailbox_flags, size_t slen)
** time, for instance if stale entries accumulate because you have
** deleted messages with another mail client.
*/
+ { "message_cache_clean", DT_BOOL, R_NONE, OPTMESSAGECACHECLEAN, 0 },
+ /*
+ ** .pp
+ ** If set, mutt will clean out obsolete entries from the cache when
+ ** the mailbox is synchronized. You probably only want to set it
+ ** every once in a while, since it can be a little slow.
+ */
#endif
{ "message_format", DT_STR, R_NONE, UL &MsgFmt, UL "%s" },
/*
OPTMARKOLD,
OPTMENUSCROLL, /* scroll menu instead of implicit next-page */
OPTMENUMOVEOFF, /* allow menu to scroll past last entry */
+#if defined(USE_IMAP) || defined(USE_POP)
+ OPTMESSAGECACHECLEAN,
+#endif
OPTMETAKEY, /* interpret ALT-x as ESC-x */
OPTMETOO,
OPTMHPURGE,