mail-search.h revision e68c528470154af1029233c04dd0d7944805f70f
#ifndef MAIL_SEARCH_H
#define MAIL_SEARCH_H
#include "seq-range-array.h"
#include "mail-types.h"
#include "mail-thread.h"
enum mail_search_arg_type {
/* sequence sets */
/* flags */
/* dates */
SEARCH_ON, /* time must point to beginning of the day */
SEARCH_SENTON, /* time must point to beginning of the day */
/* sizes */
/* headers */
/* body */
/* extensions */
};
enum mail_search_arg_flag {
comparisons */
MAIL_SEARCH_ARG_FLAG_USE_TZ = 0x01,
};
enum mail_search_modseq_type {
};
struct mail_search_modseq {
enum mail_search_modseq_type type;
};
struct mail_search_arg {
struct mail_search_arg *next;
enum mail_search_arg_type type;
struct {
struct mail_search_arg *subargs;
const char *str;
enum mail_flags flags;
enum mail_thread_type thread_type;
struct mail_keywords *keywords;
struct mail_search_modseq *modseq;
struct mail_search_args *search_args;
struct mail_search_result *search_result;
} value;
void *context;
const char *hdr_field_name; /* for SEARCH_HEADER* */
unsigned int not:1;
int result; /* -1 = unknown, 0 = unmatched, 1 = matched */
};
struct mail_search_args {
int refcount, init_refcount;
struct mail_search_arg *args;
const char *charset;
unsigned int simplified:1;
unsigned int have_inthreads:1;
};
STMT_START { \
} STMT_END
void *context);
/* Allocate keywords for search arguments. If change_uidsets is TRUE,
change uidsets to seqsets. */
/* Free keywords. The args can initialized afterwards again if needed.
The args can be reused for other queries after calling this. */
/* Convert sequence sets in args to UIDs. */
/* Returns TRUE if the two search arguments are fully compatible.
Always returns FALSE if there are seqsets, since they may point to different
messages depending on when the search is run. */
const struct mail_search_args *args2);
struct mail_search_args *
/* Reset the results in search arguments. match_always is reset only if
full_reset is TRUE. */
/* goes through arguments in list that don't have a result yet.
Returns 1 = search matched, 0 = search unmatched, -1 = don't know yet */
void *context);
#ifdef CONTEXT_TYPE_SAFETY
#else
#endif
/* Fills have_headers and have_body based on if such search argument exists
that needs to be checked. Returns the headers that we're searching for, or
NULL if we're searching for TEXT. */
const char *const *
bool *have_headers, bool *have_body);
#endif