* edit_or_view_one_message - Edit an email or view it in an external editor
* @param edit true if the message should be editable. If false, changes
* to the message (in the editor) will be ignored.
- * @param ctx Context
+ * @param m Mailbox
* @param cur Email
* @retval 1 Message not modified
* @retval 0 Message edited successfully
* @retval -1 Error
*/
-static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Email *cur)
+static int edit_or_view_one_message(bool edit, struct Mailbox *m, struct Email *cur)
{
char tmp[PATH_MAX];
char buf[STRING];
const int chflags =
CH_NOLEN |
- ((ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF) ? 0 : CH_NOSTATUS);
- rc = mutt_append_message(tmpctx->mailbox, ctx->mailbox, cur, 0, chflags);
+ ((m->magic == MUTT_MBOX || m->magic == MUTT_MMDF) ? 0 : CH_NOSTATUS);
+ rc = mutt_append_message(tmpctx->mailbox, m, cur, 0, chflags);
oerrno = errno;
mx_mbox_close(&tmpctx, NULL);
goto bail;
}
- tmpctx = mx_mbox_open(ctx->mailbox, NULL, MUTT_APPEND);
+ tmpctx = mx_mbox_open(m, NULL, MUTT_APPEND);
if (!tmpctx)
{
rc = -1;
int edit_or_view_message(bool edit, struct Context *ctx, struct Email *e)
{
if (e)
- return edit_or_view_one_message(edit, ctx, e);
+ return edit_or_view_one_message(edit, ctx->mailbox, e);
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!message_is_tagged(ctx, i))
continue;
- if (edit_or_view_one_message(edit, ctx, ctx->mailbox->hdrs[i]) == -1)
+ if (edit_or_view_one_message(edit, ctx->mailbox, ctx->mailbox->hdrs[i]) == -1)
return -1;
}