]> granicus.if.org Git - neomutt/commitdiff
imap: drop Context from imap_copy_messages()
authorRichard Russon <rich@flatcap.org>
Mon, 31 Dec 2018 18:03:15 +0000 (18:03 +0000)
committerRichard Russon <rich@flatcap.org>
Sat, 5 Jan 2019 14:44:35 +0000 (14:44 +0000)
commands.c
imap/imap.h
imap/message.c
mx.c

index f1ce0cc6c9af45e1f692334082792b0101d6fffe..e2604183188eea3900d5e5bb498db80021282414 100644 (file)
@@ -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:
index 2693f1c1bd6a5bef8f2c0186fa54845561efc66b..921feab4775197d744e2fea97732b2141e494d43 100644 (file)
@@ -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);
index e591ecdfeff626ae74faee431caa21652426f9d3..d1ce0bb6275a5761d28e8a276c94be48cc2e30be 100644 (file)
@@ -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 070fb3a9a2559d2d1ebe9308f056ada359de0903..f5aa49de964be33a31dd83dc6d8bcf8f91cd02bf 100644 (file)
--- 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 */