aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-24 16:14:16 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-24 16:14:16 +0000
commit37f0caeabdf41413e4c993b439239be9b193d87b (patch)
tree5a10e70135980279ecfc4aa3a3eab38f3808f118 /lib
parent671f896c0b6aef37fd57c6fb702275d8ad6bade0 (diff)
imap: Changed the order of the response types in imap_endofresp()
From a maintenance point of view the code reads better to view tagged responses, then untagged followed by continuation responses. Additionally, this matches the order of responses in POP3.
Diffstat (limited to 'lib')
-rw-r--r--lib/imap.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/lib/imap.c b/lib/imap.c
index d135ba916..0c0154824 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -353,32 +353,6 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
return TRUE;
}
- /* Do we have a continuation response? */
- if((len == 3 && !memcmp("+", line, 1)) ||
- (len >= 2 && !memcmp("+ ", line, 2))) {
- switch(imapc->state) {
- /* States which are interested in continuation responses */
- case IMAP_AUTHENTICATE_PLAIN:
- case IMAP_AUTHENTICATE_LOGIN:
- case IMAP_AUTHENTICATE_LOGIN_PASSWD:
- case IMAP_AUTHENTICATE_CRAMMD5:
- case IMAP_AUTHENTICATE_DIGESTMD5:
- case IMAP_AUTHENTICATE_DIGESTMD5_RESP:
- case IMAP_AUTHENTICATE_NTLM:
- case IMAP_AUTHENTICATE_NTLM_TYPE2MSG:
- case IMAP_AUTHENTICATE:
- *resp = '+';
- break;
-
- default:
- failf(conn->data, "Unexpected continuation response");
- *resp = -1;
- break;
- }
-
- return TRUE;
- }
-
/* Do we have an untagged command response */
if(len >= 2 && !memcmp("* ", line, 2)) {
/* Are we processing CAPABILITY command data? */
@@ -443,6 +417,8 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
line += wordlen;
len -= wordlen;
}
+
+ return FALSE;
}
/* Are we processing FETCH command responses? */
else if(imapc->state == IMAP_FETCH) {
@@ -452,6 +428,32 @@ static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
}
}
+ /* Do we have a continuation response? */
+ if((len == 3 && !memcmp("+", line, 1)) ||
+ (len >= 2 && !memcmp("+ ", line, 2))) {
+ switch(imapc->state) {
+ /* States which are interested in continuation responses */
+ case IMAP_AUTHENTICATE_PLAIN:
+ case IMAP_AUTHENTICATE_LOGIN:
+ case IMAP_AUTHENTICATE_LOGIN_PASSWD:
+ case IMAP_AUTHENTICATE_CRAMMD5:
+ case IMAP_AUTHENTICATE_DIGESTMD5:
+ case IMAP_AUTHENTICATE_DIGESTMD5_RESP:
+ case IMAP_AUTHENTICATE_NTLM:
+ case IMAP_AUTHENTICATE_NTLM_TYPE2MSG:
+ case IMAP_AUTHENTICATE:
+ *resp = '+';
+ break;
+
+ default:
+ failf(conn->data, "Unexpected continuation response");
+ *resp = -1;
+ break;
+ }
+
+ return TRUE;
+ }
+
return FALSE; /* Nothing for us */
}