/* returns number of patterns in the search that should be done server-side
* (eg are full-text) */
-static int do_search(const pattern_t *search, int allpats)
+static int do_search(const struct Pattern *search, int allpats)
{
int rc = 0;
- const pattern_t *pat = NULL;
+ const struct Pattern *pat = NULL;
for (pat = search; pat; pat = pat->next)
{
return rc;
}
-/* convert mutt pattern_t to IMAP SEARCH command containing only elements
+/* convert mutt Pattern to IMAP SEARCH command containing only elements
* that require full-text search (mutt already has what it needs for most
* match types, and does a better job (eg server doesn't support regexps). */
-static int imap_compile_search(const pattern_t *pat, struct Buffer *buf)
+static int imap_compile_search(const struct Pattern *pat, struct Buffer *buf)
{
if (!do_search(pat, 0))
return 0;
if ((clauses = do_search(pat->child, 1)) > 0)
{
- const pattern_t *clause = pat->child;
+ const struct Pattern *clause = pat->child;
mutt_buffer_addch(buf, '(');
return 0;
}
-int imap_search(struct Context *ctx, const pattern_t *pat)
+int imap_search(struct Context *ctx, const struct Pattern *pat)
{
struct Buffer buf;
IMAP_DATA *idata = ctx->data;
RANGE_E_CTX,
};
-static bool eat_regexp(pattern_t *pat, struct Buffer *s, struct Buffer *err)
+static bool eat_regexp(struct Pattern *pat, struct Buffer *s, struct Buffer *err)
{
struct Buffer buf;
char errmsg[STRING];
}
}
-static bool eat_date(pattern_t *pat, struct Buffer *s, struct Buffer *err)
+static bool eat_date(struct Pattern *pat, struct Buffer *s, struct Buffer *err)
{
struct Buffer buffer;
struct tm min, max;
return true;
}
-static bool eat_range(pattern_t *pat, struct Buffer *s, struct Buffer *err)
+static bool eat_range(struct Pattern *pat, struct Buffer *s, struct Buffer *err)
{
char *tmp = NULL;
int do_exclusive = 0;
}
}
-static void order_range(pattern_t *pat)
+static void order_range(struct Pattern *pat)
{
int num;
pat->max = num;
}
-static int eat_range_by_regexp(pattern_t *pat, struct Buffer *s, int kind, struct Buffer *err)
+static int eat_range_by_regexp(struct Pattern *pat, struct Buffer *s, int kind, struct Buffer *err)
{
int regerr;
regmatch_t pmatch[RANGE_RX_GROUPS];
return RANGE_E_OK;
}
-static bool eat_message_range(pattern_t *pat, struct Buffer *s, struct Buffer *err)
+static bool eat_message_range(struct Pattern *pat, struct Buffer *s, struct Buffer *err)
{
int skip_quote = 0;
int i_kind;
int tag; /* character used to represent this op */
int op; /* operation to perform */
int class;
- bool (*eat_arg)(pattern_t *, struct Buffer *, struct Buffer *);
+ bool (*eat_arg)(struct Pattern *, struct Buffer *, struct Buffer *);
} Flags[] = {
{ 'A', MUTT_ALL, 0, NULL },
{ 'b', MUTT_BODY, MUTT_FULL_MSG, eat_regexp },
{ 0, 0, 0, NULL },
};
-static pattern_t *SearchPattern = NULL; /* current search pattern */
+static struct Pattern *SearchPattern = NULL; /* current search pattern */
static char LastSearch[STRING] = { 0 }; /* last pattern searched for */
static char LastSearchExpn[LONG_STRING] = { 0 }; /* expanded version of
LastSearch */
return REG_ICASE; /* case-insensitive */
}
-static int patmatch(const pattern_t *pat, const char *buf)
+static int patmatch(const struct Pattern *pat, const char *buf)
{
if (pat->stringmatch)
return pat->ign_case ? !strcasestr(buf, pat->p.str) : !strstr(buf, pat->p.str);
return regexec(pat->p.rx, buf, 0, NULL, 0);
}
-static int msg_search(struct Context *ctx, pattern_t *pat, int msgno)
+static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno)
{
struct Message *msg = NULL;
STATE s;
return s;
}
-void mutt_pattern_free(pattern_t **pat)
+void mutt_pattern_free(struct Pattern **pat)
{
- pattern_t *tmp = NULL;
+ struct Pattern *tmp = NULL;
while (*pat)
{
}
}
-pattern_t *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer *err)
+struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer *err)
{
- pattern_t *curlist = NULL;
- pattern_t *tmp = NULL, *tmp2 = NULL;
- pattern_t *last = NULL;
+ struct Pattern *curlist = NULL;
+ struct Pattern *tmp = NULL, *tmp2 = NULL;
+ struct Pattern *last = NULL;
bool not = false;
bool alladdr = false;
bool or = false;
return curlist;
}
-static bool perform_and(pattern_t *pat, pattern_exec_flag flags, struct Context *ctx,
+static bool perform_and(struct Pattern *pat, pattern_exec_flag flags, struct Context *ctx,
struct Header *hdr, pattern_cache_t *cache)
{
for (; pat; pat = pat->next)
return true;
}
-static int perform_or(struct pattern_t *pat, pattern_exec_flag flags,
+static int perform_or(struct Pattern *pat, pattern_exec_flag flags,
struct Context *ctx, struct Header *hdr, pattern_cache_t *cache)
{
for (; pat; pat = pat->next)
return false;
}
-static int match_adrlist(pattern_t *pat, int match_personal, int n, ...)
+static int match_adrlist(struct Pattern *pat, int match_personal, int n, ...)
{
va_list ap;
struct Address *a = NULL;
return pat->alladdr; /* No matches, or all matches if alladdr */
}
-static bool match_reference(pattern_t *pat, struct List *refs)
+static bool match_reference(struct Pattern *pat, struct List *refs)
{
for (; refs; refs = refs->next)
if (patmatch(pat, refs->data) == 0)
return alladdr;
}
-static int match_threadcomplete(struct pattern_t *pat, pattern_exec_flag flags,
+static int match_threadcomplete(struct Pattern *pat, pattern_exec_flag flags,
struct Context *ctx, struct MuttThread *t, int left, int up,
int right, int down)
{
* flags: MUTT_MATCH_FULL_ADDRESS - match both personal and machine address
* cache: For repeated matches against the same Header, passing in non-NULL will
* store some of the cacheable pattern matches in this structure. */
-int mutt_pattern_exec(struct pattern_t *pat, pattern_exec_flag flags,
+int mutt_pattern_exec(struct Pattern *pat, pattern_exec_flag flags,
struct Context *ctx, struct Header *h, pattern_cache_t *cache)
{
int result;
int mutt_pattern_func(int op, char *prompt)
{
- pattern_t *pat = NULL;
+ struct Pattern *pat = NULL;
char buf[LONG_STRING] = "", *simple = NULL;
struct Buffer err;
int i;