271 |
/* |
/* |
272 |
* Process the data that server sent due to IMAP FETCH client request. |
* Process the data that server sent due to IMAP FETCH client request. |
273 |
*/ |
*/ |
274 |
int fetch_response(int *sock, int reset, char *fetch) |
int fetch_response(int *sock, unsigned int tag, int reset, char *fetch) |
275 |
{ |
{ |
276 |
char buf[RESPONSE_BUF]; |
char buf[RESPONSE_BUF]; |
277 |
unsigned int i; |
unsigned int i; |
284 |
} |
} |
285 |
i = 0; |
i = 0; |
286 |
|
|
287 |
receive_response(sock, buf); |
reset_vbuf(); |
|
bye_response(buf); |
|
288 |
|
|
289 |
b = buf; |
do { |
290 |
|
receive_response(sock, buf); |
291 |
|
bye_response(buf); |
292 |
|
check_vbuf(strlen(buf)); |
293 |
|
strncat(vbuf, buf, vbufs - strlen(vbuf)); |
294 |
|
} while (strlen(vbuf) < RESPONSE_BUF && |
295 |
|
!strcasestr(buf, ultostr(tag, 16))); |
296 |
|
|
297 |
if (!s) { |
b = vbuf; |
298 |
b = strchr(b, '{'); |
|
299 |
b++; |
if (!s && (b = strstr(b, "}\r\n"))) { |
300 |
s = atoi(b) - 2; |
while (b - vbuf > 0) |
301 |
|
if (*--b == '{') |
302 |
|
break; |
303 |
|
s = atoi(++b) - 2; |
304 |
b = strchr(b, '}'); |
b = strchr(b, '}'); |
305 |
b += 3; |
b += 3; |
306 |
} |
} |