From 577f8e5ac6dc3faa932c0b4789b90d0577fc6276 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sun, 14 Apr 2013 09:35:35 +0100 Subject: pop3: Moved pop3_command() to be with the other perform functions Started to apply the same tidy up to the POP3 code as applied to the IMAP code in the 7.30.0 release. --- lib/pop3.c | 70 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/pop3.c b/lib/pop3.c index ee4a713a8..31ce5ab72 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -578,6 +578,41 @@ static CURLcode pop3_authenticate(struct connectdata *conn) return result; } +/* Start the DO phase for the command */ +static CURLcode pop3_command(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct POP3 *pop3 = data->state.proto.pop3; + const char *command = NULL; + + /* Calculate the default command */ + if(pop3->id[0] == '\0' || conn->data->set.ftp_list_only) { + command = "LIST"; + + if(pop3->id[0] != '\0') + /* Message specific LIST so skip the BODY transfer */ + pop3->transfer = FTPTRANSFER_INFO; + } + else + command = "RETR"; + + /* Send the command */ + if(pop3->id[0] != '\0') + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s %s", + (pop3->custom && pop3->custom[0] != '\0' ? + pop3->custom : command), pop3->id); + else + result = Curl_pp_sendf(&conn->proto.pop3c.pp, + (pop3->custom && pop3->custom[0] != '\0' ? + pop3->custom : command)); + + if(!result) + state(conn, POP3_COMMAND); + + return result; +} + /* For the initial server greeting */ static CURLcode pop3_state_servergreet_resp(struct connectdata *conn, int pop3code, @@ -1051,41 +1086,6 @@ static CURLcode pop3_state_pass_resp(struct connectdata *conn, int pop3code, return result; } -/* Start the DO phase for the command */ -static CURLcode pop3_command(struct connectdata *conn) -{ - CURLcode result = CURLE_OK; - struct SessionHandle *data = conn->data; - struct POP3 *pop3 = data->state.proto.pop3; - const char *command = NULL; - - /* Calculate the default command */ - if(pop3->id[0] == '\0' || conn->data->set.ftp_list_only) { - command = "LIST"; - - if(pop3->id[0] != '\0') - /* Message specific LIST so skip the BODY transfer */ - pop3->transfer = FTPTRANSFER_INFO; - } - else - command = "RETR"; - - /* Send the command */ - if(pop3->id[0] != '\0') - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s %s", - (pop3->custom && pop3->custom[0] != '\0' ? - pop3->custom : command), pop3->id); - else - result = Curl_pp_sendf(&conn->proto.pop3c.pp, - (pop3->custom && pop3->custom[0] != '\0' ? - pop3->custom : command)); - - if(!result) - state(conn, POP3_COMMAND); - - return result; -} - /* For command responses */ static CURLcode pop3_state_command_resp(struct connectdata *conn, int pop3code, -- cgit v1.2.3