aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/imap.c96
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,