imap_fix_path (idata, mx.mbox, mailbox, sizeof (mailbox));
+ /* We may be appending to the same folder we've selected. */
+ if (!ascii_strcmp(idata->mailbox, mx.mbox)) {
+ FREE (&mx.mbox);
+ return 0;
+ }
+
imap_munge_mbox_name (mbox, sizeof (mbox), mailbox);
if (mutt_bit_isset (idata->capabilities, IMAP4REV1))
return;
if (ctx == idata->ctx) {
- if (idata->state = IMAP_SELECTED) {
+ if (idata->state == IMAP_SELECTED) {
/* mx_close_mailbox won't sync if there are no deleted messages
* and the mailbox is unchanged, so we may have to close here */
if (idata->status != IMAP_FATAL && !ctx->deleted &&