mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
imap: Enabled APPEND support in imap_perform()
Added logic in imap_perform() to perform an APPEND rather than SELECT and FETCH if an upload has been specified.
This commit is contained in:
parent
f8c8c76d39
commit
7b471fb344
16
lib/imap.c
16
lib/imap.c
@ -1721,8 +1721,8 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
|
|||||||
*
|
*
|
||||||
* imap_perform()
|
* imap_perform()
|
||||||
*
|
*
|
||||||
* This is the actual DO function for IMAP. Fetch a message according to the
|
* This is the actual DO function for IMAP. Fetch or append a message
|
||||||
* options previously setup.
|
* according to the options previously setup.
|
||||||
*/
|
*/
|
||||||
static CURLcode imap_perform(struct connectdata *conn, bool *connected,
|
static CURLcode imap_perform(struct connectdata *conn, bool *connected,
|
||||||
bool *dophase_done)
|
bool *dophase_done)
|
||||||
@ -1743,10 +1743,14 @@ static CURLcode imap_perform(struct connectdata *conn, bool *connected,
|
|||||||
*dophase_done = FALSE; /* not done yet */
|
*dophase_done = FALSE; /* not done yet */
|
||||||
|
|
||||||
/* Start the first command in the DO phase */
|
/* Start the first command in the DO phase */
|
||||||
if(imap->mailbox && imapc->mailbox &&
|
if(conn->data->set.upload)
|
||||||
!strcmp(imap->mailbox, imapc->mailbox) &&
|
/* APPEND can be executed directly */
|
||||||
(!imap->uidvalidity || !imapc->mailbox_uidvalidity ||
|
result = imap_append(conn);
|
||||||
!strcmp(imap->uidvalidity, imapc->mailbox_uidvalidity))) {
|
/* FETCH needs a selected mailbox */
|
||||||
|
else if(imap->mailbox && imapc->mailbox &&
|
||||||
|
!strcmp(imap->mailbox, imapc->mailbox) &&
|
||||||
|
(!imap->uidvalidity || !imapc->mailbox_uidvalidity ||
|
||||||
|
!strcmp(imap->uidvalidity, imapc->mailbox_uidvalidity))) {
|
||||||
/* This mailbox (with the same UIDVALIDITY if set) is already selected on
|
/* This mailbox (with the same UIDVALIDITY if set) is already selected on
|
||||||
this connection so go straight to the next fetch operation */
|
this connection so go straight to the next fetch operation */
|
||||||
result = imap_fetch(conn);
|
result = imap_fetch(conn);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user