return -1;
if (fgets(buf, sizeof(buf), fp) == NULL)
return -1;
- if (mx_open_mailbox(path, MUTT_APPEND | MUTT_QUIET, &ctx) == NULL)
+ if (mx_mbox_open(path, MUTT_APPEND | MUTT_QUIET, &ctx) == NULL)
return -1;
- msg = mx_open_new_message(&ctx, hn, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
+ msg = mx_msg_open_new(&ctx, hn, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
if (!msg)
{
- mx_close_mailbox(&ctx, NULL);
+ mx_mbox_close(&ctx, NULL);
return -1;
}
if (ctx.magic == MUTT_MBOX || ctx.magic == MUTT_MMDF)
chflags = CH_FROM | CH_UPDATE_LEN;
chflags |= (ctx.magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
if (mutt_copy_message_fp(msg->fp, fp, hn, 0, chflags) == 0 &&
- mx_commit_message(&ctx, msg) == 0)
+ mx_msg_commit(&ctx, msg) == 0)
{
r = 0;
}
r = -1;
}
- mx_close_message(&ctx, &msg);
- mx_close_mailbox(&ctx, NULL);
+ mx_msg_close(&ctx, &msg);
+ mx_mbox_close(&ctx, NULL);
return r;
}
else
if (check_stats && (mailbox->stats_last_checked < sb->st_mtime))
{
- if (mx_open_mailbox(mailbox->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK,
+ if (mx_mbox_open(mailbox->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK,
&ctx) != NULL)
{
mailbox->msg_count = ctx.msgcount;
mailbox->msg_unread = ctx.unread;
mailbox->msg_flagged = ctx.flagged;
mailbox->stats_last_checked = ctx.mtime;
- mx_close_mailbox(&ctx, 0);
+ mx_mbox_close(&ctx, 0);
}
}
}
#endif
- if (mx_open_mailbox(buf, MUTT_APPEND, &ctx) != NULL)
+ if (mx_mbox_open(buf, MUTT_APPEND, &ctx) != NULL)
{
#ifdef USE_COMPRESSED
/* If we're saving to a compressed mailbox, the stats won't be updated
{
if (mutt_save_message_ctx(h, delete, decode, decrypt, &ctx) != 0)
{
- mx_close_mailbox(&ctx, NULL);
+ mx_mbox_close(&ctx, NULL);
return -1;
}
#ifdef USE_COMPRESSED
#endif
if (rc != 0)
{
- mx_close_mailbox(&ctx, NULL);
+ mx_mbox_close(&ctx, NULL);
return -1;
}
}
const int need_buffy_cleanup = (ctx.magic == MUTT_MBOX || ctx.magic == MUTT_MMDF);
- mx_close_mailbox(&ctx, NULL);
+ mx_mbox_close(&ctx, NULL);
if (need_buffy_cleanup)
mutt_buffy_cleanup(buf, &st);
h->security |= PGP_TRADITIONAL_CHECKED;
mutt_parse_mime_message(Context, h);
- struct Message *msg = mx_open_message(Context, h->msgno);
+ struct Message *msg = mx_msg_open(Context, h->msgno);
if (!msg)
return 0;
if (crypt_pgp_check_traditional(msg->fp, h->content, 0))
}
h->security |= PGP_TRADITIONAL_CHECKED;
- mx_close_message(Context, &msg);
+ mx_msg_close(Context, &msg);
return rc;
}
menu->redraw = REDRAW_FULL;
- ctx = mx_open_mailbox(fname, MUTT_READONLY, NULL);
+ ctx = mx_mbox_open(fname, MUTT_READONLY, NULL);
if (!ctx)
{
mutt_error(_("Unable to open mailbox %s"), fname);
if (!ctx->msgcount)
{
- mx_close_mailbox(ctx, NULL);
+ mx_mbox_close(ctx, NULL);
FREE(&ctx);
mutt_error(_("No messages in that folder."));
break;
menu->redraw |= REDRAW_FULL;
if (close == OP_QUIT)
- mx_close_mailbox(Context, NULL);
+ mx_mbox_close(Context, NULL);
else
mx_fastclose_mailbox(Context);
FREE(&Context);
*
* If the mailbox has been changed in NeoMutt, warn the user.
*
- * The return codes are picked to match mx_check_mailbox().
+ * The return codes are picked to match mx_mbox_check().
*/
static int comp_mbox_check(struct Context *ctx, int *index_hint)
{
int mutt_copy_message_ctx(FILE *fpout, struct Context *src, struct Header *hdr,
int flags, int chflags)
{
- struct Message *msg = mx_open_message(src, hdr->msgno);
+ struct Message *msg = mx_msg_open(src, hdr->msgno);
if (!msg)
return -1;
if (!hdr->content)
mutt_debug(1, "failed to detect EOF!\n");
r = -1;
}
- mx_close_message(src, &msg);
+ mx_msg_close(src, &msg);
return r;
}
if (fgets(buf, sizeof(buf), fpin) == NULL)
return -1;
- msg = mx_open_new_message(dest, hdr, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
+ msg = mx_msg_open_new(dest, hdr, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
if (!msg)
return -1;
if (dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF)
chflags |= CH_FROM | CH_FORCE_FROM;
chflags |= (dest->magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
r = mutt_copy_message_fp(msg->fp, fpin, hdr, flags, chflags);
- if (mx_commit_message(dest, msg) != 0)
+ if (mx_msg_commit(dest, msg) != 0)
r = -1;
#ifdef USE_NOTMUCH
nm_update_filename(src, NULL, msg->commited_path, hdr);
#endif
- mx_close_message(dest, &msg);
+ mx_msg_close(dest, &msg);
return r;
}
int mutt_append_message(struct Context *dest, struct Context *src,
struct Header *hdr, int cmflags, int chflags)
{
- struct Message *msg = mx_open_message(src, hdr->msgno);
+ struct Message *msg = mx_msg_open(src, hdr->msgno);
if (!msg)
return -1;
int r = append_message(dest, msg->fp, src, hdr, cmflags, chflags);
- mx_close_message(src, &msg);
+ mx_msg_close(src, &msg);
return r;
}
new_last_folder = mutt_str_strdup(Context->path);
*oldcount = Context ? Context->msgcount : 0;
- int check = mx_close_mailbox(Context, index_hint);
+ int check = mx_mbox_close(Context, index_hint);
if (check != 0)
{
if (check == MUTT_NEW_MAIL || check == MUTT_REOPENED)
* switch statement would need to be run. */
mutt_folder_hook(buf);
- Context = mx_open_mailbox(
+ Context = mx_mbox_open(
buf, (ReadOnly || (op == OP_MAIN_CHANGE_FOLDER_READONLY)) ? MUTT_READONLY : 0, NULL);
if (Context)
{
CURHDR->index :
0;
- check = mx_check_mailbox(Context, &index_hint);
+ check = mx_mbox_check(Context, &index_hint);
if (check < 0)
{
if (!Context->path)
mutt_startup_shutdown_hook(MUTT_SHUTDOWNHOOK);
- if (!Context || (check = mx_close_mailbox(Context, &index_hint)) == 0)
+ if (!Context || (check = mx_mbox_close(Context, &index_hint)) == 0)
done = true;
else
{
case OP_MAIN_IMAP_LOGOUT_ALL:
if (Context && Context->magic == MUTT_IMAP)
{
- if (mx_close_mailbox(Context, &index_hint) != 0)
+ if (mx_mbox_close(Context, &index_hint) != 0)
{
OptSearchInvalid = true;
menu->redraw = REDRAW_FULL;
newhdr = Context->hdrs[Context->v2r[newidx]];
}
- check = mx_sync_mailbox(Context, &index_hint);
+ check = mx_mbox_sync(Context, &index_hint);
if (check == 0)
{
if (newhdr && Context->vcount != ovc)
update_index(menu, Context, check, oc, index_hint);
/*
- * do a sanity check even if mx_sync_mailbox failed.
+ * do a sanity check even if mx_mbox_sync failed.
*/
if (menu->current < 0 || menu->current >= Context->vcount)
char *tags = NULL;
if (!tag)
tags = driver_tags_get_with_hidden(&CURHDR->tags);
- rc = mx_tags_editor(Context, tags, buf, sizeof(buf));
+ rc = mx_tags_edit(Context, tags, buf, sizeof(buf));
FREE(&tags);
if (rc < 0)
break;
omagic = MboxType;
MboxType = MUTT_MBOX;
- rc = (mx_open_mailbox(tmp, MUTT_NEWFOLDER, &tmpctx) == NULL) ? -1 : 0;
+ rc = (mx_mbox_open(tmp, MUTT_NEWFOLDER, &tmpctx) == NULL) ? -1 : 0;
MboxType = omagic;
CH_NOLEN | ((ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF) ? 0 : CH_NOSTATUS));
oerrno = errno;
- mx_close_mailbox(&tmpctx, NULL);
+ mx_mbox_close(&tmpctx, NULL);
if (rc == -1)
{
goto bail;
}
- if (mx_open_mailbox(ctx->path, MUTT_APPEND, &tmpctx) == NULL)
+ if (mx_mbox_open(ctx->path, MUTT_APPEND, &tmpctx) == NULL)
{
rc = -1;
/* L10N: %s is from strerror(errno) */
o_read = cur->read;
o_old = cur->old;
cur->read = cur->old = false;
- msg = mx_open_new_message(&tmpctx, cur, of);
+ msg = mx_msg_open_new(&tmpctx, cur, of);
cur->read = o_read;
cur->old = o_old;
if (!msg)
{
mutt_error(_("Can't append to folder: %s"), strerror(errno));
- mx_close_mailbox(&tmpctx, NULL);
+ mx_mbox_close(&tmpctx, NULL);
goto bail;
}
mutt_file_copy_stream(fp, msg->fp);
}
- rc = mx_commit_message(&tmpctx, msg);
- mx_close_message(&tmpctx, &msg);
+ rc = mx_msg_commit(&tmpctx, msg);
+ mx_msg_close(&tmpctx, &msg);
- mx_close_mailbox(&tmpctx, NULL);
+ mx_mbox_close(&tmpctx, NULL);
bail:
if (fp)
{
if (idata->status != IMAP_FATAL && idata->state >= IMAP_SELECTED)
{
- /* mx_close_mailbox won't sync if there are no deleted messages
+ /* mx_mbox_close won't sync if there are no deleted messages
* and the mailbox is unchanged, so we may have to close here */
if (!ctx->deleted)
imap_exec(idata, "CLOSE", IMAP_CMD_QUEUE);
"Saving changed messages... [%d/%d]", ctx->msgcount),
i + 1, ctx->msgcount);
if (!appendctx)
- appendctx = mx_open_mailbox(ctx->path, MUTT_APPEND | MUTT_QUIET, NULL);
+ appendctx = mx_mbox_open(ctx->path, MUTT_APPEND | MUTT_QUIET, NULL);
if (!appendctx)
mutt_debug(1, "Error opening mailbox in append mode\n");
else
#define MUTT_APPENDNEW (1 << 6) /**< set in mx_open_mailbox_append if the mailbox doesn't
* exist. used by maildir/mh to create the mailbox. */
-/* mx_open_new_message() */
+/* mx_msg_open_new() */
#define MUTT_ADD_FROM (1 << 0) /**< add a From_ line */
#define MUTT_SET_DRAFT (1 << 1) /**< set the message draft flag */
/**
- * enum MxCheckReturns - Return values from mx_check_mailbox()
+ * enum MxCheckReturns - Return values from mx_mbox_check()
*/
enum MxCheckReturns
{
{
FILE *fp; /**< pointer to the message data */
char *path; /**< path to temp file */
- char *commited_path; /**< the final path generated by mx_commit_message() */
+ char *commited_path; /**< the final path generated by mx_msg_commit() */
bool write; /**< nonzero if message is open for writing */
struct
{
time_t received; /**< the time at which this message was received */
};
-struct Context *mx_open_mailbox(const char *path, int flags, struct Context *pctx);
-
-struct Message *mx_open_message(struct Context *ctx, int msgno);
-struct Message *mx_open_new_message(struct Context *dest, struct Header *hdr, int flags);
+/* The Mailbox API, see MxOps */
+struct Context *mx_mbox_open (const char *path, int flags, struct Context *pctx);
+int mx_mbox_check (struct Context *ctx, int *index_hint);
+int mx_mbox_sync (struct Context *ctx, int *index_hint);
+int mx_mbox_close (struct Context *ctx, int *index_hint);
+struct Message *mx_msg_open (struct Context *ctx, int msgno);
+struct Message *mx_msg_open_new(struct Context *ctx, struct Header *hdr, int flags);
+int mx_msg_commit (struct Context *ctx, struct Message *msg);
+int mx_msg_close (struct Context *ctx, struct Message **msg);
+int mx_tags_edit (struct Context *ctx, const char *tags, char *buf, size_t buflen);
+int mx_tags_commit (struct Context *ctx, struct Header *hdr, char *tags);
void mx_fastclose_mailbox(struct Context *ctx);
-int mx_close_mailbox(struct Context *ctx, int *index_hint);
-int mx_sync_mailbox(struct Context *ctx, int *index_hint);
-int mx_commit_message(struct Context *ctx, struct Message *msg);
-int mx_close_message(struct Context *ctx, struct Message **msg);
int mx_get_magic(const char *path);
int mx_set_magic(const char *s);
-int mx_check_mailbox(struct Context *ctx, int *index_hint);
#ifdef USE_IMAP
bool mx_is_imap(const char *p);
#endif
mutt_startup_shutdown_hook(MUTT_STARTUPHOOK);
repeat_error = true;
- Context = mx_open_mailbox(
+ Context = mx_mbox_open(
folder, ((flags & MUTT_RO) || ReadOnly) ? MUTT_READONLY : 0, NULL);
if (Context || !explicit_folder)
{
*
* hdr is a header structure to which we write the message's new
* file name. This is used in the mh and maildir folder synch
- * routines. When this routine is invoked from mx_commit_message(),
+ * routines. When this routine is invoked from mx_msg_commit(),
* hdr is NULL.
*
* msg->path looks like this:
long old_body_length = h->content->length;
long old_hdr_lines = h->lines;
- struct Message *dest = mx_open_new_message(ctx, h, 0);
+ struct Message *dest = mx_msg_open_new(ctx, h, 0);
if (!dest)
return -1;
else
rc = mh_commit_msg(ctx, dest, h, 0);
- mx_close_message(ctx, &dest);
+ mx_msg_close(ctx, &dest);
if (rc == 0)
{
}
}
else
- mx_close_message(ctx, &dest);
+ mx_msg_close(ctx, &dest);
if (rc == -1 && restore)
{
for a maildir message */
struct MhData *data = mh_data(ctx);
- /* XXX seems like this check belongs in mx_check_mailbox()
+ /* XXX seems like this check belongs in mx_mbox_check()
* rather than here.
*/
if (!CheckNew)
}
/**
- * mx_open_mailbox - Open a mailbox and parse it
+ * mx_mbox_open - Open a mailbox and parse it
* @param path Path to the mailbox
* @param flags See below
* @param pctx Reuse this Context (if supplied)
* * #MUTT_QUIET only print error messages
* * #MUTT_PEEK revert atime where applicable
*/
-struct Context *mx_open_mailbox(const char *path, int flags, struct Context *pctx)
+struct Context *mx_mbox_open(const char *path, int flags, struct Context *pctx)
{
struct Context *ctx = pctx;
int rc;
}
/* never announce that a mailbox we've just left has new mail. #3290
- * TODO: really belongs in mx_close_mailbox, but this is a nice hook point */
+ * TODO: really belongs in mx_mbox_close, but this is a nice hook point */
if (!ctx->peekonly)
mutt_buffy_setnotified(ctx->path);
}
#endif
- if (mx_open_mailbox(Trash, MUTT_APPEND, &ctx_trash) != NULL)
+ if (mx_mbox_open(Trash, MUTT_APPEND, &ctx_trash) != NULL)
{
/* continue from initial scan above */
for (; i < ctx->msgcount; i++)
{
if (mutt_append_message(&ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
{
- mx_close_mailbox(&ctx_trash, NULL);
+ mx_mbox_close(&ctx_trash, NULL);
return -1;
}
}
}
- mx_close_mailbox(&ctx_trash, NULL);
+ mx_mbox_close(&ctx_trash, NULL);
}
else
{
}
/**
- * mx_close_mailbox - save changes and close mailbox
+ * mx_mbox_close - save changes and close mailbox
* @param ctx Mailbox
* @param index_hint Current email
* @retval 0 Success
* @retval -1 Failure
*/
-int mx_close_mailbox(struct Context *ctx, int *index_hint)
+int mx_mbox_close(struct Context *ctx, int *index_hint)
{
int i, move_messages = 0, purge = 1, read_msgs = 0;
struct Context f;
else /* use regular append-copy mode */
#endif
{
- if (mx_open_mailbox(mbox, MUTT_APPEND, &f) == NULL)
+ if (mx_mbox_open(mbox, MUTT_APPEND, &f) == NULL)
{
ctx->closing = false;
return -1;
}
else
{
- mx_close_mailbox(&f, NULL);
+ mx_mbox_close(&f, NULL);
ctx->closing = false;
return -1;
}
}
}
- mx_close_mailbox(&f, NULL);
+ mx_mbox_close(&f, NULL);
}
}
else if (!ctx->changed && ctx->deleted == 0)
if (ctx->id_hash && ctx->hdrs[i]->env->message_id)
mutt_hash_delete(ctx->id_hash, ctx->hdrs[i]->env->message_id, ctx->hdrs[i]);
mutt_label_hash_remove(ctx, ctx->hdrs[i]);
- /* The path mx_check_mailbox() -> imap_check_mailbox() ->
+ /* The path mx_mbox_check() -> imap_check_mailbox() ->
* imap_expunge_mailbox() -> mx_update_tables()
- * can occur before a call to mx_sync_mailbox(), resulting in
+ * can occur before a call to mx_mbox_sync(), resulting in
* last_tag being stale if it's not reset here.
*/
if (ctx->last_tag == ctx->hdrs[i])
}
/**
- * mx_sync_mailbox - Save changes to mailbox
+ * mx_mbox_sync - Save changes to mailbox
* @param[in] ctx Context
* @param[out] index_hint Currently selected mailbox
* @retval 0 Success
* @retval -1 Error
*/
-int mx_sync_mailbox(struct Context *ctx, int *index_hint)
+int mx_mbox_sync(struct Context *ctx, int *index_hint)
{
int rc;
int purge = 1;
}
/**
- * mx_open_new_message - Open a new message
- * @param dest Destination mailbox
+ * mx_msg_open_new - Open a new message
+ * @param ctx Destination mailbox
* @param hdr Message being copied (required for maildir support, because the filename depends on the message flags)
* @param flags Flags, e.g. #MUTT_SET_DRAFT
* @retval ptr New Message
*/
-struct Message *mx_open_new_message(struct Context *dest, struct Header *hdr, int flags)
+struct Message *mx_msg_open_new(struct Context *ctx, struct Header *hdr, int flags)
{
struct Address *p = NULL;
struct Message *msg = NULL;
- if (!dest->mx_ops || !dest->mx_ops->msg_open_new)
+ if (!ctx->mx_ops || !ctx->mx_ops->msg_open_new)
{
- mutt_debug(1, "function unimplemented for mailbox type %d.\n", dest->magic);
+ mutt_debug(1, "function unimplemented for mailbox type %d.\n", ctx->magic);
return NULL;
}
if (msg->received == 0)
time(&msg->received);
- if (dest->mx_ops->msg_open_new(dest, msg, hdr) == 0)
+ if (ctx->mx_ops->msg_open_new(ctx, msg, hdr) == 0)
{
- if (dest->magic == MUTT_MMDF)
+ if (ctx->magic == MUTT_MMDF)
fputs(MMDF_SEP, msg->fp);
- if ((dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF) && flags & MUTT_ADD_FROM)
+ if ((ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF) && flags & MUTT_ADD_FROM)
{
if (hdr)
{
}
/**
- * mx_check_mailbox - check for new mail
+ * mx_mbox_check - check for new mail
* @param ctx Mailbox
* @param index_hint Current email
* @retval >0 Success, e.g. #MUTT_NEW_MAIL
* @retval 0 Success, no change
* @retval -1 Failure
*/
-int mx_check_mailbox(struct Context *ctx, int *index_hint)
+int mx_mbox_check(struct Context *ctx, int *index_hint)
{
if (!ctx || !ctx->mx_ops)
{
}
/**
- * mx_open_message - return a stream pointer for a message
+ * mx_msg_open - return a stream pointer for a message
* @param ctx Mailbox
* @param msgno Message number
* @retval ptr Message
* @retval NULL Error
*/
-struct Message *mx_open_message(struct Context *ctx, int msgno)
+struct Message *mx_msg_open(struct Context *ctx, int msgno)
{
struct Message *msg = NULL;
}
/**
- * mx_commit_message - commit a message to a folder
+ * mx_msg_commit - commit a message to a folder
* @param msg Message to commit
* @param ctx Mailbox
* @retval 0 Success
* @retval -1 Failure
*/
-int mx_commit_message(struct Context *ctx, struct Message *msg)
+int mx_msg_commit(struct Context *ctx, struct Message *msg)
{
if (!ctx->mx_ops || !ctx->mx_ops->msg_commit)
return -1;
}
/**
- * mx_close_message - Close a message
+ * mx_msg_close - Close a message
* @param ctx Mailbox
* @param msg Message to close
* @retval 0 Success
* @retval -1 Failure
*/
-int mx_close_message(struct Context *ctx, struct Message **msg)
+int mx_msg_close(struct Context *ctx, struct Message **msg)
{
if (!ctx || !msg || !*msg)
return 0;
}
/**
- * mx_tags_editor - start the tag editor of the mailbox
+ * mx_tags_edit - start the tag editor of the mailbox
* @param ctx Mailbox
* @param tags Existing tags
* @param buf Buffer for the results
* @retval 0 No valid user input
* @retval 1 Buffer set
*/
-int mx_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen)
+int mx_tags_edit(struct Context *ctx, const char *tags, char *buf, size_t buflen)
{
if (ctx->mx_ops->tags_edit)
return ctx->mx_ops->tags_edit(ctx, tags, buf, buflen);
/**
* mx_tags_commit - save tags to the mailbox
* @param ctx Mailbox
- * @param h Email Header
+ * @param hdr Email Header
* @param tags Tags to save
* @retval 0 Success
* @retval -1 Failure
*/
-int mx_tags_commit(struct Context *ctx, struct Header *h, char *tags)
+int mx_tags_commit(struct Context *ctx, struct Header *hdr, char *tags)
{
if (ctx->mx_ops->tags_commit)
- return ctx->mx_ops->tags_commit(ctx, h, tags);
+ return ctx->mx_ops->tags_commit(ctx, hdr, tags);
mutt_message(_("Folder doesn't support tagging, aborting."));
return -1;
bool mx_is_notmuch(const char *p);
#endif
-int mx_tags_editor(struct Context *ctx, const char *tags, char *buf, size_t buflen);
-int mx_tags_commit(struct Context *ctx, struct Header *h, char *tags);
bool mx_tags_is_supported(struct Context *ctx);
FILE *maildir_open_find_message(const char *folder, const char *msg, char **newname);
{
oldcount = Context ? Context->msgcount : 0;
/* check for new mail */
- check = mx_check_mailbox(Context, &index_hint);
+ check = mx_mbox_check(Context, &index_hint);
if (check < 0)
{
if (!Context->path)
if (cur->content->parts)
break; /* The message was parsed earlier. */
- msg = mx_open_message(ctx, cur->msgno);
+ msg = mx_msg_open(ctx, cur->msgno);
if (msg)
{
mutt_parse_part(msg->fp, cur->content);
if (WithCrypto)
cur->security = crypt_query(cur->content);
- mx_close_message(ctx, &msg);
+ mx_msg_close(ctx, &msg);
}
} while (0);
static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno)
{
int match = 0;
- struct Message *msg = mx_open_message(ctx, msgno);
+ struct Message *msg = mx_msg_open(ctx, msgno);
if (!msg)
{
return match;
if ((WithCrypto != 0) && (h->security & ENCRYPT) && !crypt_valid_passphrase(h->security))
{
- mx_close_message(ctx, &msg);
+ mx_msg_close(ctx, &msg);
if (s.fpout)
{
mutt_file_fclose(&s.fpout);
FREE(&buf);
- mx_close_message(ctx, &msg);
+ mx_msg_close(ctx, &msg);
if (ThoroughSearch)
{
goto finish;
}
- if (mx_open_mailbox(NONULL(Spoolfile), MUTT_APPEND, &ctx) == NULL)
+ if (mx_mbox_open(NONULL(Spoolfile), MUTT_APPEND, &ctx) == NULL)
goto finish;
delanswer = query_quadoption(PopDelete, _("Delete messages from server?"));
for (int i = last + 1; i <= msgs; i++)
{
- msg = mx_open_new_message(&ctx, NULL, MUTT_ADD_FROM);
+ msg = mx_msg_open_new(&ctx, NULL, MUTT_ADD_FROM);
if (!msg)
ret = -3;
else
if (ret == -3)
rset = 1;
- if (ret == 0 && mx_commit_message(&ctx, msg) != 0)
+ if (ret == 0 && mx_msg_commit(&ctx, msg) != 0)
{
rset = 1;
ret = -3;
}
- mx_close_message(&ctx, &msg);
+ mx_msg_close(&ctx, &msg);
}
if (ret == 0 && delanswer == MUTT_YES)
if (ret == -1)
{
- mx_close_mailbox(&ctx, NULL);
+ mx_mbox_close(&ctx, NULL);
goto fail;
}
if (ret == -2)
msgbuf, i - last, msgs - last);
}
- mx_close_mailbox(&ctx, NULL);
+ mx_mbox_close(&ctx, NULL);
if (rset)
{
if (optnews)
OptNews = false;
#endif
- if (mx_open_mailbox(Postponed, MUTT_NOSORT | MUTT_QUIET, &ctx) == NULL)
+ if (mx_mbox_open(Postponed, MUTT_NOSORT | MUTT_QUIET, &ctx) == NULL)
PostCount = 0;
else
PostCount = ctx.msgcount;
if (!Postponed)
return -1;
- PostContext = mx_open_mailbox(Postponed, MUTT_NOSORT, NULL);
+ PostContext = mx_mbox_open(Postponed, MUTT_NOSORT, NULL);
if (!PostContext)
{
PostCount = 0;
if (!PostContext->msgcount)
{
PostCount = 0;
- mx_close_mailbox(PostContext, NULL);
+ mx_mbox_close(PostContext, NULL);
FREE(&PostContext);
mutt_error(_("No postponed messages."));
return -1;
}
else if ((h = select_msg()) == NULL)
{
- mx_close_mailbox(PostContext, NULL);
+ mx_mbox_close(PostContext, NULL);
FREE(&PostContext);
return -1;
}
/* avoid the "purge deleted messages" prompt */
opt_delete = Delete;
Delete = MUTT_YES;
- mx_close_mailbox(PostContext, NULL);
+ mx_mbox_close(PostContext, NULL);
Delete = opt_delete;
FREE(&PostContext);
memset(&s, 0, sizeof(s));
- if (!fp && (msg = mx_open_message(ctx, hdr->msgno)) == NULL)
+ if (!fp && (msg = mx_msg_open(ctx, hdr->msgno)) == NULL)
return -1;
if (!fp)
if (bfp != fp)
mutt_file_fclose(&bfp);
if (msg)
- mx_close_message(ctx, &msg);
+ mx_msg_close(ctx, &msg);
if (rc == -1)
{
mutt_message_hook(Context, hdr, MUTT_MESSAGEHOOK);
- struct Message *msg = mx_open_message(Context, hdr->msgno);
+ struct Message *msg = mx_msg_open(Context, hdr->msgno);
if (!msg)
return;
break;
case OP_EXIT:
- mx_close_message(Context, &msg);
+ mx_msg_close(Context, &msg);
hdr->attach_del = false;
for (int i = 0; i < actx->idxlen; i++)
}
/* If we failed to open a message, return with error */
- if (!fp && (msg = mx_open_message(Context, h->msgno)) == NULL)
+ if (!fp && (msg = mx_msg_open(Context, h->msgno)) == NULL)
return -1;
if (!fp)
}
if (msg)
- mx_close_message(Context, &msg);
+ mx_msg_close(Context, &msg);
return rc;
}
#ifdef RECORD_FOLDER_HOOK
mutt_folder_hook(path);
#endif
- if (mx_open_mailbox(path, MUTT_APPEND | MUTT_QUIET, &f) == NULL)
+ if (mx_mbox_open(path, MUTT_APPEND | MUTT_QUIET, &f) == NULL)
{
mutt_debug(1, "unable to open mailbox %s in append-mode, aborting.\n", path);
goto done;
if (!tempfp)
{
mutt_perror(tempfile);
- mx_close_mailbox(&f, NULL);
+ mx_mbox_close(&f, NULL);
goto done;
}
/* remember new mail status before appending message */
onm_flags = MUTT_ADD_FROM;
if (post)
onm_flags |= MUTT_SET_DRAFT;
- msg = mx_open_new_message(&f, hdr, onm_flags);
+ msg = mx_msg_open_new(&f, hdr, onm_flags);
if (!msg)
{
mutt_file_fclose(&tempfp);
- mx_close_mailbox(&f, NULL);
+ mx_mbox_close(&f, NULL);
goto done;
}
mutt_debug(1, "%s: write failed.\n", tempfile);
mutt_file_fclose(&tempfp);
unlink(tempfile);
- mx_commit_message(&f, msg); /* XXX - really? */
- mx_close_message(&f, &msg);
- mx_close_mailbox(&f, NULL);
+ mx_msg_commit(&f, msg); /* XXX - really? */
+ mx_msg_close(&f, &msg);
+ mx_mbox_close(&f, NULL);
goto done;
}
rc = mutt_write_mime_body(hdr->content, msg->fp);
}
- if (mx_commit_message(&f, msg) != 0)
+ if (mx_msg_commit(&f, msg) != 0)
rc = -1;
else if (finalpath)
*finalpath = mutt_str_strdup(msg->commited_path);
- mx_close_message(&f, &msg);
- mx_close_mailbox(&f, NULL);
+ mx_msg_close(&f, &msg);
+ mx_mbox_close(&f, NULL);
if (!post && need_buffy_cleanup)
mutt_buffy_cleanup(path, &st);