]> granicus.if.org Git - curl/commitdiff
pop3: Moved pop3_command() to be with the other perform functions
authorSteve Holme <steve_holme@hotmail.com>
Sun, 14 Apr 2013 08:35:35 +0000 (09:35 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Sun, 14 Apr 2013 09:06:05 +0000 (10:06 +0100)
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

index ee4a713a8f49c05733048ec99f22f84b9934431f..31ce5ab72eaf2b1984240e077b7e5ae1f1f9d939 100644 (file)
@@ -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,