imap_error ("imap_copy_messages", idata->buf);
imap_error ("imap_copy_messages", idata->cmd.buf);
int imap_copy_messages (CONTEXT* ctx, HEADER* h, char* dest, int delete){  IMAP_DATA* idata;  char buf[HUGE_STRING];  char cmd[LONG_STRING];  char mbox[LONG_STRING];  char mmbox[LONG_STRING];  int rc;  int n;  IMAP_MBOX mx;  idata = (IMAP_DATA*) ctx->data;  if (imap_parse_path (dest, &mx))  {    dprint (1, (debugfile, "imap_copy_message: bad destination %s\n", dest));    return -1;  }  /* check that the save-to folder is in the same account */  if (!mutt_account_match (&(CTX_DATA->conn->account), &(mx.account)))  {    dprint (3, (debugfile, "imap_copy_message: %s not same server as %s\n",      dest, ctx->path));    goto fail;  }  imap_fix_path (idata, mx.mbox, cmd, sizeof (cmd));  /* Null HEADER* means copy tagged messages */  if (!h)  {    rc = imap_make_msg_set (idata, buf, sizeof (buf), M_TAG, 0);    if (!rc)    {      dprint (1, (debugfile, "imap_copy_messages: No messages tagged\n"));      goto fail;    }    mutt_message (_("Copying %d messages to %s..."), rc, cmd);  }  else  {    mutt_message (_("Copying message %d to %s..."), h->index+1, cmd);    snprintf (buf, sizeof (buf), "%u", HEADER_DATA (h)->uid);  }  /* let's get it on */  strncpy (mbox, cmd, sizeof (mbox));  imap_munge_mbox_name (mmbox, sizeof (mmbox), cmd);  snprintf (cmd, sizeof (cmd), "UID COPY %s %s", buf, mmbox);  rc = imap_exec (idata, cmd, IMAP_CMD_FAIL_OK);  if (rc == -2)  {    /* bail out if command failed for reasons other than nonexistent target */    if (strncmp (imap_get_qualifier (idata->buf), "[TRYCREATE]", 11))    {      imap_error ("imap_copy_messages", idata->buf);      goto fail;    }    dprint (2, (debugfile, "imap_copy_messages: server suggests TRYCREATE\n"));    snprintf (buf, sizeof (buf), _("Create %s?"), mbox);    if (option (OPTCONFIRMCREATE) && mutt_yesorno (buf, 1) < 1)    {      mutt_clear_error ();      goto fail;    }    if (imap_create_mailbox (idata, mbox) < 0)      goto fail;    /* try again */    rc = imap_exec (idata, cmd, 0);  }  if (rc != 0)  {    imap_error ("imap_copy_messages", idata->buf);    goto fail;  }  /* cleanup */  if (delete)  {    if (!h)      for (n = 0; n < ctx->msgcount; n++)      {        if (ctx->hdrs[n]->tagged)        {          mutt_set_flag (ctx, ctx->hdrs[n], M_DELETE, 1);          if (option (OPTDELETEUNTAG))            mutt_set_flag (ctx, ctx->hdrs[n], M_TAG, 0);        }      }    else    {      mutt_set_flag (ctx, h, M_DELETE, 1);      if (option (OPTDELETEUNTAG))        mutt_set_flag (ctx, h, M_TAG, 0);    }  }  FREE (&mx.mbox);  return 0; fail:  FREE (&mx.mbox);  return -1;}