From: Richard Russon Date: Mon, 31 Dec 2018 18:03:15 +0000 (+0000) Subject: imap: drop Context from imap_copy_messages() X-Git-Tag: 2019-10-25~399^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f701d9f2970ee8294bd1984a3f1defe987e399b;p=neomutt imap: drop Context from imap_copy_messages() --- diff --git a/commands.c b/commands.c index f1ce0cc6c..e26041831 100644 --- a/commands.c +++ b/commands.c @@ -991,7 +991,7 @@ int mutt_save_message(struct Email *e, bool delete, bool decode, bool decrypt) if ((Context->mailbox->magic == MUTT_IMAP) && !(decode || decrypt) && (imap_path_probe(buf, NULL) == MUTT_IMAP)) { - switch (imap_copy_messages(Context, e, buf, delete)) + switch (imap_copy_messages(Context->mailbox, e, buf, delete)) { /* success */ case 0: diff --git a/imap/imap.h b/imap/imap.h index 2693f1c1b..921feab47 100644 --- a/imap/imap.h +++ b/imap/imap.h @@ -97,7 +97,7 @@ int imap_mailbox_create(const char *folder); int imap_mailbox_rename(const char *path); /* message.c */ -int imap_copy_messages(struct Context *ctx, struct Email *e, char *dest, bool delete); +int imap_copy_messages(struct Mailbox *m, struct Email *e, char *dest, bool delete); /* socket.c */ void imap_logout_all(void); diff --git a/imap/message.c b/imap/message.c index e591ecdfe..d1ce0bb62 100644 --- a/imap/message.c +++ b/imap/message.c @@ -1530,7 +1530,7 @@ fail: /** * imap_copy_messages - Server COPY messages to another folder - * @param ctx Mailbox + * @param m Mailbox * @param e Email * @param dest Destination folder * @param delete Delete the original? @@ -1538,9 +1538,9 @@ fail: * @retval 0 Success * @retval 1 Non-fatal error - try fetch/append */ -int imap_copy_messages(struct Context *ctx, struct Email *e, char *dest, bool delete) +int imap_copy_messages(struct Mailbox *m, struct Email *e, char *dest, bool delete) { - if (!ctx || !ctx->mailbox) + if (!m || !dest) return -1; struct Buffer cmd, sync_cmd; @@ -1553,8 +1553,6 @@ int imap_copy_messages(struct Context *ctx, struct Email *e, char *dest, bool de int err_continue = MUTT_NO; int triedcreate = 0; - struct Mailbox *m = ctx->mailbox; - if (e && e->attach_del) { mutt_debug(3, "#1 Message contains attachments to be deleted\n"); @@ -1595,7 +1593,7 @@ int imap_copy_messages(struct Context *ctx, struct Email *e, char *dest, bool de * remainder. */ for (int i = 0; i < m->msg_count; i++) { - if (!message_is_tagged(ctx, i)) + if (!m->emails[i]->tagged) continue; if (m->emails[i]->attach_del) @@ -1693,7 +1691,7 @@ int imap_copy_messages(struct Context *ctx, struct Email *e, char *dest, bool de { for (int i = 0; i < m->msg_count; i++) { - if (!message_is_tagged(ctx, i)) + if (!m->emails[i]->tagged) continue; mutt_set_flag(m, m->emails[i], MUTT_DELETE, 1); diff --git a/mx.c b/mx.c index 070fb3a9a..f5aa49de9 100644 --- a/mx.c +++ b/mx.c @@ -691,7 +691,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint) } } - i = imap_copy_messages(ctx, NULL, mbox, true); + i = imap_copy_messages(ctx->mailbox, NULL, mbox, true); } if (i == 0) /* success */