mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
imap: Moved imap_append() to be with the other perform functions
This commit is contained in:
parent
7b471fb344
commit
459e1bffee
54
lib/imap.c
54
lib/imap.c
@ -710,6 +710,33 @@ static CURLcode imap_fetch(struct connectdata *conn)
|
||||
return result;
|
||||
}
|
||||
|
||||
static CURLcode imap_append(struct connectdata *conn)
|
||||
{
|
||||
CURLcode result;
|
||||
struct IMAP *imap = conn->data->state.proto.imap;
|
||||
char *mailbox;
|
||||
|
||||
if(conn->data->set.infilesize < 0) {
|
||||
failf(conn->data, "Cannot APPEND with unknown input file size\n");
|
||||
return CURLE_UPLOAD_FAILED;
|
||||
}
|
||||
|
||||
mailbox = imap_atom(imap->mailbox);
|
||||
|
||||
if(!mailbox)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
result = imap_sendf(conn, "APPEND %s (\\Seen) {%" FORMAT_OFF_T "}",
|
||||
mailbox, conn->data->set.infilesize);
|
||||
|
||||
Curl_safefree(mailbox);
|
||||
|
||||
if(!result)
|
||||
state(conn, IMAP_APPEND);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* For the initial server greeting */
|
||||
static CURLcode imap_state_servergreet_resp(struct connectdata *conn,
|
||||
int imapcode,
|
||||
@ -1359,33 +1386,6 @@ static CURLcode imap_state_fetch_final_resp(struct connectdata *conn,
|
||||
return result;
|
||||
}
|
||||
|
||||
static CURLcode imap_append(struct connectdata *conn)
|
||||
{
|
||||
CURLcode result;
|
||||
struct IMAP *imap = conn->data->state.proto.imap;
|
||||
char *mailbox;
|
||||
|
||||
if(conn->data->set.infilesize < 0) {
|
||||
failf(conn->data, "Cannot APPEND with unknown input file size\n");
|
||||
return CURLE_UPLOAD_FAILED;
|
||||
}
|
||||
|
||||
mailbox = imap_atom(imap->mailbox);
|
||||
|
||||
if(!mailbox)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
result = imap_sendf(conn, "APPEND %s (\\Seen) {%" FORMAT_OFF_T "}",
|
||||
mailbox, conn->data->set.infilesize);
|
||||
|
||||
Curl_safefree(mailbox);
|
||||
|
||||
if(!result)
|
||||
state(conn, IMAP_APPEND);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* For APPEND responses */
|
||||
static CURLcode imap_state_append_resp(struct connectdata *conn,
|
||||
int imapcode,
|
||||
|
Loading…
Reference in New Issue
Block a user