cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Issue with IMAP UID FETCH

From: Ray Satiro <raysatiro_at_yahoo.com>
Date: Tue, 06 May 2014 14:29:01 -0400

On 5/5/2014 2:06 PM, Steve Holme wrote:
>
> I think the areas we need to look at are as follows:
>
> * Fixed libcurl FETCH API (as you suggested in Option A)
> * Change the LIST command be driven off CURLOPT_DIRLISTONLY
> * Change current custom commands to be an override of LIST
> * Implement custom command support for FETCH
> * Implement custom command support for APPEND

Is any of that going to affect parsing custom results from the header
field? * ABC {123}\r\n the following 123 bytes aren't returned in the
body so right now for example I have code like this to retrieve all
subjects via FETCH that match "some subject" (curl 7.34.0):

string url = "imaps://" + user + ":" + pass +
"@imap.gmail.com:993/%5BGmail%5D%2FAll%20Mail";
string query = "SEARCH X-GM-RAW \"subject:\\\"some subject\\\"\"";
.parse returned IDs then get the subject for each:
query = "FETCH " + ids[ i ] + " BODY.PEEK[HEADER.FIELDS (SUBJECT)]";
regex_search( imap.server_headers.memory,
     match,
     regex( "^(?:.*\r\n)*\\* [0-9]+ FETCH \\(BODY\\[HEADER\\.FIELDS
\\(SUBJECT\\)\\] \\{([0-9]+)\\}\r\n" )
     )
subject_size = stoul( match[ 1 ] );
subject_offset = match.length();
imap.server_headers.memory[ subject_offset + subject_size ] = 0;
string subject( imap.server_headers.memory + subject_offset );
cout << "Data:" << endl << subject << endl;

Error checking and irrelevant stuff removed. Queries are
CURLOPT_CUSTOMREQUESTs.
curl_easy_setopt( hnd, CURLOPT_CUSTOMREQUEST, query.c_str() );

Unrelated- Thanks for your work on VS project files. Haven't tried them
yet but I could use them.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-05-06