]> granicus.if.org Git - mutt/commitdiff
patch-bac.command-3
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 31 Aug 2000 08:54:29 +0000 (08:54 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 31 Aug 2000 08:54:29 +0000 (08:54 +0000)
imap/command.c
imap/imap.c

index 74c5318380a80495eaca51b50020dd88c1f76964..f26af035c0fe2f1c3909c4a8bae923412ff164b2 100644 (file)
@@ -198,10 +198,10 @@ int imap_exec (IMAP_DATA* idata, const char* cmd, int flags)
     rc = imap_cmd_step (idata);
   while (rc == IMAP_CMD_CONTINUE);
 
-  if (rc != IMAP_CMD_DONE)
-    return -1;
+  if (rc == IMAP_CMD_NO && (flags & IMAP_CMD_FAIL_OK))
+    return -2;
 
-  if (!imap_code (idata->buf))
+  if (rc != IMAP_CMD_DONE)
   {
     char *pc;
 
index fa0525acf563cbad6dbe5d77eb201d88b55308a8..21da0e59276fd4f1a5d9abadbda2b101b7214815 100644 (file)
@@ -500,10 +500,10 @@ int imap_open_mailbox (CONTEXT* ctx)
   snprintf (bufout, sizeof (bufout), "%s %s",
     ctx->readonly ? "EXAMINE" : "SELECT", buf);
 
-  imap_cmd_start (idata, bufout);
-
   idata->state = IMAP_SELECTED;
 
+  imap_cmd_start (idata, bufout);
+
   do
   {
     char *pc;
@@ -550,6 +550,16 @@ int imap_open_mailbox (CONTEXT* ctx)
   }
   while (rc == IMAP_CMD_CONTINUE);
 
+  if (rc == IMAP_CMD_NO)
+  {
+    char *s;
+    s = imap_next_word (idata->buf); /* skip seq */
+    s = imap_next_word (s); /* Skip response */
+    mutt_error ("%s", s);
+    sleep (2);
+    goto fail;
+  }
+
   if (rc != IMAP_CMD_DONE)
     goto fail;
 
@@ -583,17 +593,6 @@ int imap_open_mailbox (CONTEXT* ctx)
   }
 #endif
 
-  if (!imap_code (idata->buf))
-  {
-    char *s;
-    s = imap_next_word (idata->buf); /* skip seq */
-    s = imap_next_word (s); /* Skip response */
-    mutt_error ("%s", s);
-    idata->state = IMAP_AUTHENTICATED;
-    sleep (1);
-    goto fail;
-  }
-
   if (mutt_bit_isset (idata->capabilities, ACL))
   {
     if (imap_check_acl (idata))
@@ -623,6 +622,7 @@ int imap_open_mailbox (CONTEXT* ctx)
   return 0;
 
  fail:
+  idata->state = IMAP_AUTHENTICATED;
   FREE (&mx.mbox);
   return -1;
 }