-void mx_init (void) {
-#ifdef DEBUG
- int i = 0;
-#endif
- list_push_back (&MailboxFormats, (void*) mbox_reg_mx ());
- list_push_back (&MailboxFormats, (void*) mmdf_reg_mx ());
- list_push_back (&MailboxFormats, (void*) mh_reg_mx ());
- list_push_back (&MailboxFormats, (void*) maildir_reg_mx ());
-#ifdef USE_IMAP
- list_push_back (&MailboxFormats, (void*) imap_reg_mx ());
-#endif
-#ifdef USE_POP
- list_push_back (&MailboxFormats, (void*) pop_reg_mx ());
-#endif
-#ifdef USE_NNTP
- list_push_back (&MailboxFormats, (void*) nntp_reg_mx ());
-#endif
-#ifdef USE_COMPRESSED
- list_push_back (&MailboxFormats, (void*) compress_reg_mx ());
-#endif
-#ifdef DEBUG
- /* check module registration for completeness with debug versions */
-#define EXITWITHERR(m) do { fprintf(stderr, "error: incomplete mx module: %s is missing for type %i\n",m,i);exit(1); } while (0)
- for (i = 0; i < MailboxFormats->length; i++) {
- if (MX_COMMAND(i,type) < 1) EXITWITHERR("type");
- if (!MX_COMMAND(i,mx_is_magic)) EXITWITHERR("mx_is_magic");
- if (!MX_COMMAND(i,mx_open_mailbox)) EXITWITHERR("mx_open_mailbox");
-/* if (!MX_COMMAND(i,mx_sync_mailbox)) EXITWITHERR("mx_sync_mailbox");*/
+int mx_rebuild_cache (void) {
+#ifndef USE_HCACHE
+ mutt_error (_("Support for header caching was not build in."));
+ return (1);
+#else
+ int i = 0, magic = 0;
+ CONTEXT* ctx = NULL;
+ BUFFY* b = NULL;
+
+ if (!Incoming.len) {
+ mutt_error (_("No mailboxes defined."));
+ return (1);
+ }
+
+ for (i = 0; i < Incoming.len; i++) {
+ b = Incoming.arr[i];
+ magic = mx_get_magic (b->path);
+ if (magic != M_MAILDIR && magic != M_MH && magic != M_IMAP)
+ continue;
+ sidebar_set_current (b->path);
+ sidebar_draw ();
+ if ((ctx = mx_open_mailbox (b->path,
+ M_READONLY | M_NOSORT | M_COUNT,
+ NULL)) != NULL)
+ mx_close_mailbox (ctx, 0);