claws-mail/src/matcher.h
2001-05-08 14:25:21 +00:00

82 lines
1.8 KiB
C

#ifndef MATCHER_H
#define MATCHER_H
#include <sys/types.h>
#include <regex.h>
#include <glib.h>
#include "procmsg.h"
enum {
MATCHING_ALL,
MATCHING_SUBJECT,
MATCHING_NOT_SUBJECT,
MATCHING_FROM,
MATCHING_NOT_FROM,
MATCHING_TO,
MATCHING_NOT_TO,
MATCHING_CC,
MATCHING_NOT_CC,
MATCHING_TO_OR_CC,
MATCHING_NOT_TO_AND_NOT_CC,
MATCHING_AGE_GREATER,
MATCHING_AGE_LOWER,
MATCHING_NEWSGROUPS,
MATCHING_NOT_NEWSGROUPS,
MATCHING_HEADER,
MATCHING_NOT_HEADER,
MATCHING_MESSAGE,
MATCHING_NOT_MESSAGE,
MATCHING_HEADERS_PART,
MATCHING_NOT_HEADERS_PART,
MATCHING_BODY_PART,
MATCHING_NOT_BODY_PART,
MATCHING_SCORE,
MATCHING_MATCH,
MATCHING_REGEXP,
MATCHING_MATCHCASE,
MATCHING_REGEXPCASE
};
struct _MatcherProp {
int matchtype;
int criteria;
gchar * header;
gchar * expr;
int age;
regex_t * preg;
int error;
};
typedef struct _MatcherProp MatcherProp;
struct _MatcherList {
GSList * matchers;
gboolean bool_and;
};
typedef struct _MatcherList MatcherList;
MatcherProp * matcherprop_new(gint criteria, gchar * header,
gint matchtype, gchar * expr,
int age);
void matcherprop_free(MatcherProp * prop);
MatcherProp * matcherprop_parse(gchar ** str);
gboolean matcherprop_match(MatcherProp * prop, MsgInfo * info);
MatcherList * matcherlist_new(GSList * matchers, gboolean bool_and);
void matcherlist_free(MatcherList * cond);
MatcherList * matcherlist_parse(gchar ** str);
gboolean matcherlist_match(MatcherList * cond, MsgInfo * info);
gint matcher_parse_keyword(gchar ** str);
gint matcher_parse_number(gchar ** str);
gboolean matcher_parse_boolean_op(gchar ** str);
gchar * matcher_parse_regexp(gchar ** str);
gchar * matcher_parse_str(gchar ** str);
gchar * matcherprop_to_string(MatcherProp * matcher);
gchar * matcherlist_to_string(MatcherList * matchers);
#endif