-#ifndef MATCHER_PARSER_H
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (c) 2001-2002 by Hiroyuki Yamamoto & The Sylpheed Claws Team.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef MATCHER_PARSER_H
#define MATCHER_PARSER_H
#include "filtering.h"
#include "scoring.h"
#include <glib.h>
-// #define MATCHER_BUF_SIZE 16384
-
extern FILE *matcher_parserin;
extern int matcher_parserlineno;
-void matcher_parser_start_parsing(FILE * f);
-int matcher_parserparse(void);
-/* void matcher_parser_init();*/
+void matcher_parser_start_parsing (FILE *f);
+int matcher_parserparse (void);
-MatcherList * matcher_parser_get_cond(gchar * str);
-MatcherProp * matcher_parser_get_prop(gchar * str);
-FilteringProp * matcher_parser_get_filtering(gchar * str);
-ScoringProp * matcher_parser_get_scoring(gchar * str);
-/* void matcher_parser_read_config(); */
+MatcherList *matcher_parser_get_cond (gchar *str);
+MatcherProp *matcher_parser_get_prop (gchar *str);
+FilteringProp *matcher_parser_get_filtering (gchar *str);
+ScoringProp *matcher_parser_get_scoring (gchar *str);
#endif
+
%{
+
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (c) 2001-2002 by Hiroyuki Yamamoto & The Sylpheed Claws Team.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
#include "defs.h"
#include <glib.h>
static gint error = 0;
static gint bool_op = 0;
static gint match_type = 0;
-static gchar * header = NULL;
+static gchar *header = NULL;
-static MatcherProp * prop;
+static MatcherProp *prop;
-static GSList * matchers_list = NULL;
+static GSList *matchers_list = NULL;
-static MatcherList * cond;
+static MatcherList *cond;
static gint score = 0;
-static FilteringAction * action = NULL;
+static FilteringAction *action = NULL;
-static FilteringProp * filtering;
-static ScoringProp * scoring = NULL;
+static FilteringProp *filtering;
+static ScoringProp *scoring = NULL;
-static GSList ** prefs_scoring = NULL;
-static GSList ** prefs_filtering = NULL;
+static GSList **prefs_scoring = NULL;
+static GSList **prefs_filtering = NULL;
static int matcher_parser_dialog = 0;
-
/* ******************************************************************** */
-
-
-void matcher_parser_start_parsing(FILE * f)
+void matcher_parser_start_parsing(FILE *f)
{
matcher_parserrestart(f);
matcher_parserparse();
}
-FilteringProp * matcher_parser_get_filtering(gchar * str)
+FilteringProp *matcher_parser_get_filtering(gchar *str)
{
- void * bufstate;
+ void *bufstate;
/* bad coding to enable the sub-grammar matching
in yacc */
return filtering;
}
-ScoringProp * matcher_parser_get_scoring(gchar * str)
+ScoringProp *matcher_parser_get_scoring(gchar *str)
{
- void * bufstate;
+ void *bufstate;
/* bad coding to enable the sub-grammar matching
in yacc */
return scoring;
}
-static gboolean check_quote_symetry (gchar *str)
+static gboolean check_quote_symetry(gchar *str)
{
gchar *walk;
int ret = 0;
ret ++;
}
}
- return !(ret%2);
+ return !(ret % 2);
}
-MatcherList * matcher_parser_get_cond(gchar * str)
+MatcherList *matcher_parser_get_cond(gchar *str)
{
- void * bufstate;
+ void *bufstate;
if (!check_quote_symetry(str)) {
cond = NULL;
return cond;
}
-MatcherProp * matcher_parser_get_prop(gchar * str)
+MatcherProp *matcher_parser_get_prop(gchar *str)
{
- MatcherList * list;
- MatcherProp * prop;
+ MatcherList *list;
+ MatcherProp *prop;
matcher_parserlineno = 1;
list = matcher_parser_get_cond(str);
return prop;
}
-void matcher_parsererror(char * str)
+void matcher_parsererror(char *str)
{
- GSList * l;
+ GSList *l;
if (matchers_list) {
- for(l = matchers_list ; l != NULL ;
- l = g_slist_next(l)) {
+ for (l = matchers_list; l != NULL; l = g_slist_next(l)) {
matcherprop_free((MatcherProp *)
l->data);
l->data = NULL;
%}
%union {
- char * str;
+ char *str;
int value;
}
section_notification:
MATCHER_SECTION MATCHER_EOL
{
- gchar * folder = $1;
- FolderItem * item = NULL;
+ gchar *folder = $1;
+ FolderItem *item = NULL;
if (!matcher_parser_dialog) {
item = folder_find_item_from_identifier(folder);
cond = NULL;
action = NULL;
if (!matcher_parser_dialog) {
- * prefs_filtering = g_slist_append(* prefs_filtering,
- filtering);
+ *prefs_filtering = g_slist_append(*prefs_filtering,
+ filtering);
filtering = NULL;
}
}
cond = NULL;
score = 0;
if (!matcher_parser_dialog) {
- * prefs_scoring = g_slist_append(* prefs_scoring, scoring);
+ *prefs_scoring = g_slist_append(*prefs_scoring, scoring);
scoring = NULL;
}
}
| MATCHER_SUBJECT match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_SUBJECT;
expr = $3;
| MATCHER_NOT_SUBJECT match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_SUBJECT;
expr = $3;
| MATCHER_FROM match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_FROM;
expr = $3;
| MATCHER_NOT_FROM match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_FROM;
expr = $3;
| MATCHER_TO match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_TO;
expr = $3;
| MATCHER_NOT_TO match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_TO;
expr = $3;
| MATCHER_CC match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_CC;
expr = $3;
| MATCHER_NOT_CC match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_CC;
expr = $3;
| MATCHER_TO_OR_CC match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_TO_OR_CC;
expr = $3;
| MATCHER_NOT_TO_AND_NOT_CC match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_TO_AND_NOT_CC;
expr = $3;
| MATCHER_NEWSGROUPS match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NEWSGROUPS;
expr = $3;
| MATCHER_NOT_NEWSGROUPS match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_NEWSGROUPS;
expr = $3;
| MATCHER_INREPLYTO match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_INREPLYTO;
expr = $3;
| MATCHER_NOT_INREPLYTO match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_INREPLYTO;
expr = $3;
| MATCHER_REFERENCES match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_REFERENCES;
expr = $3;
| MATCHER_NOT_REFERENCES match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_REFERENCES;
expr = $3;
} match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_HEADER;
expr = $2;
} match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_HEADER;
expr = $2;
| MATCHER_HEADERS_PART match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_HEADERS_PART;
expr = $3;
| MATCHER_NOT_HEADERS_PART match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_HEADERS_PART;
expr = $3;
| MATCHER_MESSAGE match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_MESSAGE;
expr = $3;
| MATCHER_NOT_MESSAGE match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_MESSAGE;
expr = $3;
| MATCHER_BODY_PART match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_BODY_PART;
expr = $3;
| MATCHER_NOT_BODY_PART match_type MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_BODY_PART;
expr = $3;
| MATCHER_EXECUTE MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_EXECUTE;
expr = $2;
| MATCHER_NOT_EXECUTE MATCHER_STRING
{
gint criteria = 0;
- gchar * expr = NULL;
+ gchar *expr = NULL;
criteria = MATCHCRITERIA_NOT_EXECUTE;
expr = $2;
filtering_action:
MATCHER_EXECUTE MATCHER_STRING
{
- gchar * cmd = NULL;
+ gchar *cmd = NULL;
gint action_type = 0;
action_type = MATCHACTION_EXECUTE;
}
| MATCHER_MOVE MATCHER_STRING
{
- gchar * destination = NULL;
+ gchar *destination = NULL;
gint action_type = 0;
action_type = MATCHACTION_MOVE;
}
| MATCHER_COPY MATCHER_STRING
{
- gchar * destination = NULL;
+ gchar *destination = NULL;
gint action_type = 0;
action_type = MATCHACTION_COPY;
}
| MATCHER_FORWARD MATCHER_INTEGER MATCHER_STRING
{
- gchar * destination = NULL;
+ gchar *destination = NULL;
gint action_type = 0;
gint account_id = 0;
}
| MATCHER_FORWARD_AS_ATTACHMENT MATCHER_INTEGER MATCHER_STRING
{
- gchar * destination = NULL;
+ gchar *destination = NULL;
gint action_type = 0;
gint account_id = 0;
}
| MATCHER_REDIRECT MATCHER_INTEGER MATCHER_STRING
{
- gchar * destination = NULL;
+ gchar *destination = NULL;
gint action_type = 0;
gint account_id = 0;