imap: Reworked the logic of untagged command responses
authorJiri Hruska <jirka@fud.cz>
Sun, 24 Feb 2013 12:27:49 +0000 (13:27 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Sun, 24 Feb 2013 12:39:09 +0000 (12:39 +0000)
lib/imap.c

index ba1f6fd..b2c9713 100644 (file)
@@ -360,10 +360,10 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
     return TRUE;
   }
 
-  /* Are we processing CAPABILITY command data? */
-  if(imapc->state == IMAP_CAPABILITY) {
-    /* Do we have a valid response? */
-    if(len >= 2 && !memcmp("* ", line, 2)) {
+  /* Do we have an untagged command response */
+  if(len >= 2 && !memcmp("* ", line, 2)) {
+    /* Are we processing CAPABILITY command data? */
+    if(imapc->state == IMAP_CAPABILITY) {
       line += 2;
       len -= 2;
 
@@ -425,11 +425,8 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
         len -= wordlen;
       }
     }
-  }
-  /* Are we processing FETCH command responses? */
-  else if(imapc->state == IMAP_FETCH) {
-    /* Do we have a valid response? */
-    if(len >= 2 && !memcmp("* ", line, 2)) {
+    /* Are we processing FETCH command responses? */
+    else if(imapc->state == IMAP_FETCH) {
       *resp = '*';
 
       return TRUE;