aboutsummaryrefslogtreecommitdiff
path: root/lib/pop3.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-04-14 09:35:35 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-04-14 10:06:05 +0100
commit577f8e5ac6dc3faa932c0b4789b90d0577fc6276 (patch)
tree485298364501056a14183d846fecccac5ac62ed0 /lib/pop3.c
parent95ba6cdd54a622a1170b8c111b63480cb120d5ea (diff)
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.
Diffstat (limited to 'lib/pop3.c')
-rw-r--r--lib/pop3.c70
1 files 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,