* @retval <0 Failure
*
* TODO: ACL checks. Right now we assume if it exists we can mess with it.
- * TODO: This method should take a Context as parameter to be able to reuse the
+ * TODO: This method should take a Mailbox as parameter to be able to reuse the
* existing connection.
*/
int imap_access(const char *path)
/**
* imap_sync_mailbox - Sync all the changes to the server
- * @param ctx Mailbox
+ * @param m Mailbox
* @param expunge if true do expunge
* @param close if true we move imap state to CLOSE
* @retval 0 Success
* @retval -1 Error
*/
-int imap_sync_mailbox(struct Context *ctx, bool expunge, bool close)
+int imap_sync_mailbox(struct Mailbox *m, bool expunge, bool close)
{
- if (!ctx || !ctx->mailbox)
+ if (!m)
return -1;
struct Email *e = NULL;
int oldsort;
int rc;
- struct Mailbox *m = ctx->mailbox;
-
struct ImapAccountData *adata = imap_adata_get(m);
struct ImapMboxData *mdata = imap_mdata_get(m);
mutt_message(ngettext("Saving changed message... [%d/%d]",
"Saving changed messages... [%d/%d]", m->msg_count),
i + 1, m->msg_count);
- mutt_save_message_ctx(e, true, false, false, ctx->mailbox);
+ mutt_save_message_ctx(e, true, false, false, m);
e->xlabel_changed = false;
}
}
#include "mx.h"
struct BrowserState;
-struct Context;
struct Email;
struct Pattern;
int imap_access(const char *path);
int imap_check_mailbox(struct Mailbox *m, bool force);
int imap_delete_mailbox(struct Mailbox *m, char *path);
-int imap_sync_mailbox(struct Context *ctx, bool expunge, bool close);
+int imap_sync_mailbox(struct Mailbox *m, bool expunge, bool close);
int imap_path_status(const char *path, bool queue);
int imap_mailbox_status(struct Mailbox *m, bool queue);
int imap_search(struct Mailbox *m, const struct Pattern *pat);
/**
* mutt_parse_mime_message - Parse a MIME email
- * @param m Mailbox
- * @param cur Email
+ * @param m Mailbox
+ * @param e Email
*/
-void mutt_parse_mime_message(struct Mailbox *m, struct Email *cur)
+void mutt_parse_mime_message(struct Mailbox *m, struct Email *e)
{
- struct Message *msg = NULL;
-
do
{
- if (cur->content->type != TYPE_MESSAGE && cur->content->type != TYPE_MULTIPART)
+ if ((e->content->type != TYPE_MESSAGE) && (e->content->type != TYPE_MULTIPART))
break; /* nothing to do */
- if (cur->content->parts)
+ if (e->content->parts)
break; /* The message was parsed earlier. */
- msg = mx_msg_open(m, cur->msgno);
+ struct Message *msg = mx_msg_open(m, e->msgno);
if (msg)
{
- mutt_parse_part(msg->fp, cur->content);
+ mutt_parse_part(msg->fp, e->content);
if (WithCrypto)
- cur->security = crypt_query(cur->content);
+ e->security = crypt_query(e->content);
mx_msg_close(m, &msg);
}
} while (false);
- cur->attach_valid = false;
+ e->attach_valid = false;
}
/**
/**
* sync_mailbox - save changes to disk
- * @param ctx Mailbox
+ * @param m Mailbox
* @param index_hint Current email
* @retval 0 Success
* @retval -1 Failure
*/
-static int sync_mailbox(struct Context *ctx, int *index_hint)
+static int sync_mailbox(struct Mailbox *m, int *index_hint)
{
- if (!ctx || !ctx->mailbox || !ctx->mailbox->mx_ops || !ctx->mailbox->mx_ops->mbox_sync)
+ if (!m || !m->mx_ops || !m->mx_ops->mbox_sync)
return -1;
- struct Mailbox *m = ctx->mailbox;
-
if (!m->quiet)
{
/* L10N: Displayed before/as a mailbox is being synced */
/* allow IMAP to preserve the deleted flag across sessions */
if (m->magic == MUTT_IMAP)
{
- int check = imap_sync_mailbox(ctx, (purge != MUTT_NO), true);
+ int check = imap_sync_mailbox(ctx->mailbox, (purge != MUTT_NO), true);
if (check != 0)
return check;
}
if (m->changed || (m->msg_deleted != 0))
{
- int check = sync_mailbox(ctx, NULL);
+ int check = sync_mailbox(ctx->mailbox, NULL);
if (check != 0)
return check;
}
#ifdef USE_IMAP
if (m->magic == MUTT_IMAP)
- rc = imap_sync_mailbox(ctx, purge, false);
+ rc = imap_sync_mailbox(ctx->mailbox, purge, false);
else
#endif
- rc = sync_mailbox(ctx, index_hint);
+ rc = sync_mailbox(ctx->mailbox, index_hint);
if (rc == 0)
{
#ifdef USE_IMAP