2001-07-08 17:34:02 +02:00
|
|
|
%{
|
2002-12-27 21:55:50 +01:00
|
|
|
/*
|
|
|
|
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
|
2007-01-15 10:03:17 +01:00
|
|
|
* Copyright (c) 2001-2007 by Hiroyuki Yamamoto & The Claws Mail Team
|
2002-12-27 21:55:50 +01:00
|
|
|
*
|
|
|
|
* 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
|
2005-09-21 20:22:51 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-12-27 21:55:50 +01:00
|
|
|
*/
|
|
|
|
|
2002-02-25 17:56:22 +01:00
|
|
|
#include "defs.h"
|
|
|
|
|
|
|
|
#include <glib.h>
|
2005-02-17 09:09:56 +01:00
|
|
|
#include <glib/gi18n.h>
|
2002-02-25 17:56:22 +01:00
|
|
|
|
|
|
|
#include "utils.h"
|
2001-07-08 17:34:02 +02:00
|
|
|
#include "filtering.h"
|
|
|
|
#include "matcher.h"
|
|
|
|
#include "matcher_parser.h"
|
|
|
|
#include "matcher_parser_lex.h"
|
2002-12-26 22:40:23 +01:00
|
|
|
#include "procmsg.h"
|
|
|
|
|
|
|
|
#define MAX_COLORLABELS (MSG_CLABEL_7 - MSG_CLABEL_NONE)
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
static gint error = 0;
|
|
|
|
static gint bool_op = 0;
|
|
|
|
static gint match_type = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
static gchar *header = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
2002-12-27 21:55:50 +01:00
|
|
|
static MatcherProp *prop;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
2002-12-27 21:55:50 +01:00
|
|
|
static GSList *matchers_list = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
2006-05-13 15:04:55 +02:00
|
|
|
static gboolean enabled = TRUE;
|
2005-08-22 18:13:03 +02:00
|
|
|
static gchar *name = NULL;
|
2006-07-31 13:44:30 +02:00
|
|
|
static gint account_id = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
static MatcherList *cond;
|
2003-08-07 15:30:23 +02:00
|
|
|
static GSList *action_list = NULL;
|
2002-12-27 21:55:50 +01:00
|
|
|
static FilteringAction *action = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
static gboolean matcher_is_fast = TRUE;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
2002-12-27 21:55:50 +01:00
|
|
|
static FilteringProp *filtering;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
2002-12-27 21:55:50 +01:00
|
|
|
static GSList **prefs_filtering = NULL;
|
2004-01-12 22:28:31 +01:00
|
|
|
static int enable_compatibility = 0;
|
2003-08-07 15:30:23 +02:00
|
|
|
|
|
|
|
enum {
|
2004-01-12 22:28:31 +01:00
|
|
|
MATCHER_PARSE_FILE,
|
2003-08-07 15:30:23 +02:00
|
|
|
MATCHER_PARSE_NO_EOL,
|
2006-05-13 15:04:55 +02:00
|
|
|
MATCHER_PARSE_ENABLED,
|
2005-08-22 18:13:03 +02:00
|
|
|
MATCHER_PARSE_NAME,
|
2006-07-31 13:44:30 +02:00
|
|
|
MATCHER_PARSE_ACCOUNT,
|
2003-08-07 15:30:23 +02:00
|
|
|
MATCHER_PARSE_CONDITION,
|
2004-01-12 22:28:31 +01:00
|
|
|
MATCHER_PARSE_FILTERING_ACTION,
|
2003-08-07 15:30:23 +02:00
|
|
|
};
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
static int matcher_parse_op = MATCHER_PARSE_FILE;
|
2003-08-07 15:30:23 +02:00
|
|
|
|
2001-07-08 17:34:02 +02:00
|
|
|
|
2001-11-15 23:41:46 +01:00
|
|
|
/* ******************************************************************** */
|
2005-09-16 19:14:56 +02:00
|
|
|
/* redeclarations to avoid warnings */
|
|
|
|
void matcher_parserrestart(FILE *input_file);
|
|
|
|
void matcher_parser_init(void);
|
|
|
|
void matcher_parser_switch_to_buffer(void * new_buffer);
|
|
|
|
void matcher_parser_delete_buffer(void * b);
|
2007-02-20 18:42:49 +01:00
|
|
|
void matcher_parserpop_buffer_state(void);
|
2005-09-16 19:14:56 +02:00
|
|
|
int matcher_parserlex(void);
|
2001-11-15 23:41:46 +01:00
|
|
|
|
2002-12-27 21:55:50 +01:00
|
|
|
void matcher_parser_start_parsing(FILE *f)
|
2001-11-15 23:41:46 +01:00
|
|
|
{
|
2007-02-14 11:14:37 +01:00
|
|
|
matcher_parserlineno = 1;
|
2001-11-15 23:41:46 +01:00
|
|
|
matcher_parserrestart(f);
|
2006-07-31 13:44:30 +02:00
|
|
|
account_id = 0;
|
2001-11-15 23:41:46 +01:00
|
|
|
matcher_parserparse();
|
|
|
|
}
|
2004-01-12 22:28:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
void * matcher_parser_scan_string(const char * str);
|
2001-11-15 23:41:46 +01:00
|
|
|
|
2004-11-13 09:14:41 +01:00
|
|
|
FilteringProp *matcher_parser_get_filtering(gchar *str)
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
void *bufstate;
|
2005-08-22 18:13:03 +02:00
|
|
|
void *tmp_str = NULL;
|
|
|
|
|
|
|
|
/* little hack to allow passing rules with no names */
|
|
|
|
if (!strncmp(str, "rulename ", 9))
|
|
|
|
tmp_str = g_strdup(str);
|
|
|
|
else
|
|
|
|
tmp_str = g_strconcat("rulename \"\" ", str, NULL);
|
2001-07-09 18:06:03 +02:00
|
|
|
|
2001-11-15 23:41:46 +01:00
|
|
|
/* bad coding to enable the sub-grammar matching
|
|
|
|
in yacc */
|
2001-07-08 17:34:02 +02:00
|
|
|
matcher_parserlineno = 1;
|
2003-08-07 15:30:23 +02:00
|
|
|
matcher_parse_op = MATCHER_PARSE_NO_EOL;
|
2002-11-10 17:10:53 +01:00
|
|
|
matcher_parserrestart(NULL);
|
2007-02-20 18:42:49 +01:00
|
|
|
matcher_parserpop_buffer_state();
|
2002-11-10 17:10:53 +01:00
|
|
|
matcher_parser_init();
|
2005-08-22 18:13:03 +02:00
|
|
|
bufstate = matcher_parser_scan_string((const char *) tmp_str);
|
2002-11-10 17:10:53 +01:00
|
|
|
matcher_parser_switch_to_buffer(bufstate);
|
2001-11-15 23:41:46 +01:00
|
|
|
if (matcher_parserparse() != 0)
|
|
|
|
filtering = NULL;
|
2004-01-12 22:28:31 +01:00
|
|
|
matcher_parse_op = MATCHER_PARSE_FILE;
|
2001-07-09 18:06:03 +02:00
|
|
|
matcher_parser_delete_buffer(bufstate);
|
2005-08-22 18:13:03 +02:00
|
|
|
g_free(tmp_str);
|
2001-07-08 17:34:02 +02:00
|
|
|
return filtering;
|
|
|
|
}
|
|
|
|
|
2002-12-27 21:55:50 +01:00
|
|
|
static gboolean check_quote_symetry(gchar *str)
|
2002-11-13 15:47:33 +01:00
|
|
|
{
|
2003-10-05 12:10:30 +02:00
|
|
|
const gchar *walk;
|
2002-11-13 15:47:33 +01:00
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (str == NULL)
|
|
|
|
return TRUE; /* heh, that's symetric */
|
|
|
|
if (*str == '\0')
|
|
|
|
return TRUE;
|
|
|
|
for (walk = str; *walk; walk++) {
|
|
|
|
if (*walk == '\"') {
|
|
|
|
if (walk == str /* first char */
|
|
|
|
|| *(walk - 1) != '\\') /* not escaped */
|
|
|
|
ret ++;
|
|
|
|
}
|
|
|
|
}
|
2002-12-27 21:55:50 +01:00
|
|
|
return !(ret % 2);
|
2002-11-13 15:47:33 +01:00
|
|
|
}
|
|
|
|
|
2005-08-22 18:13:03 +02:00
|
|
|
MatcherList *matcher_parser_get_name(gchar *str)
|
|
|
|
{
|
|
|
|
void *bufstate;
|
|
|
|
|
|
|
|
if (!check_quote_symetry(str)) {
|
|
|
|
cond = NULL;
|
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bad coding to enable the sub-grammar matching
|
|
|
|
in yacc */
|
|
|
|
matcher_parserlineno = 1;
|
|
|
|
matcher_parse_op = MATCHER_PARSE_NAME;
|
|
|
|
matcher_parserrestart(NULL);
|
2007-02-20 18:42:49 +01:00
|
|
|
matcher_parserpop_buffer_state();
|
2005-08-22 18:13:03 +02:00
|
|
|
matcher_parser_init();
|
|
|
|
bufstate = matcher_parser_scan_string(str);
|
|
|
|
matcher_parserparse();
|
|
|
|
matcher_parse_op = MATCHER_PARSE_FILE;
|
|
|
|
matcher_parser_delete_buffer(bufstate);
|
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
2006-07-31 13:44:30 +02:00
|
|
|
MatcherList *matcher_parser_get_enabled(gchar *str)
|
|
|
|
{
|
|
|
|
void *bufstate;
|
|
|
|
|
|
|
|
if (!check_quote_symetry(str)) {
|
|
|
|
cond = NULL;
|
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bad coding to enable the sub-grammar matching
|
|
|
|
in yacc */
|
|
|
|
matcher_parserlineno = 1;
|
|
|
|
matcher_parse_op = MATCHER_PARSE_ENABLED;
|
|
|
|
matcher_parserrestart(NULL);
|
2007-02-20 18:42:49 +01:00
|
|
|
matcher_parserpop_buffer_state();
|
2006-07-31 13:44:30 +02:00
|
|
|
matcher_parser_init();
|
|
|
|
bufstate = matcher_parser_scan_string(str);
|
|
|
|
matcher_parserparse();
|
|
|
|
matcher_parse_op = MATCHER_PARSE_FILE;
|
|
|
|
matcher_parser_delete_buffer(bufstate);
|
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
|
|
|
MatcherList *matcher_parser_get_account(gchar *str)
|
|
|
|
{
|
|
|
|
void *bufstate;
|
|
|
|
|
|
|
|
if (!check_quote_symetry(str)) {
|
|
|
|
cond = NULL;
|
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bad coding to enable the sub-grammar matching
|
|
|
|
in yacc */
|
|
|
|
matcher_parserlineno = 1;
|
|
|
|
matcher_parse_op = MATCHER_PARSE_ACCOUNT;
|
|
|
|
matcher_parserrestart(NULL);
|
2007-02-20 18:42:49 +01:00
|
|
|
matcher_parserpop_buffer_state();
|
2006-07-31 13:44:30 +02:00
|
|
|
matcher_parser_init();
|
|
|
|
bufstate = matcher_parser_scan_string(str);
|
|
|
|
matcher_parserparse();
|
|
|
|
matcher_parse_op = MATCHER_PARSE_FILE;
|
|
|
|
matcher_parser_delete_buffer(bufstate);
|
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
2006-09-29 18:59:06 +02:00
|
|
|
MatcherList *matcher_parser_get_cond(gchar *str, gboolean *is_fast)
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
void *bufstate;
|
2001-07-09 18:06:03 +02:00
|
|
|
|
2002-11-13 15:47:33 +01:00
|
|
|
if (!check_quote_symetry(str)) {
|
|
|
|
cond = NULL;
|
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = TRUE;
|
2001-11-15 23:41:46 +01:00
|
|
|
/* bad coding to enable the sub-grammar matching
|
|
|
|
in yacc */
|
2001-07-08 17:34:02 +02:00
|
|
|
matcher_parserlineno = 1;
|
2003-08-07 15:30:23 +02:00
|
|
|
matcher_parse_op = MATCHER_PARSE_CONDITION;
|
2002-11-10 17:10:53 +01:00
|
|
|
matcher_parserrestart(NULL);
|
2007-02-20 18:42:49 +01:00
|
|
|
matcher_parserpop_buffer_state();
|
2002-11-10 17:10:53 +01:00
|
|
|
matcher_parser_init();
|
2001-07-09 18:06:03 +02:00
|
|
|
bufstate = matcher_parser_scan_string(str);
|
2001-07-08 17:34:02 +02:00
|
|
|
matcher_parserparse();
|
2004-01-12 22:28:31 +01:00
|
|
|
matcher_parse_op = MATCHER_PARSE_FILE;
|
2001-07-09 18:06:03 +02:00
|
|
|
matcher_parser_delete_buffer(bufstate);
|
2006-09-29 18:59:06 +02:00
|
|
|
if (is_fast)
|
|
|
|
*is_fast = matcher_is_fast;
|
2001-07-08 17:34:02 +02:00
|
|
|
return cond;
|
|
|
|
}
|
|
|
|
|
2004-11-13 09:14:41 +01:00
|
|
|
GSList *matcher_parser_get_action_list(gchar *str)
|
2003-08-07 15:30:23 +02:00
|
|
|
{
|
|
|
|
void *bufstate;
|
|
|
|
|
|
|
|
if (!check_quote_symetry(str)) {
|
|
|
|
action_list = NULL;
|
|
|
|
return action_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bad coding to enable the sub-grammar matching
|
|
|
|
in yacc */
|
|
|
|
matcher_parserlineno = 1;
|
2004-01-12 22:28:31 +01:00
|
|
|
matcher_parse_op = MATCHER_PARSE_FILTERING_ACTION;
|
2003-08-07 15:30:23 +02:00
|
|
|
matcher_parserrestart(NULL);
|
2007-02-20 18:42:49 +01:00
|
|
|
matcher_parserpop_buffer_state();
|
2003-08-07 15:30:23 +02:00
|
|
|
matcher_parser_init();
|
|
|
|
bufstate = matcher_parser_scan_string(str);
|
|
|
|
matcher_parserparse();
|
2004-01-12 22:28:31 +01:00
|
|
|
matcher_parse_op = MATCHER_PARSE_FILE;
|
2003-08-07 15:30:23 +02:00
|
|
|
matcher_parser_delete_buffer(bufstate);
|
|
|
|
return action_list;
|
|
|
|
}
|
|
|
|
|
2004-11-13 09:14:41 +01:00
|
|
|
MatcherProp *matcher_parser_get_prop(gchar *str)
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
MatcherList *list;
|
|
|
|
MatcherProp *prop;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
matcher_parserlineno = 1;
|
2006-09-29 18:59:06 +02:00
|
|
|
list = matcher_parser_get_cond(str, NULL);
|
2001-07-08 17:34:02 +02:00
|
|
|
if (list == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (list->matchers == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (list->matchers->next != NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
prop = list->matchers->data;
|
|
|
|
|
|
|
|
g_slist_free(list->matchers);
|
|
|
|
g_free(list);
|
2001-11-15 23:41:46 +01:00
|
|
|
|
|
|
|
return prop;
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
|
2002-12-27 21:55:50 +01:00
|
|
|
void matcher_parsererror(char *str)
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
GSList *l;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
if (matchers_list) {
|
2002-12-27 21:55:50 +01:00
|
|
|
for (l = matchers_list; l != NULL; l = g_slist_next(l)) {
|
2001-07-08 17:34:02 +02:00
|
|
|
matcherprop_free((MatcherProp *)
|
|
|
|
l->data);
|
2002-11-13 13:55:51 +01:00
|
|
|
l->data = NULL;
|
|
|
|
}
|
2001-07-08 17:34:02 +02:00
|
|
|
g_slist_free(matchers_list);
|
|
|
|
matchers_list = NULL;
|
|
|
|
}
|
2002-11-13 13:55:51 +01:00
|
|
|
cond = NULL;
|
2004-01-12 22:28:31 +01:00
|
|
|
g_warning("filtering parsing: %i: %s\n",
|
2001-07-08 17:34:02 +02:00
|
|
|
matcher_parserlineno, str);
|
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int matcher_parserwrap(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
%}
|
|
|
|
|
|
|
|
%union {
|
2002-12-27 21:55:50 +01:00
|
|
|
char *str;
|
2001-07-08 17:34:02 +02:00
|
|
|
int value;
|
|
|
|
}
|
|
|
|
%token MATCHER_ALL MATCHER_UNREAD MATCHER_NOT_UNREAD
|
|
|
|
%token MATCHER_NEW MATCHER_NOT_NEW MATCHER_MARKED
|
|
|
|
%token MATCHER_NOT_MARKED MATCHER_DELETED MATCHER_NOT_DELETED
|
|
|
|
%token MATCHER_REPLIED MATCHER_NOT_REPLIED MATCHER_FORWARDED
|
|
|
|
%token MATCHER_NOT_FORWARDED MATCHER_SUBJECT MATCHER_NOT_SUBJECT
|
|
|
|
%token MATCHER_FROM MATCHER_NOT_FROM MATCHER_TO MATCHER_NOT_TO
|
|
|
|
%token MATCHER_CC MATCHER_NOT_CC MATCHER_TO_OR_CC MATCHER_NOT_TO_AND_NOT_CC
|
|
|
|
%token MATCHER_AGE_GREATER MATCHER_AGE_LOWER MATCHER_NEWSGROUPS
|
|
|
|
%token MATCHER_NOT_NEWSGROUPS MATCHER_INREPLYTO MATCHER_NOT_INREPLYTO
|
|
|
|
%token MATCHER_REFERENCES MATCHER_NOT_REFERENCES MATCHER_SCORE_GREATER
|
|
|
|
%token MATCHER_SCORE_LOWER MATCHER_HEADER MATCHER_NOT_HEADER
|
|
|
|
%token MATCHER_HEADERS_PART MATCHER_NOT_HEADERS_PART MATCHER_MESSAGE
|
|
|
|
%token MATCHER_NOT_MESSAGE MATCHER_BODY_PART MATCHER_NOT_BODY_PART
|
2004-01-12 22:28:31 +01:00
|
|
|
%token MATCHER_TEST MATCHER_NOT_TEST MATCHER_MATCHCASE MATCHER_MATCH
|
2001-07-08 17:34:02 +02:00
|
|
|
%token MATCHER_REGEXPCASE MATCHER_REGEXP MATCHER_SCORE MATCHER_MOVE
|
2006-07-31 14:03:02 +02:00
|
|
|
%token MATCHER_FOUND_IN_ADDRESSBOOK MATCHER_NOT_FOUND_IN_ADDRESSBOOK MATCHER_IN
|
2004-01-12 22:28:31 +01:00
|
|
|
%token MATCHER_COPY MATCHER_DELETE MATCHER_MARK MATCHER_UNMARK
|
|
|
|
%token MATCHER_LOCK MATCHER_UNLOCK
|
|
|
|
%token MATCHER_EXECUTE
|
2001-07-08 17:34:02 +02:00
|
|
|
%token MATCHER_MARK_AS_READ MATCHER_MARK_AS_UNREAD MATCHER_FORWARD
|
2007-02-20 18:34:12 +01:00
|
|
|
%token MATCHER_FORWARD_AS_ATTACHMENT MATCHER_EOL
|
2001-07-08 17:34:02 +02:00
|
|
|
%token MATCHER_OR MATCHER_AND
|
2003-03-26 23:31:30 +01:00
|
|
|
%token MATCHER_COLOR MATCHER_SCORE_EQUAL MATCHER_REDIRECT
|
2002-03-15 23:01:04 +01:00
|
|
|
%token MATCHER_SIZE_GREATER MATCHER_SIZE_SMALLER MATCHER_SIZE_EQUAL
|
2002-12-25 20:06:48 +01:00
|
|
|
%token MATCHER_LOCKED MATCHER_NOT_LOCKED
|
2004-07-13 19:19:21 +02:00
|
|
|
%token MATCHER_PARTIAL MATCHER_NOT_PARTIAL
|
2002-12-26 22:40:23 +01:00
|
|
|
%token MATCHER_COLORLABEL MATCHER_NOT_COLORLABEL
|
2002-12-31 10:46:20 +01:00
|
|
|
%token MATCHER_IGNORE_THREAD MATCHER_NOT_IGNORE_THREAD
|
2004-01-12 22:28:31 +01:00
|
|
|
%token MATCHER_CHANGE_SCORE MATCHER_SET_SCORE
|
2006-02-08 18:23:34 +01:00
|
|
|
%token MATCHER_STOP MATCHER_HIDE MATCHER_IGNORE
|
2007-01-25 08:47:09 +01:00
|
|
|
%token MATCHER_SPAM MATCHER_NOT_SPAM
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
%start file
|
|
|
|
|
2006-05-13 15:04:55 +02:00
|
|
|
%token MATCHER_ENABLED MATCHER_DISABLED
|
2005-08-22 18:13:03 +02:00
|
|
|
%token MATCHER_RULENAME
|
2006-07-31 13:44:30 +02:00
|
|
|
%token MATCHER_ACCOUNT
|
2001-07-08 17:34:02 +02:00
|
|
|
%token <str> MATCHER_STRING
|
|
|
|
%token <str> MATCHER_SECTION
|
2002-09-29 15:43:33 +02:00
|
|
|
%token <str> MATCHER_INTEGER
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
file:
|
|
|
|
{
|
2004-01-12 22:28:31 +01:00
|
|
|
if (matcher_parse_op == MATCHER_PARSE_FILE) {
|
|
|
|
prefs_filtering = &pre_global_processing;
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
file_line_list;
|
|
|
|
|
|
|
|
file_line_list:
|
|
|
|
file_line
|
|
|
|
file_line_list
|
|
|
|
| file_line
|
|
|
|
;
|
|
|
|
|
|
|
|
file_line:
|
|
|
|
section_notification
|
2003-08-07 15:30:23 +02:00
|
|
|
|
|
|
|
|
{ action_list = NULL; }
|
|
|
|
instruction
|
2001-11-15 23:41:46 +01:00
|
|
|
| error MATCHER_EOL
|
|
|
|
{
|
|
|
|
yyerrok;
|
|
|
|
};
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
section_notification:
|
|
|
|
MATCHER_SECTION MATCHER_EOL
|
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *folder = $1;
|
|
|
|
FolderItem *item = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (matcher_parse_op == MATCHER_PARSE_FILE) {
|
|
|
|
enable_compatibility = 0;
|
2003-02-11 18:00:31 +01:00
|
|
|
if (!strcmp(folder, "global")) {
|
2004-01-12 22:28:31 +01:00
|
|
|
/* backward compatibility */
|
|
|
|
enable_compatibility = 1;
|
|
|
|
}
|
|
|
|
else if (!strcmp(folder, "preglobal")) {
|
|
|
|
prefs_filtering = &pre_global_processing;
|
|
|
|
}
|
|
|
|
else if (!strcmp(folder, "postglobal")) {
|
|
|
|
prefs_filtering = &post_global_processing;
|
|
|
|
}
|
|
|
|
else if (!strcmp(folder, "filtering")) {
|
|
|
|
prefs_filtering = &filtering_rules;
|
|
|
|
}
|
|
|
|
else {
|
2003-02-11 18:00:31 +01:00
|
|
|
item = folder_find_item_from_identifier(folder);
|
|
|
|
if (item != NULL) {
|
|
|
|
prefs_filtering = &item->prefs->processing;
|
|
|
|
} else {
|
|
|
|
prefs_filtering = NULL;
|
|
|
|
}
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
instruction:
|
2006-07-31 13:44:30 +02:00
|
|
|
enabled name account condition filtering MATCHER_EOL
|
|
|
|
| enabled name account condition filtering
|
|
|
|
| enabled name condition filtering MATCHER_EOL
|
2006-05-13 15:04:55 +02:00
|
|
|
| enabled name condition filtering
|
|
|
|
| name condition filtering MATCHER_EOL
|
2005-08-22 18:13:03 +02:00
|
|
|
| name condition filtering
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
2003-08-07 15:30:23 +02:00
|
|
|
if (matcher_parse_op == MATCHER_PARSE_NO_EOL)
|
2001-11-15 23:41:46 +01:00
|
|
|
YYACCEPT;
|
|
|
|
else {
|
2006-07-31 13:44:30 +02:00
|
|
|
matcher_parsererror("parse error [no eol]");
|
2005-08-22 18:13:03 +02:00
|
|
|
YYERROR;
|
|
|
|
}
|
|
|
|
}
|
2006-05-13 15:04:55 +02:00
|
|
|
| enabled
|
|
|
|
{
|
|
|
|
if (matcher_parse_op == MATCHER_PARSE_ENABLED)
|
|
|
|
YYACCEPT;
|
|
|
|
else {
|
2006-07-31 13:44:30 +02:00
|
|
|
matcher_parsererror("parse error [enabled]");
|
|
|
|
YYERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
| account
|
|
|
|
{
|
|
|
|
if (matcher_parse_op == MATCHER_PARSE_ACCOUNT)
|
|
|
|
YYACCEPT;
|
|
|
|
else {
|
|
|
|
matcher_parsererror("parse error [account]");
|
2006-05-13 15:04:55 +02:00
|
|
|
YYERROR;
|
|
|
|
}
|
|
|
|
}
|
2005-08-22 18:13:03 +02:00
|
|
|
| name
|
|
|
|
{
|
|
|
|
if (matcher_parse_op == MATCHER_PARSE_NAME)
|
|
|
|
YYACCEPT;
|
|
|
|
else {
|
2006-07-31 13:44:30 +02:00
|
|
|
matcher_parsererror("parse error [name]");
|
2001-11-15 23:41:46 +01:00
|
|
|
YYERROR;
|
|
|
|
}
|
|
|
|
}
|
2003-08-07 15:30:23 +02:00
|
|
|
| condition
|
|
|
|
{
|
|
|
|
if (matcher_parse_op == MATCHER_PARSE_CONDITION)
|
|
|
|
YYACCEPT;
|
|
|
|
else {
|
2006-07-31 13:44:30 +02:00
|
|
|
matcher_parsererror("parse error [condition]");
|
2003-08-07 15:30:23 +02:00
|
|
|
YYERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
| filtering_action_list
|
2001-11-15 23:41:46 +01:00
|
|
|
{
|
2004-01-12 22:28:31 +01:00
|
|
|
if (matcher_parse_op == MATCHER_PARSE_FILTERING_ACTION)
|
2001-11-15 23:41:46 +01:00
|
|
|
YYACCEPT;
|
|
|
|
else {
|
2006-07-31 13:44:30 +02:00
|
|
|
matcher_parsererror("parse error [filtering action]");
|
2001-11-15 23:41:46 +01:00
|
|
|
YYERROR;
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
}
|
2003-08-07 15:30:23 +02:00
|
|
|
| MATCHER_EOL
|
2001-07-08 17:34:02 +02:00
|
|
|
;
|
|
|
|
|
2006-05-13 15:04:55 +02:00
|
|
|
enabled:
|
|
|
|
MATCHER_ENABLED
|
|
|
|
{
|
|
|
|
enabled = TRUE;
|
|
|
|
}
|
|
|
|
| MATCHER_DISABLED
|
|
|
|
{
|
|
|
|
enabled = FALSE;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
2005-08-22 18:13:03 +02:00
|
|
|
name:
|
|
|
|
MATCHER_RULENAME MATCHER_STRING
|
|
|
|
{
|
|
|
|
name = g_strdup($2);
|
|
|
|
}
|
2005-08-29 19:20:49 +02:00
|
|
|
;
|
2005-08-22 18:13:03 +02:00
|
|
|
|
2006-07-31 13:44:30 +02:00
|
|
|
account:
|
|
|
|
MATCHER_ACCOUNT MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
account_id = strtol($2, NULL, 10);
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
filtering:
|
2003-08-07 15:30:23 +02:00
|
|
|
filtering_action_list
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
2006-07-31 13:44:30 +02:00
|
|
|
filtering = filteringprop_new(enabled, name, account_id, cond, action_list);
|
2006-05-13 15:04:55 +02:00
|
|
|
enabled = TRUE;
|
2006-07-31 13:44:30 +02:00
|
|
|
account_id = 0;
|
2006-05-13 15:04:55 +02:00
|
|
|
g_free(name);
|
2005-08-22 18:13:03 +02:00
|
|
|
name = NULL;
|
2004-01-12 22:28:31 +01:00
|
|
|
if (enable_compatibility) {
|
|
|
|
prefs_filtering = &filtering_rules;
|
|
|
|
if (action_list != NULL) {
|
|
|
|
FilteringAction * first_action;
|
|
|
|
|
|
|
|
first_action = action_list->data;
|
|
|
|
|
|
|
|
if (first_action->type == MATCHACTION_CHANGE_SCORE)
|
|
|
|
prefs_filtering = &pre_global_processing;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-08 17:34:02 +02:00
|
|
|
cond = NULL;
|
2003-08-07 15:30:23 +02:00
|
|
|
action_list = NULL;
|
2004-01-12 22:28:31 +01:00
|
|
|
|
|
|
|
if ((matcher_parse_op == MATCHER_PARSE_FILE) &&
|
|
|
|
(prefs_filtering != NULL)) {
|
2002-12-27 21:55:50 +01:00
|
|
|
*prefs_filtering = g_slist_append(*prefs_filtering,
|
|
|
|
filtering);
|
2001-07-08 17:34:02 +02:00
|
|
|
filtering = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
2003-08-07 15:30:23 +02:00
|
|
|
filtering_action_list:
|
|
|
|
filtering_action_b filtering_action_list
|
|
|
|
| filtering_action_b
|
|
|
|
;
|
|
|
|
|
|
|
|
filtering_action_b:
|
|
|
|
filtering_action
|
|
|
|
{
|
|
|
|
action_list = g_slist_append(action_list, action);
|
|
|
|
action = NULL;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
2001-07-08 17:34:02 +02:00
|
|
|
match_type:
|
|
|
|
MATCHER_MATCHCASE
|
|
|
|
{
|
|
|
|
match_type = MATCHTYPE_MATCHCASE;
|
|
|
|
}
|
|
|
|
| MATCHER_MATCH
|
|
|
|
{
|
|
|
|
match_type = MATCHTYPE_MATCH;
|
|
|
|
}
|
|
|
|
| MATCHER_REGEXPCASE
|
|
|
|
{
|
|
|
|
match_type = MATCHTYPE_REGEXPCASE;
|
|
|
|
}
|
|
|
|
| MATCHER_REGEXP
|
|
|
|
{
|
|
|
|
match_type = MATCHTYPE_REGEXP;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
condition:
|
|
|
|
condition_list
|
|
|
|
{
|
|
|
|
cond = matcherlist_new(matchers_list, (bool_op == MATCHERBOOL_AND));
|
|
|
|
matchers_list = NULL;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
condition_list:
|
|
|
|
condition_list bool_op one_condition
|
|
|
|
{
|
|
|
|
matchers_list = g_slist_append(matchers_list, prop);
|
|
|
|
}
|
|
|
|
| one_condition
|
|
|
|
{
|
|
|
|
matchers_list = NULL;
|
|
|
|
matchers_list = g_slist_append(matchers_list, prop);
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
bool_op:
|
|
|
|
MATCHER_AND
|
|
|
|
{
|
|
|
|
bool_op = MATCHERBOOL_AND;
|
|
|
|
}
|
|
|
|
| MATCHER_OR
|
|
|
|
{
|
|
|
|
bool_op = MATCHERBOOL_OR;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
one_condition:
|
|
|
|
MATCHER_ALL
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_ALL;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_UNREAD
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_UNREAD;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_UNREAD
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_UNREAD;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NEW
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NEW;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_NEW
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_NEW;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_MARKED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_MARKED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_MARKED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_MARKED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_DELETED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_DELETED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_DELETED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_DELETED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_REPLIED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_REPLIED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_REPLIED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_REPLIED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_FORWARDED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_FORWARDED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_FORWARDED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_FORWARDED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
2002-12-25 20:06:48 +01:00
|
|
|
| MATCHER_LOCKED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_LOCKED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2002-12-25 20:06:48 +01:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_LOCKED
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_LOCKED;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2002-12-25 20:06:48 +01:00
|
|
|
}
|
2007-01-25 08:47:09 +01:00
|
|
|
| MATCHER_SPAM
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_SPAM;
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
|
|
|
}
|
|
|
|
| MATCHER_NOT_SPAM
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_SPAM;
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
|
|
|
}
|
2004-07-13 19:19:21 +02:00
|
|
|
| MATCHER_PARTIAL
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_PARTIAL;
|
2004-12-08 12:31:25 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2004-07-13 19:19:21 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_PARTIAL
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_PARTIAL;
|
2004-12-08 12:31:25 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2004-07-13 19:19:21 +02:00
|
|
|
}
|
2002-12-26 22:40:23 +01:00
|
|
|
| MATCHER_COLORLABEL MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_COLORLABEL;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 10);
|
|
|
|
if (value < 0) value = 0;
|
2002-12-26 22:40:23 +01:00
|
|
|
else if (value > MAX_COLORLABELS) value = MAX_COLORLABELS;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2002-12-26 22:40:23 +01:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_COLORLABEL MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_COLORLABEL;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
if (value < 0) value = 0;
|
2002-12-26 22:40:23 +01:00
|
|
|
else if (value > MAX_COLORLABELS) value = MAX_COLORLABELS;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2002-12-26 22:40:23 +01:00
|
|
|
}
|
2002-12-31 10:46:20 +01:00
|
|
|
| MATCHER_IGNORE_THREAD
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_IGNORE_THREAD;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2002-12-31 10:46:20 +01:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_IGNORE_THREAD
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_IGNORE_THREAD;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
|
2002-12-31 10:46:20 +01:00
|
|
|
}
|
2001-07-08 17:34:02 +02:00
|
|
|
| MATCHER_SUBJECT match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_SUBJECT;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_SUBJECT match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_SUBJECT;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_FROM match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_FROM;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_FROM match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_FROM;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_TO match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_TO;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_TO match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_TO;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_CC match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_CC;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_CC match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_CC;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_TO_OR_CC match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_TO_OR_CC;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_TO_AND_NOT_CC match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_TO_AND_NOT_CC;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_AGE_GREATER MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_AGE_GREATER;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_AGE_LOWER MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_AGE_LOWER;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NEWSGROUPS match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NEWSGROUPS;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_NEWSGROUPS match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_NEWSGROUPS;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_INREPLYTO match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_INREPLYTO;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_INREPLYTO match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_INREPLYTO;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_REFERENCES match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_REFERENCES;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_REFERENCES match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_REFERENCES;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_SCORE_GREATER MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_SCORE_GREATER;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_SCORE_LOWER MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_SCORE_LOWER;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
2001-11-15 23:41:46 +01:00
|
|
|
| MATCHER_SCORE_EQUAL MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_SCORE_EQUAL;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2001-11-15 23:41:46 +01:00
|
|
|
}
|
2002-03-15 23:01:04 +01:00
|
|
|
| MATCHER_SIZE_GREATER MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
criteria = MATCHCRITERIA_SIZE_GREATER;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2002-03-15 23:01:04 +01:00
|
|
|
}
|
|
|
|
| MATCHER_SIZE_SMALLER MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
criteria = MATCHCRITERIA_SIZE_SMALLER;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2002-03-15 23:01:04 +01:00
|
|
|
}
|
|
|
|
| MATCHER_SIZE_EQUAL MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gint value = 0;
|
|
|
|
criteria = MATCHCRITERIA_SIZE_EQUAL;
|
2004-01-12 22:28:31 +01:00
|
|
|
value = strtol($2, NULL, 0);
|
|
|
|
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
|
2002-03-15 23:01:04 +01:00
|
|
|
}
|
2001-07-08 17:34:02 +02:00
|
|
|
| MATCHER_HEADER MATCHER_STRING
|
|
|
|
{
|
|
|
|
header = g_strdup($2);
|
|
|
|
} match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2001-07-08 17:34:02 +02:00
|
|
|
criteria = MATCHCRITERIA_HEADER;
|
|
|
|
expr = $2;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, header, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
g_free(header);
|
|
|
|
}
|
|
|
|
| MATCHER_NOT_HEADER MATCHER_STRING
|
|
|
|
{
|
|
|
|
header = g_strdup($2);
|
|
|
|
} match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2001-07-08 17:34:02 +02:00
|
|
|
criteria = MATCHCRITERIA_NOT_HEADER;
|
|
|
|
expr = $2;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, header, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
g_free(header);
|
|
|
|
}
|
|
|
|
| MATCHER_HEADERS_PART match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2001-07-08 17:34:02 +02:00
|
|
|
criteria = MATCHCRITERIA_HEADERS_PART;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_HEADERS_PART match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2001-07-08 17:34:02 +02:00
|
|
|
criteria = MATCHCRITERIA_NOT_HEADERS_PART;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
2006-07-31 14:03:02 +02:00
|
|
|
| MATCHER_FOUND_IN_ADDRESSBOOK MATCHER_STRING
|
|
|
|
{
|
|
|
|
header = g_strdup($2);
|
|
|
|
} MATCHER_IN MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gchar *expr = NULL;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_FOUND_IN_ADDRESSBOOK;
|
|
|
|
expr = $2;
|
|
|
|
prop = matcherprop_new(criteria, header, match_type, expr, 0);
|
|
|
|
g_free(header);
|
|
|
|
}
|
|
|
|
| MATCHER_NOT_FOUND_IN_ADDRESSBOOK MATCHER_STRING
|
|
|
|
{
|
|
|
|
header = g_strdup($2);
|
|
|
|
} MATCHER_IN MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
|
|
|
gchar *expr = NULL;
|
|
|
|
|
|
|
|
criteria = MATCHCRITERIA_NOT_FOUND_IN_ADDRESSBOOK;
|
|
|
|
expr = $2;
|
|
|
|
prop = matcherprop_new(criteria, header, match_type, expr, 0);
|
|
|
|
g_free(header);
|
|
|
|
}
|
2001-07-08 17:34:02 +02:00
|
|
|
| MATCHER_MESSAGE match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2001-07-08 17:34:02 +02:00
|
|
|
criteria = MATCHCRITERIA_MESSAGE;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_MESSAGE match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2001-07-08 17:34:02 +02:00
|
|
|
criteria = MATCHCRITERIA_NOT_MESSAGE;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_BODY_PART match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2001-07-08 17:34:02 +02:00
|
|
|
criteria = MATCHCRITERIA_BODY_PART;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_NOT_BODY_PART match_type MATCHER_STRING
|
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2001-07-08 17:34:02 +02:00
|
|
|
criteria = MATCHCRITERIA_NOT_BODY_PART;
|
|
|
|
expr = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
2004-01-12 22:28:31 +01:00
|
|
|
| MATCHER_TEST MATCHER_STRING
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2004-01-12 22:28:31 +01:00
|
|
|
criteria = MATCHCRITERIA_TEST;
|
2001-07-08 17:34:02 +02:00
|
|
|
expr = $2;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
2004-01-12 22:28:31 +01:00
|
|
|
| MATCHER_NOT_TEST MATCHER_STRING
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
|
|
|
gint criteria = 0;
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *expr = NULL;
|
2006-09-29 18:59:06 +02:00
|
|
|
matcher_is_fast = FALSE;
|
2004-01-12 22:28:31 +01:00
|
|
|
criteria = MATCHCRITERIA_NOT_TEST;
|
2001-07-08 17:34:02 +02:00
|
|
|
expr = $2;
|
2004-01-12 22:28:31 +01:00
|
|
|
prop = matcherprop_new(criteria, NULL, 0, expr, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
filtering_action:
|
|
|
|
MATCHER_EXECUTE MATCHER_STRING
|
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *cmd = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_EXECUTE;
|
|
|
|
cmd = $2;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, cmd, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_MOVE MATCHER_STRING
|
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *destination = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_MOVE;
|
|
|
|
destination = $2;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, destination, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_COPY MATCHER_STRING
|
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *destination = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_COPY;
|
|
|
|
destination = $2;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, destination, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_DELETE
|
|
|
|
{
|
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_DELETE;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, NULL, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_MARK
|
|
|
|
{
|
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_MARK;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, NULL, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_UNMARK
|
|
|
|
{
|
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_UNMARK;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, NULL, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
2003-07-13 00:20:19 +02:00
|
|
|
| MATCHER_LOCK
|
|
|
|
{
|
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_LOCK;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, NULL, 0, 0);
|
2003-07-13 00:20:19 +02:00
|
|
|
}
|
|
|
|
| MATCHER_UNLOCK
|
|
|
|
{
|
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_UNLOCK;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, NULL, 0, 0);
|
2003-07-13 00:20:19 +02:00
|
|
|
}
|
2001-07-08 17:34:02 +02:00
|
|
|
| MATCHER_MARK_AS_READ
|
|
|
|
{
|
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_MARK_AS_READ;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, NULL, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_MARK_AS_UNREAD
|
|
|
|
{
|
|
|
|
gint action_type = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_MARK_AS_UNREAD;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type, 0, NULL, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_FORWARD MATCHER_INTEGER MATCHER_STRING
|
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *destination = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
gint action_type = 0;
|
|
|
|
gint account_id = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_FORWARD;
|
2004-01-12 22:28:31 +01:00
|
|
|
account_id = strtol($2, NULL, 10);
|
2001-07-08 17:34:02 +02:00
|
|
|
destination = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type,
|
|
|
|
account_id, destination, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
| MATCHER_FORWARD_AS_ATTACHMENT MATCHER_INTEGER MATCHER_STRING
|
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *destination = NULL;
|
2001-07-08 17:34:02 +02:00
|
|
|
gint action_type = 0;
|
|
|
|
gint account_id = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_FORWARD_AS_ATTACHMENT;
|
2004-01-12 22:28:31 +01:00
|
|
|
account_id = strtol($2, NULL, 10);
|
2001-07-08 17:34:02 +02:00
|
|
|
destination = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type,
|
|
|
|
account_id, destination, 0, 0);
|
2001-11-15 23:41:46 +01:00
|
|
|
}
|
2002-05-23 10:18:33 +02:00
|
|
|
| MATCHER_REDIRECT MATCHER_INTEGER MATCHER_STRING
|
2001-11-19 23:49:13 +01:00
|
|
|
{
|
2002-12-27 21:55:50 +01:00
|
|
|
gchar *destination = NULL;
|
2001-11-19 23:49:13 +01:00
|
|
|
gint action_type = 0;
|
|
|
|
gint account_id = 0;
|
|
|
|
|
2002-05-23 10:18:33 +02:00
|
|
|
action_type = MATCHACTION_REDIRECT;
|
2004-01-12 22:28:31 +01:00
|
|
|
account_id = strtol($2, NULL, 10);
|
2001-11-19 23:49:13 +01:00
|
|
|
destination = $3;
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(action_type,
|
|
|
|
account_id, destination, 0, 0);
|
2001-11-19 23:49:13 +01:00
|
|
|
}
|
2001-11-15 23:41:46 +01:00
|
|
|
| MATCHER_COLOR MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint action_type = 0;
|
|
|
|
gint color = 0;
|
|
|
|
|
|
|
|
action_type = MATCHACTION_COLOR;
|
2004-01-12 22:28:31 +01:00
|
|
|
color = strtol($2, NULL, 10);
|
|
|
|
action = filteringaction_new(action_type, 0, NULL, color, 0);
|
2003-01-12 15:07:40 +01:00
|
|
|
}
|
2004-01-12 22:28:31 +01:00
|
|
|
| MATCHER_CHANGE_SCORE MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint score = 0;
|
|
|
|
|
|
|
|
score = strtol($2, NULL, 10);
|
|
|
|
action = filteringaction_new(MATCHACTION_CHANGE_SCORE, 0,
|
|
|
|
NULL, 0, score);
|
|
|
|
}
|
|
|
|
/* backward compatibility */
|
|
|
|
| MATCHER_SCORE MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint score = 0;
|
|
|
|
|
|
|
|
score = strtol($2, NULL, 10);
|
|
|
|
action = filteringaction_new(MATCHACTION_CHANGE_SCORE, 0,
|
|
|
|
NULL, 0, score);
|
|
|
|
}
|
|
|
|
| MATCHER_SET_SCORE MATCHER_INTEGER
|
|
|
|
{
|
|
|
|
gint score = 0;
|
|
|
|
|
|
|
|
score = strtol($2, NULL, 10);
|
|
|
|
action = filteringaction_new(MATCHACTION_SET_SCORE, 0,
|
|
|
|
NULL, 0, score);
|
|
|
|
}
|
|
|
|
| MATCHER_HIDE
|
|
|
|
{
|
|
|
|
action = filteringaction_new(MATCHACTION_HIDE, 0, NULL, 0, 0);
|
|
|
|
}
|
2006-02-08 18:23:34 +01:00
|
|
|
| MATCHER_IGNORE
|
|
|
|
{
|
|
|
|
action = filteringaction_new(MATCHACTION_IGNORE, 0, NULL, 0, 0);
|
|
|
|
}
|
2004-01-12 22:28:31 +01:00
|
|
|
| MATCHER_STOP
|
2001-07-08 17:34:02 +02:00
|
|
|
{
|
2004-01-12 22:28:31 +01:00
|
|
|
action = filteringaction_new(MATCHACTION_STOP, 0, NULL, 0, 0);
|
2001-07-08 17:34:02 +02:00
|
|
|
}
|
|
|
|
;
|