215 |
/* |
/* |
216 |
* IMAP SEARCH: searches the mailbox for messages that match certain criteria. |
* IMAP SEARCH: searches the mailbox for messages that match certain criteria. |
217 |
*/ |
*/ |
218 |
int imap_search(int *sock, char *search) |
int imap_search(int *sock, char *charset, char *search) |
219 |
{ |
{ |
220 |
char cmd[BIG_CMD]; |
char cmd[BIG_CMD]; |
221 |
|
|
222 |
verbose("Client request: SEARCH\n"); |
verbose("Client request: SEARCH\n"); |
223 |
|
|
224 |
snprintf(cmd, BIG_CMD, "%X SEARCH %s\r\n", tag, search); |
if (*charset) |
225 |
|
snprintf(cmd, BIG_CMD, "%X SEARCH CHARSET \"%s\" %s\r\n", tag, |
226 |
|
charset, search); |
227 |
|
else |
228 |
|
snprintf(cmd, BIG_CMD, "%X SEARCH %s\r\n", tag, search); |
229 |
|
|
230 |
return send_command(sock, cmd); |
return send_command(sock, cmd); |
231 |
} |
} |