/**
* comp_mbox_check - Implements MxOps::mbox_check()
- * @param ctx Mailbox
+ * @param m Mailbox
* @param index_hint Currently selected mailbox
* @retval 0 Mailbox OK
* @retval #MUTT_REOPENED The mailbox was closed and reopened
*
* The return codes are picked to match mx_mbox_check().
*/
-static int comp_mbox_check(struct Context *ctx, int *index_hint)
+static int comp_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox || !ctx->mailbox->compress_info)
+ if (!m || !m->compress_info)
return -1;
- struct Mailbox *m = ctx->mailbox;
struct CompressInfo *ci = m->compress_info;
const struct MxOps *ops = ci->child_ops;
if (rc == 0)
return -1;
- return ops->mbox_check(ctx, index_hint);
+ return ops->mbox_check(m, index_hint);
}
/**
return -1;
}
- int rc = comp_mbox_check(ctx, index_hint);
+ int rc = comp_mbox_check(m, index_hint);
if (rc != 0)
goto sync_cleanup;
/**
* imap_mbox_check - Implements MxOps::mbox_check()
- * @param ctx Mailbox
+ * @param m Mailbox
* @param index_hint Remember our place in the index
* @retval >0 Success, e.g. #MUTT_REOPENED
* @retval -1 Failure
*/
-static int imap_mbox_check(struct Context *ctx, int *index_hint)
+static int imap_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
imap_allow_reopen(m);
int rc = imap_check_mailbox(m, false);
/* NOTE - ctx might have been changed at this point. In particular,
CUR_EMAIL->index :
0;
- check = mx_mbox_check(Context, &index_hint);
+ check = mx_mbox_check(Context->mailbox, &index_hint);
if (check < 0)
{
if (!Context->mailbox || Context->mailbox->path[0] == '\0')
* already knew about. We don't treat either subdirectory differently, as mail
* could be copied directly into the cur directory from another agent.
*/
-int maildir_mbox_check(struct Context *ctx, int *index_hint)
+int maildir_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
struct stat st_new; /* status of the "new" subdirectory */
struct stat st_cur; /* status of the "cur" subdirectory */
int changed = 0; /* bitmask representing which subdirectories
* the flags we just detected.
*/
if (!m->emails[i]->changed)
- if (maildir_update_flags(ctx->mailbox, m->emails[i], p->email))
+ if (maildir_update_flags(m, m->emails[i], p->email))
flags_changed = true;
if (m->emails[i]->deleted == m->emails[i]->trash)
/* MXAPI shared functions */
int maildir_ac_add (struct Account *a, struct Mailbox *m);
struct Account *maildir_ac_find (struct Account *a, const char *path);
-int maildir_mbox_check (struct Context *ctx, int *index_hint);
+int maildir_mbox_check (struct Mailbox *m, int *index_hint);
int maildir_path_canon (char *buf, size_t buflen);
int maildir_path_parent(char *buf, size_t buflen);
int maildir_path_pretty(char *buf, size_t buflen, const char *folder);
-int mh_mbox_check (struct Context *ctx, int *index_hint);
+int mh_mbox_check (struct Mailbox *m, int *index_hint);
int mh_mbox_close (struct Mailbox *m);
int mh_mbox_sync (struct Context *ctx, int *index_hint);
int mh_msg_close (struct Mailbox *m, struct Message *msg);
*
* Don't change this code unless you _really_ understand what happens.
*/
-int mh_mbox_check(struct Context *ctx, int *index_hint)
+int mh_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
char buf[PATH_MAX];
struct stat st, st_cur;
bool modified = false, occult = false, flags_changed = false;
m->emails[i]->active = true;
/* found the right message */
if (!m->emails[i]->changed)
- if (maildir_update_flags(ctx->mailbox, m->emails[i], p->email))
+ if (maildir_update_flags(m, m->emails[i], p->email))
flags_changed = true;
mutt_email_free(&p->email);
struct Progress progress;
if (m->magic == MUTT_MH)
- i = mh_mbox_check(ctx, index_hint);
+ i = mh_mbox_check(m, index_hint);
else
- i = maildir_mbox_check(ctx, index_hint);
+ i = maildir_mbox_check(m, index_hint);
if (i != 0)
return i;
/**
* mbox_mbox_check - Implements MxOps::mbox_check()
- * @param[in] ctx Mailbox
+ * @param[in] m Mailbox
* @param[out] index_hint Keep track of current index selection
* @retval #MUTT_REOPENED Mailbox has been reopened
* @retval #MUTT_NEW_MAIL New mail has arrived
* @retval 0 No change
* @retval -1 Error
*/
-static int mbox_mbox_check(struct Context *ctx, int *index_hint)
+static int mbox_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
struct MboxAccountData *adata = mbox_adata_get(m);
if (!adata)
return -1;
}
/* Check to make sure that the file hasn't changed on disk */
- i = mbox_mbox_check(ctx, index_hint);
+ i = mbox_mbox_check(m, index_hint);
if ((i == MUTT_NEW_MAIL) || (i == MUTT_REOPENED))
{
/* new mail arrived, or mailbox reopened */
/**
* mx_mbox_check - Check for new mail - Wrapper for MxOps::mbox_check()
- * @param ctx Mailbox
+ * @param m Mailbox
* @param index_hint Current email
* @retval >0 Success, e.g. #MUTT_NEW_MAIL
* @retval 0 Success, no change
* @retval -1 Failure
*/
-int mx_mbox_check(struct Context *ctx, int *index_hint)
+int mx_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox || !ctx->mailbox->mx_ops)
+ if (!m || !m->mx_ops)
return -1;
- struct Mailbox *m = ctx->mailbox;
- int rc = m->mx_ops->mbox_check(ctx, index_hint);
+ int rc = m->mx_ops->mbox_check(m, index_hint);
if (rc == MUTT_NEW_MAIL || rc == MUTT_REOPENED)
- {
- mx_update_context(ctx);
- }
+ mutt_mailbox_changed(m, MBN_INVALID);
return rc;
}
int (*mbox_open_append)(struct Mailbox *m, int flags);
/**
* mbox_check - Check for new mail
- * @param ctx Mailbox
+ * @param m Mailbox
* @param index_hint Remember our place in the index
* @retval >0 Success, e.g. #MUTT_REOPENED
* @retval -1 Error
*/
- int (*mbox_check) (struct Context *ctx, int *index_hint);
+ int (*mbox_check) (struct Mailbox *m, int *index_hint);
/**
* mbox_check_stats - Check the mailbox statistics
* @param m Mailbox to check
};
/* Wrappers for the Mailbox API, see MxOps */
-int mx_mbox_check (struct Context *ctx, int *index_hint);
+int mx_mbox_check (struct Mailbox *m, int *index_hint);
int mx_mbox_check_stats(struct Mailbox *m, int flags);
int mx_mbox_close (struct Context **pctx, int *index_hint);
struct Context *mx_mbox_open (struct Mailbox *m, const char *path, int flags);
/**
* nntp_mbox_check - Implements MxOps::mbox_check()
- * @param ctx Mailbox
+ * @param m Mailbox
* @param index_hint Current message (UNUSED)
* @retval #MUTT_REOPENED Articles have been renumbered or removed from server
* @retval #MUTT_NEW_MAIL New articles found
* @retval 0 No change
* @retval -1 Lost connection
*/
-static int nntp_mbox_check(struct Context *ctx, int *index_hint)
+static int nntp_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
int ret = check_mailbox(m);
if (ret == 0)
{
/**
* nm_mbox_check - Implements MxOps::mbox_check()
- * @param ctx Mailbox
+ * @param m Mailbox
* @param index_hint Remember our place in the index
* @retval -1 Error
* @retval 0 Success
* @retval #MUTT_REOPENED Mailbox closed and reopened
* @retval #MUTT_FLAGS Flags have changed
*/
-static int nm_mbox_check(struct Context *ctx, int *index_hint)
+static int nm_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
struct NmMboxData *mdata = nm_mdata_get(m);
time_t mtime = 0;
if (!mdata || (nm_db_get_mtime(m, &mtime) != 0))
*/
struct Email tmp = { 0 };
maildir_parse_flags(&tmp, new);
- maildir_update_flags(ctx->mailbox, e, &tmp);
+ maildir_update_flags(m, e, &tmp);
}
if (update_email_tags(e, msg) == 0)
{
oldcount = Context->mailbox->msg_count;
/* check for new mail */
- check = mx_mbox_check(Context, &index_hint);
+ check = mx_mbox_check(Context->mailbox, &index_hint);
if (check < 0)
{
if (!Context->mailbox || Context->mailbox->path[0] == '\0')
/**
* pop_mbox_check - Implements MxOps::mbox_check()
*/
-static int pop_mbox_check(struct Context *ctx, int *index_hint)
+static int pop_mbox_check(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
struct PopAccountData *adata = pop_get_adata(m);
if ((adata->check_time + PopCheckinterval) > time(NULL))