Rocco Rutte:
[apps/madmutt.git] / imap / imap.c
index 40489b4..099be62 100644 (file)
@@ -716,6 +716,12 @@ int imap_open_mailbox_append (CONTEXT * ctx)
 
   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))
@@ -1073,7 +1079,7 @@ void imap_close_mailbox (CONTEXT * ctx)
     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 &&