2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2002 by the Claws Mail Team and Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include <sys/types.h>
28 /* constants generated by yacc */
29 #include "matcher_parser_lex.h"
30 #include "matcher_parser_parse.h"
44 typedef struct _MatcherProp MatcherProp;
51 typedef struct _MatcherList MatcherList;
54 /* map MATCHCRITERIA_ to yacc's MATCHER_ */
56 MATCHCRITERIA_ ## name = MATCHER_ ## name
58 /* map MATCHTYPE_ to yacc's MATCHER_ */
60 MATCHTYPE_ ## name = MATCHER_ ## name
62 /* map MATCHACTION_ to yacc's MATCHER_ */
64 MATCHACTION_ ## name = MATCHER_ ## name
66 /* map MATCHBOOL_ to yacc's MATCHER_ */
68 MATCHERBOOL_ ## name = MATCHER_ ## name
73 MC_(UNREAD), MC_(NOT_UNREAD),
74 MC_(NEW), MC_(NOT_NEW),
75 MC_(MARKED), MC_(NOT_MARKED),
76 MC_(DELETED), MC_(NOT_DELETED),
77 MC_(REPLIED), MC_(NOT_REPLIED),
78 MC_(FORWARDED), MC_(NOT_FORWARDED),
79 MC_(LOCKED), MC_(NOT_LOCKED),
80 MC_(SPAM),MC_(NOT_SPAM),
81 MC_(HAS_ATTACHMENT), MC_(HAS_NO_ATTACHMENT),
82 MC_(SIGNED), MC_(NOT_SIGNED),
83 MC_(PARTIAL), MC_(NOT_PARTIAL),
84 MC_(COLORLABEL), MC_(NOT_COLORLABEL),
85 MC_(IGNORE_THREAD), MC_(NOT_IGNORE_THREAD),
86 MC_(WATCH_THREAD), MC_(NOT_WATCH_THREAD),
87 MC_(SUBJECT), MC_(NOT_SUBJECT),
88 MC_(FROM), MC_(NOT_FROM),
91 MC_(TO_OR_CC), MC_(NOT_TO_AND_NOT_CC),
92 MC_(AGE_GREATER), MC_(AGE_LOWER),
93 MC_(NEWSGROUPS), MC_(NOT_NEWSGROUPS),
94 MC_(INREPLYTO), MC_(NOT_INREPLYTO),
95 MC_(REFERENCES), MC_(NOT_REFERENCES),
96 MC_(SCORE_GREATER), MC_(SCORE_LOWER),
97 MC_(HEADER), MC_(NOT_HEADER),
98 MC_(HEADERS_PART), MC_(NOT_HEADERS_PART),
99 MC_(MESSAGE), MC_(NOT_MESSAGE),
100 MC_(BODY_PART), MC_(NOT_BODY_PART),
101 MC_(TEST), MC_(NOT_TEST),
106 MC_(FOUND_IN_ADDRESSBOOK),MC_(NOT_FOUND_IN_ADDRESSBOOK),
107 MC_(TAG),MC_(NOT_TAG),
108 MC_(TAGGED),MC_(NOT_TAGGED),
130 MA_(FORWARD_AS_ATTACHMENT),
139 MA_(ADD_TO_ADDRESSBOOK),
143 /* boolean operations */
148 const gchar *get_matchparser_tab_str (gint id);
149 gint get_matchparser_tab_id (const gchar *str);
151 MatcherProp *matcherprop_new (gint criteria,
156 MatcherProp *matcherprop_new_create (gint criteria,
161 void matcherprop_free (MatcherProp *prop);
163 MatcherProp *matcherprop_parse (gchar **str);
165 MatcherProp *matcherprop_copy (const MatcherProp *src);
167 gboolean matcherprop_match (MatcherProp *prop,
170 MatcherList * matcherlist_new (GSList *matchers,
172 void matcherlist_free (MatcherList *cond);
174 MatcherList *matcherlist_parse (gchar **str);
176 gboolean matcherlist_match (MatcherList *cond,
179 gint matcher_parse_keyword (gchar **str);
180 gint matcher_parse_number (gchar **str);
181 gboolean matcher_parse_boolean_op (gchar **str);
182 gchar *matcher_parse_regexp (gchar **str);
183 gchar *matcher_parse_str (gchar **str);
184 gchar *matcherprop_to_string (MatcherProp *matcher);
185 gchar *matcherlist_to_string (const MatcherList *matchers);
186 gchar *matching_build_command (const gchar *cmd,
189 void prefs_matcher_read_config (void);
190 void prefs_matcher_write_config (void);
192 gchar * matcher_quote_str(const gchar * src);