mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
imap: Extended FETCH support to include PARTIAL URL specifier
This commit is contained in:
parent
e2c14bde22
commit
d7ed8da43e
24
lib/imap.c
24
lib/imap.c
@ -740,9 +740,15 @@ static CURLcode imap_perform_fetch(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Send the FETCH command */
|
/* Send the FETCH command */
|
||||||
result = imap_sendf(conn, "FETCH %s BODY[%s]",
|
if(imap->partial)
|
||||||
imap->uid,
|
result = imap_sendf(conn, "FETCH %s BODY[%s]<%s>",
|
||||||
imap->section ? imap->section : "");
|
imap->uid,
|
||||||
|
imap->section ? imap->section : "",
|
||||||
|
imap->partial);
|
||||||
|
else
|
||||||
|
result = imap_sendf(conn, "FETCH %s BODY[%s]",
|
||||||
|
imap->uid,
|
||||||
|
imap->section ? imap->section : "");
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, IMAP_FETCH);
|
state(conn, IMAP_FETCH);
|
||||||
@ -1963,6 +1969,7 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
|
|||||||
Curl_safefree(imap->uidvalidity);
|
Curl_safefree(imap->uidvalidity);
|
||||||
Curl_safefree(imap->uid);
|
Curl_safefree(imap->uid);
|
||||||
Curl_safefree(imap->section);
|
Curl_safefree(imap->section);
|
||||||
|
Curl_safefree(imap->partial);
|
||||||
Curl_safefree(imap->query);
|
Curl_safefree(imap->query);
|
||||||
Curl_safefree(imap->custom);
|
Curl_safefree(imap->custom);
|
||||||
Curl_safefree(imap->custom_params);
|
Curl_safefree(imap->custom_params);
|
||||||
@ -2506,8 +2513,8 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
|
|||||||
|
|
||||||
DEBUGF(infof(conn->data, "IMAP URL parameter '%s' = '%s'\n", name, value));
|
DEBUGF(infof(conn->data, "IMAP URL parameter '%s' = '%s'\n", name, value));
|
||||||
|
|
||||||
/* Process the known hierarchical parameters (UIDVALIDITY, UID and SECTION)
|
/* Process the known hierarchical parameters (UIDVALIDITY, UID, SECTION and
|
||||||
stripping of the trailing slash character if it is present.
|
PARTIAL) stripping of the trailing slash character if it is present.
|
||||||
|
|
||||||
Note: Unknown parameters trigger a URL_MALFORMAT error. */
|
Note: Unknown parameters trigger a URL_MALFORMAT error. */
|
||||||
if(Curl_raw_equal(name, "UIDVALIDITY") && !imap->uidvalidity) {
|
if(Curl_raw_equal(name, "UIDVALIDITY") && !imap->uidvalidity) {
|
||||||
@ -2531,6 +2538,13 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
|
|||||||
imap->section = value;
|
imap->section = value;
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
|
else if(Curl_raw_equal(name, "PARTIAL") && !imap->partial) {
|
||||||
|
if(valuelen > 0 && value[valuelen - 1] == '/')
|
||||||
|
value[valuelen - 1] = '\0';
|
||||||
|
|
||||||
|
imap->partial = value;
|
||||||
|
value = NULL;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Curl_safefree(name);
|
Curl_safefree(name);
|
||||||
Curl_safefree(value);
|
Curl_safefree(value);
|
||||||
|
@ -68,6 +68,7 @@ struct IMAP {
|
|||||||
char *uidvalidity; /* UIDVALIDITY to check in select */
|
char *uidvalidity; /* UIDVALIDITY to check in select */
|
||||||
char *uid; /* Message UID to fetch */
|
char *uid; /* Message UID to fetch */
|
||||||
char *section; /* Message SECTION to fetch */
|
char *section; /* Message SECTION to fetch */
|
||||||
|
char *partial; /* Message PARTIAL to fetch */
|
||||||
char *query; /* Query to search for */
|
char *query; /* Query to search for */
|
||||||
char *custom; /* Custom request */
|
char *custom; /* Custom request */
|
||||||
char *custom_params; /* Parameters for the custom request */
|
char *custom_params; /* Parameters for the custom request */
|
||||||
|
Loading…
Reference in New Issue
Block a user