libidav/jmap_methods.c

branch
dav-2
changeset 928
57167625bfdd
parent 927
0bcf3d69b37a
equal deleted inserted replaced
927:0bcf3d69b37a 928:57167625bfdd
46 "]}"); 46 "]}");
47 47
48 return buf; 48 return buf;
49 } 49 }
50 50
51 CxBuffer* jm_email_get_request(cxstring mailbox) {
52 CxBuffer *buf = cxBufferCreate(NULL, NULL, 512, CX_BUFFER_AUTO_EXTEND | CX_BUFFER_FREE_CONTENTS);
53
54 cxBufferPutString(buf,
55 "{\"using\":["
56 "\"urn:ietf:params:jmap:core\","
57 "\"urn:ietf:params:jmap:mail\""
58 "],\"methodCalls\":["
59 "[\"Email/query\","
60 "{ \"filter\": { \"inMailbox\": \"");
61 cxBufferPutString(buf, mailbox);
62 cxBufferPutString(buf,
63 "\" } },"
64 "\"q1\" ],"
65 "[\"Email/get\", {"
66 "\"#ids\": { "
67 "\"resultOf\": \"q1\","
68 "\"name\": \"Email/query\","
69 "\"path\": \"/ids\""
70 "},"
71 "\"properties\": ["
72 "\"subject\","
73 "\"from\","
74 "\"receivedAt\""
75 "] }, \"g1\" ] ] }");
76
77
78 return buf;
79 }
80
51 CxJsonValue* jm_do_api_request(JMAPSession *sn, CxBuffer *request) { 81 CxJsonValue* jm_do_api_request(JMAPSession *sn, CxBuffer *request) {
52 curl_easy_setopt(sn->handle, CURLOPT_URL, sn->apiUrl); 82 curl_easy_setopt(sn->handle, CURLOPT_URL, sn->apiUrl);
53 83
54 curl_easy_setopt(sn->handle, CURLOPT_POST, 1L); 84 curl_easy_setopt(sn->handle, CURLOPT_POST, 1L);
55 //curl_easy_setopt(sn->handle, CURLOPT_READFUNCTION, cxBufferRead); 85 //curl_easy_setopt(sn->handle, CURLOPT_READFUNCTION, cxBufferRead);

mercurial