diff options
author | Jiri Hruska <jirka@fud.cz> | 2013-02-23 22:05:19 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-02-23 21:11:47 +0000 |
commit | 5c5b7c7146b07c15c72ff80f0b2438659a827f29 (patch) | |
tree | be0c2f87382267d20bb4e7e04fb643cdae297cec /lib | |
parent | 7f6c7331b2c061d1761717bcd1595e5941a35072 (diff) |
imap: Added the ability to FETCH a specific UID and SECTION
Updated the FETCH command to send the UID and SECTION parsed from the
URL. By default the BODY specifier doesn't include a section, BODY[] is
now sent whereas BODY[TEXT] was previously sent. In my opinion
retrieving just the message text is rarely useful when dealing with
emails, as the headers are required for example, so that functionality
is not retained. In can however be simulated by adding SECTION=TEXT to
the URL.
Also updated test801 and test1321 due to the BODY change.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/imap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/imap.c b/lib/imap.c index 4a5c3f806..33f8b1d2e 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -1109,11 +1109,12 @@ static CURLcode imap_select(struct connectdata *conn) static CURLcode imap_fetch(struct connectdata *conn) { CURLcode result = CURLE_OK; + struct IMAP *imap = conn->data->state.proto.imap; - /* TODO: make this select the correct mail - * Use "1 body[text]" to get the full mail body of mail 1 - */ - result = imap_sendf(conn, "FETCH 1 BODY[TEXT]"); + /* 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; |