stat the directory on open.
Make IMAP close function match prototype.
-2007-03-30 00:21 -0700 Brendan Cully <brendan@kublai.com> (0cb476dc70a7)
+2007-03-30 19:22 -0700 Brendan Cully <brendan@kublai.com> (e9451c4c0092)
+
+ * imap/imap.c, mutt.h, mx.c, pop.c: Add function pointer for close
+ hook in Context. Slowly inch towards function pointers instead of
+ switch statements.
+
+ * imap/command.c, imap/imap.c: Use RECENT for first mailbox
+ check if header cache check fails
* imap/command.c: Consult header cache if available for last known new
mail count. This prevents mutt from announcing new mail in mailboxes
}
/* imap_close_mailbox: clean up IMAP data in CONTEXT */
-void imap_close_mailbox (CONTEXT* ctx)
+int imap_close_mailbox (CONTEXT* ctx)
{
IMAP_DATA* idata;
int i;
idata = (IMAP_DATA*) ctx->data;
/* Check to see if the mailbox is actually open */
if (!idata)
- return;
+ return 0;
if (ctx == idata->ctx)
{
}
mutt_bcache_close (&idata->bcache);
+
+ return 0;
}
/* use the NOOP or IDLE command to poll for new mail
int imap_open_mailbox (CONTEXT *ctx);
int imap_open_mailbox_append (CONTEXT *ctx);
int imap_sync_mailbox (CONTEXT *ctx, int expunge, int *index_hint);
-void imap_close_mailbox (CONTEXT *ctx);
+int imap_close_mailbox (CONTEXT *ctx);
int imap_buffy_check (int force);
int imap_status (char *path, int queue);
int imap_search (CONTEXT* ctx, const pattern_t* pat);
short *flags;
};
+struct mh_data
+{
+ mode_t mode; /* mode of mail folder. New messages should match. */
+};
+
/* mh_sequences support */
#define MH_SEQ_UNSEEN (1 << 0)
#endif
}
+static int mh_close_mailbox (CONTEXT *ctx)
+{
+ FREE (&ctx->data);
+
+ return 0;
+}
+
/* Read a MH/maildir style mailbox.
*
* args:
struct maildir *md;
struct mh_sequences mhs;
struct maildir **last;
+ struct mh_data *data;
+ struct stat st;
int count;
char msgbuf[STRING];
progress_t progress;
maildir_delayed_parsing (ctx, md, &progress);
maildir_move_to_context (ctx, &md);
+
+ if (!ctx->data)
+ {
+ ctx->data = safe_calloc(sizeof (struct mh_data), 1);
+ data = (struct mh_data *)ctx->data;
+ if (stat (ctx->path, &st))
+ {
+ /* shouldn't happen this late */
+ dprint (1, (debugfile, "stat failed opening maildir\n"));
+ data->mode = 0700;
+ }
+ else
+ data->mode = st.st_mode;
+
+ ctx->mx_close = mh_close_mailbox;
+ }
+
return 0;
}