diff options
author | Jiri Hruska <jirka@fud.cz> | 2013-02-25 18:06:02 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-02-25 21:40:32 +0000 |
commit | a360944ed6eea4fee1131dcb9cad7298ec6fc7a6 (patch) | |
tree | 186da0bb5748c5a3b8c07a1d21e710cb4e61d1cd /lib | |
parent | 6f02209cc8211ae76f4bb448de00955e0a02c6a6 (diff) |
imap: Adjusted SELECT and FETCH function order
Moved imap_select() and imap_fetch() to be grouped with the other
perform functions.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/imap.c | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/lib/imap.c b/lib/imap.c index 19a1b3de9..847acd74a 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -679,6 +679,54 @@ static CURLcode imap_authenticate(struct connectdata *conn) return result; } +/* Start the DO phase */ +static CURLcode imap_select(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct IMAP *imap = data->state.proto.imap; + char *mailbox; + + mailbox = imap_atom(imap->mailbox ? imap->mailbox : ""); + if(!mailbox) + result = CURLE_OUT_OF_MEMORY; + else + result = imap_sendf(conn, "SELECT %s", mailbox); + + Curl_safefree(mailbox); + if(result) + return result; + + state(conn, IMAP_SELECT); + + return result; +} + +static CURLcode imap_fetch(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct IMAP *imap = conn->data->state.proto.imap; + + /* Send the FETCH command */ + result = imap_sendf(conn, "FETCH %s BODY[%s]", + imap->uid ? imap->uid : "1", + imap->section ? imap->section : ""); + if(result) + return result; + + /* + * When issued, the server will respond with a single line similar to + * '* 1 FETCH (BODY[TEXT] {2021}' + * + * Identifying the fetch and how many bytes of contents we can expect. We + * must extract that number before continuing to "download as usual". + */ + + state(conn, IMAP_FETCH); + + return result; +} + /* For the initial server greeting */ static CURLcode imap_state_servergreet_resp(struct connectdata *conn, int imapcode, @@ -1110,54 +1158,6 @@ static CURLcode imap_state_login_resp(struct connectdata *conn, return result; } -/* Start the DO phase */ -static CURLcode imap_select(struct connectdata *conn) -{ - CURLcode result = CURLE_OK; - struct SessionHandle *data = conn->data; - struct IMAP *imap = data->state.proto.imap; - char *mailbox; - - mailbox = imap_atom(imap->mailbox ? imap->mailbox : ""); - if(!mailbox) - result = CURLE_OUT_OF_MEMORY; - else - result = imap_sendf(conn, "SELECT %s", mailbox); - - Curl_safefree(mailbox); - if(result) - return result; - - state(conn, IMAP_SELECT); - - return result; -} - -static CURLcode imap_fetch(struct connectdata *conn) -{ - CURLcode result = CURLE_OK; - struct IMAP *imap = conn->data->state.proto.imap; - - /* Send the FETCH command */ - result = imap_sendf(conn, "FETCH %s BODY[%s]", - imap->uid ? imap->uid : "1", - imap->section ? imap->section : ""); - if(result) - return result; - - /* - * When issued, the server will respond with a single line similar to - * '* 1 FETCH (BODY[TEXT] {2021}' - * - * Identifying the fetch and how many bytes of contents we can expect. We - * must extract that number before continuing to "download as usual". - */ - - state(conn, IMAP_FETCH); - - return result; -} - /* For SELECT responses */ static CURLcode imap_state_select_resp(struct connectdata *conn, int imapcode, |