imap: Tidied up the APPEND and final APPEND response functions
authorSteve Holme <steve_holme@hotmail.com>
Wed, 6 Mar 2013 20:31:53 +0000 (20:31 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Wed, 6 Mar 2013 20:31:53 +0000 (20:31 +0000)
Removed unnecessary state changes on failure and setting of result codes
on success.

lib/imap.c

index 894d044e44b2b3a18d98c60a9ad8a5ffa5f59470..186ff63f6b0c9d59acfc36140354e14fc3dc20a5 100644 (file)
@@ -1506,14 +1506,15 @@ static CURLcode imap_state_append_resp(struct connectdata *conn, int imapcode,
     result = CURLE_UPLOAD_FAILED;
   }
   else {
+    /* Set the progress upload size */
     Curl_pgrsSetUploadSize(data, data->set.infilesize);
 
     /* IMAP upload */
     Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);
-  }
 
-  /* End of DO phase */
-  state(conn, IMAP_STOP);
+    /* End of DO phase */
+    state(conn, IMAP_STOP);
+  }
 
   return result;
 }
@@ -1527,14 +1528,11 @@ static CURLcode imap_state_append_final_resp(struct connectdata *conn,
 
   (void)instate; /* No use for this yet */
 
-  /* Final response, stop and return the final status */
-  if(imapcode == 'O')
-    result = CURLE_OK;
-  else
+  if(imapcode != 'O')
     result = CURLE_UPLOAD_FAILED;
-
-  /* End of DONE phase */
-  state(conn, IMAP_STOP);
+  else
+    /* End of DONE phase */
+    state(conn, IMAP_STOP);
 
   return result;
 }