/* * Search selected mailbox according to the supplied search criteria. */ int request_search(session *ssn, const char *criteria, const char *charset, char **mesgs) { int t, r; if (charset != NULL && *charset != '\0') { TRY(t = send_request(ssn, "UID SEARCH CHARSET \"%s\" %s", charset, criteria)); } else { TRY(t = send_request(ssn, "UID SEARCH %s", criteria)); } TRY(r = response_search(ssn, t, mesgs)); return r; }
/* * Search selected mailbox according to the supplied search criteria. */ int request_search(const char *server, const char *port, const char *user, const char *criteria, const char *charset, char **mesgs) { int t, r; session *s; if (!(s = session_find(server, port, user))) return -1; t = imap_search(s, charset, criteria); if ((r = response_search(s, t, mesgs)) == -1) goto fail; return r; fail: close_connection(s); session_destroy(s); return -1; }