]> granicus.if.org Git - neomutt/commitdiff
Allow IMAP FCC to reconnect if append fails (closes: #890)
authorBrendan Cully <brendan@kublai.com>
Sat, 31 Mar 2007 23:07:36 +0000 (16:07 -0700)
committerBrendan Cully <brendan@kublai.com>
Sat, 31 Mar 2007 23:07:36 +0000 (16:07 -0700)
imap/command.c
imap/imap.c

index 9e0647e84a663e4701d2f2498edcceb9cf6f3f2b..96aadc24d7b962bf1ea0feb348c7427ce1f49440 100644 (file)
@@ -270,7 +270,7 @@ int imap_exec (IMAP_DATA* idata, const char* cmdstr, int flags)
 
   if (rc != IMAP_CMD_OK)
   {
-    if (flags & IMAP_CMD_FAIL_OK)
+    if (flags & IMAP_CMD_FAIL_OK && idata->status != IMAP_FATAL)
       return -2;
 
     dprint (1, (debugfile, "imap_exec: command failed: %s\n", idata->buf));
index 97844107e4325276863c904f14c74a1e5eb733d0..d788b1ba7c88a433891e833dff9a75ac508b5eb2 100644 (file)
@@ -63,6 +63,7 @@ int imap_access (const char* path, int flags)
   char buf[LONG_STRING];
   char mailbox[LONG_STRING];
   char mbox[LONG_STRING];
+  int rc;
 
   if (imap_parse_path (path, &mx))
     return -1;
@@ -96,10 +97,10 @@ int imap_access (const char* path, int flags)
     return -1;
   }
 
-  if (imap_exec (idata, buf, IMAP_CMD_FAIL_OK) < 0)
+  if ((rc = imap_exec (idata, buf, IMAP_CMD_FAIL_OK)) < 0)
   {
     dprint (1, (debugfile, "imap_access: Can't check STATUS of %s\n", mbox));
-    return -1;
+    return rc;
   }
 
   return 0;
@@ -341,6 +342,8 @@ IMAP_DATA* imap_conn_find (const ACCOUNT* account, int flags)
     }
     if (flags & M_IMAP_CONN_NOSELECT && idata && idata->state >= IMAP_SELECTED)
       continue;
+    if (idata && idata->status == IMAP_FATAL)
+      continue;
     break;
   }
   if (!conn)
@@ -771,6 +774,7 @@ int imap_open_mailbox_append (CONTEXT *ctx)
   char buf[LONG_STRING];
   char mailbox[LONG_STRING];
   IMAP_MBOX mx;
+  int rc;
 
   if (imap_parse_path (ctx->path, &mx))
     return -1;
@@ -793,9 +797,12 @@ int imap_open_mailbox_append (CONTEXT *ctx)
   FREE (&mx.mbox);
 
   /* really we should also check for W_OK */
-  if (!imap_access (ctx->path, F_OK))
+  if ((rc = imap_access (ctx->path, F_OK)) == 0)
     return 0;
 
+  if (rc == -1)
+    return -1;
+
   snprintf (buf, sizeof (buf), _("Create %s?"), mailbox);
   if (option (OPTCONFIRMCREATE) && mutt_yesorno (buf, 1) < 1)
     return -1;