aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Hruska <jirka@fud.cz>2013-03-01 20:49:14 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-03-02 20:17:45 +0000
commit7b471fb3443c5f17912c6a1aa8f99d98af472608 (patch)
tree0f3c101fe10dc59e97232361d0496712888fb539
parentf8c8c76d39ac2fa825481ba42ab2247cd122f963 (diff)
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.
-rw-r--r--lib/imap.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/imap.c b/lib/imap.c
index c1eef8514..fafbdeec9 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -1721,8 +1721,8 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
*
* imap_perform()
*
- * This is the actual DO function for IMAP. Fetch a message according to the
- * options previously setup.
+ * This is the actual DO function for IMAP. Fetch or append a message
+ * according to the options previously setup.
*/
static CURLcode imap_perform(struct connectdata *conn, bool *connected,
bool *dophase_done)
@@ -1743,10 +1743,14 @@ static CURLcode imap_perform(struct connectdata *conn, bool *connected,
*dophase_done = FALSE; /* not done yet */
/* Start the first command in the DO phase */
- if(imap->mailbox && imapc->mailbox &&
- !strcmp(imap->mailbox, imapc->mailbox) &&
- (!imap->uidvalidity || !imapc->mailbox_uidvalidity ||
- !strcmp(imap->uidvalidity, imapc->mailbox_uidvalidity))) {
+ if(conn->data->set.upload)
+ /* APPEND can be executed directly */
+ result = imap_append(conn);
+ /* 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 connection so go straight to the next fetch operation */
result = imap_fetch(conn);