5 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
6 * Copyright (c) 2001-2002 by Hiroyuki Yamamoto & The Sylpheed Claws Team.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include "filtering.h"
31 #include "matcher_parser.h"
32 #include "matcher_parser_lex.h"
35 #define MAX_COLORLABELS (MSG_CLABEL_7 - MSG_CLABEL_NONE)
37 static gint error = 0;
38 static gint bool_op = 0;
39 static gint match_type = 0;
40 static gchar *header = NULL;
42 static MatcherProp *prop;
44 static GSList *matchers_list = NULL;
46 static MatcherList *cond;
47 static gint score = 0;
48 static GSList *action_list = NULL;
49 static FilteringAction *action = NULL;
51 static FilteringProp *filtering;
53 static GSList **prefs_filtering = NULL;
54 static int enable_compatibility = 0;
59 MATCHER_PARSE_CONDITION,
60 MATCHER_PARSE_FILTERING_ACTION,
63 static int matcher_parse_op = MATCHER_PARSE_FILE;
66 /* ******************************************************************** */
68 void matcher_parser_start_parsing(FILE *f)
70 matcher_parserrestart(f);
71 matcher_parserparse();
75 void * matcher_parser_scan_string(const char * str);
77 FilteringProp *matcher_parser_get_filtering(const gchar *str)
81 /* bad coding to enable the sub-grammar matching
83 matcher_parserlineno = 1;
84 matcher_parse_op = MATCHER_PARSE_NO_EOL;
85 matcher_parserrestart(NULL);
86 matcher_parser_init();
87 bufstate = matcher_parser_scan_string((const char *) str);
88 matcher_parser_switch_to_buffer(bufstate);
89 if (matcher_parserparse() != 0)
91 matcher_parse_op = MATCHER_PARSE_FILE;
92 matcher_parser_delete_buffer(bufstate);
96 static gboolean check_quote_symetry(gchar *str)
102 return TRUE; /* heh, that's symetric */
105 for (walk = str; *walk; walk++) {
107 if (walk == str /* first char */
108 || *(walk - 1) != '\\') /* not escaped */
115 MatcherList *matcher_parser_get_cond(const gchar *str)
119 if (!check_quote_symetry(str)) {
124 /* bad coding to enable the sub-grammar matching
126 matcher_parserlineno = 1;
127 matcher_parse_op = MATCHER_PARSE_CONDITION;
128 matcher_parserrestart(NULL);
129 matcher_parser_init();
130 bufstate = matcher_parser_scan_string(str);
131 matcher_parserparse();
132 matcher_parse_op = MATCHER_PARSE_FILE;
133 matcher_parser_delete_buffer(bufstate);
137 GSList *matcher_parser_get_action_list(const gchar *str)
141 if (!check_quote_symetry(str)) {
146 /* bad coding to enable the sub-grammar matching
148 matcher_parserlineno = 1;
149 matcher_parse_op = MATCHER_PARSE_FILTERING_ACTION;
150 matcher_parserrestart(NULL);
151 matcher_parser_init();
152 bufstate = matcher_parser_scan_string(str);
153 matcher_parserparse();
154 matcher_parse_op = MATCHER_PARSE_FILE;
155 matcher_parser_delete_buffer(bufstate);
159 MatcherProp *matcher_parser_get_prop(const gchar *str)
164 matcher_parserlineno = 1;
165 list = matcher_parser_get_cond(str);
169 if (list->matchers == NULL)
172 if (list->matchers->next != NULL)
175 prop = list->matchers->data;
177 g_slist_free(list->matchers);
183 void matcher_parsererror(char *str)
188 for (l = matchers_list; l != NULL; l = g_slist_next(l)) {
189 matcherprop_free((MatcherProp *)
193 g_slist_free(matchers_list);
194 matchers_list = NULL;
197 g_warning("filtering parsing: %i: %s\n",
198 matcher_parserlineno, str);
202 int matcher_parserwrap(void)
213 %token MATCHER_ALL MATCHER_UNREAD MATCHER_NOT_UNREAD
214 %token MATCHER_NEW MATCHER_NOT_NEW MATCHER_MARKED
215 %token MATCHER_NOT_MARKED MATCHER_DELETED MATCHER_NOT_DELETED
216 %token MATCHER_REPLIED MATCHER_NOT_REPLIED MATCHER_FORWARDED
217 %token MATCHER_NOT_FORWARDED MATCHER_SUBJECT MATCHER_NOT_SUBJECT
218 %token MATCHER_FROM MATCHER_NOT_FROM MATCHER_TO MATCHER_NOT_TO
219 %token MATCHER_CC MATCHER_NOT_CC MATCHER_TO_OR_CC MATCHER_NOT_TO_AND_NOT_CC
220 %token MATCHER_AGE_GREATER MATCHER_AGE_LOWER MATCHER_NEWSGROUPS
221 %token MATCHER_NOT_NEWSGROUPS MATCHER_INREPLYTO MATCHER_NOT_INREPLYTO
222 %token MATCHER_REFERENCES MATCHER_NOT_REFERENCES MATCHER_SCORE_GREATER
223 %token MATCHER_SCORE_LOWER MATCHER_HEADER MATCHER_NOT_HEADER
224 %token MATCHER_HEADERS_PART MATCHER_NOT_HEADERS_PART MATCHER_MESSAGE
225 %token MATCHER_NOT_MESSAGE MATCHER_BODY_PART MATCHER_NOT_BODY_PART
226 %token MATCHER_TEST MATCHER_NOT_TEST MATCHER_MATCHCASE MATCHER_MATCH
227 %token MATCHER_REGEXPCASE MATCHER_REGEXP MATCHER_SCORE MATCHER_MOVE
228 %token MATCHER_ANY_IN_ADDRESSBOOK MATCHER_ALL_IN_ADDRESSBOOK
229 %token MATCHER_COPY MATCHER_DELETE MATCHER_MARK MATCHER_UNMARK
230 %token MATCHER_LOCK MATCHER_UNLOCK
231 %token MATCHER_EXECUTE
232 %token MATCHER_MARK_AS_READ MATCHER_MARK_AS_UNREAD MATCHER_FORWARD
233 %token MATCHER_FORWARD_AS_ATTACHMENT MATCHER_EOL MATCHER_STRING
234 %token MATCHER_OR MATCHER_AND
235 %token MATCHER_COLOR MATCHER_SCORE_EQUAL MATCHER_REDIRECT
236 %token MATCHER_SIZE_GREATER MATCHER_SIZE_SMALLER MATCHER_SIZE_EQUAL
237 %token MATCHER_LOCKED MATCHER_NOT_LOCKED
238 %token MATCHER_COLORLABEL MATCHER_NOT_COLORLABEL
239 %token MATCHER_IGNORE_THREAD MATCHER_NOT_IGNORE_THREAD
240 %token MATCHER_CHANGE_SCORE MATCHER_SET_SCORE
241 %token MATCHER_STOP MATCHER_HIDE
245 %token <str> MATCHER_STRING
246 %token <str> MATCHER_SECTION
247 %token <str> MATCHER_INTEGER
253 if (matcher_parse_op == MATCHER_PARSE_FILE) {
254 prefs_filtering = &pre_global_processing;
268 { action_list = NULL; }
275 section_notification:
276 MATCHER_SECTION MATCHER_EOL
279 FolderItem *item = NULL;
281 if (matcher_parse_op == MATCHER_PARSE_FILE) {
282 enable_compatibility = 0;
283 if (!strcmp(folder, "global")) {
284 /* backward compatibility */
285 enable_compatibility = 1;
287 else if (!strcmp(folder, "preglobal")) {
288 prefs_filtering = &pre_global_processing;
290 else if (!strcmp(folder, "postglobal")) {
291 prefs_filtering = &post_global_processing;
293 else if (!strcmp(folder, "filtering")) {
294 prefs_filtering = &filtering_rules;
297 item = folder_find_item_from_identifier(folder);
299 prefs_filtering = &item->prefs->processing;
301 prefs_filtering = NULL;
309 condition filtering MATCHER_EOL
310 | condition filtering
312 if (matcher_parse_op == MATCHER_PARSE_NO_EOL)
315 matcher_parsererror("parse error");
321 if (matcher_parse_op == MATCHER_PARSE_CONDITION)
324 matcher_parsererror("parse error");
328 | filtering_action_list
330 if (matcher_parse_op == MATCHER_PARSE_FILTERING_ACTION)
333 matcher_parsererror("parse error");
341 filtering_action_list
343 filtering = filteringprop_new(cond, action_list);
345 if (enable_compatibility) {
346 prefs_filtering = &filtering_rules;
347 if (action_list != NULL) {
348 FilteringAction * first_action;
350 first_action = action_list->data;
352 if (first_action->type == MATCHACTION_CHANGE_SCORE)
353 prefs_filtering = &pre_global_processing;
360 if ((matcher_parse_op == MATCHER_PARSE_FILE) &&
361 (prefs_filtering != NULL)) {
362 *prefs_filtering = g_slist_append(*prefs_filtering,
369 filtering_action_list:
370 filtering_action_b filtering_action_list
377 action_list = g_slist_append(action_list, action);
385 match_type = MATCHTYPE_MATCHCASE;
389 match_type = MATCHTYPE_MATCH;
393 match_type = MATCHTYPE_REGEXPCASE;
397 match_type = MATCHTYPE_REGEXP;
399 | MATCHER_ANY_IN_ADDRESSBOOK
401 match_type = MATCHTYPE_ANY_IN_ADDRESSBOOK;
403 | MATCHER_ALL_IN_ADDRESSBOOK
405 match_type = MATCHTYPE_ALL_IN_ADDRESSBOOK;
412 cond = matcherlist_new(matchers_list, (bool_op == MATCHERBOOL_AND));
413 matchers_list = NULL;
418 condition_list bool_op one_condition
420 matchers_list = g_slist_append(matchers_list, prop);
424 matchers_list = NULL;
425 matchers_list = g_slist_append(matchers_list, prop);
432 bool_op = MATCHERBOOL_AND;
436 bool_op = MATCHERBOOL_OR;
445 criteria = MATCHCRITERIA_ALL;
446 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
452 criteria = MATCHCRITERIA_UNREAD;
453 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
459 criteria = MATCHCRITERIA_NOT_UNREAD;
460 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
466 criteria = MATCHCRITERIA_NEW;
467 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
473 criteria = MATCHCRITERIA_NOT_NEW;
474 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
480 criteria = MATCHCRITERIA_MARKED;
481 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
487 criteria = MATCHCRITERIA_NOT_MARKED;
488 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
494 criteria = MATCHCRITERIA_DELETED;
495 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
497 | MATCHER_NOT_DELETED
501 criteria = MATCHCRITERIA_NOT_DELETED;
502 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
508 criteria = MATCHCRITERIA_REPLIED;
509 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
511 | MATCHER_NOT_REPLIED
515 criteria = MATCHCRITERIA_NOT_REPLIED;
516 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
522 criteria = MATCHCRITERIA_FORWARDED;
523 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
525 | MATCHER_NOT_FORWARDED
529 criteria = MATCHCRITERIA_NOT_FORWARDED;
530 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
536 criteria = MATCHCRITERIA_LOCKED;
537 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
543 criteria = MATCHCRITERIA_NOT_LOCKED;
544 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
546 | MATCHER_COLORLABEL MATCHER_INTEGER
551 criteria = MATCHCRITERIA_COLORLABEL;
552 value = strtol($2, NULL, 10);
553 if (value < 0) value = 0;
554 else if (value > MAX_COLORLABELS) value = MAX_COLORLABELS;
555 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
557 | MATCHER_NOT_COLORLABEL MATCHER_INTEGER
562 criteria = MATCHCRITERIA_NOT_COLORLABEL;
563 value = strtol($2, NULL, 0);
564 if (value < 0) value = 0;
565 else if (value > MAX_COLORLABELS) value = MAX_COLORLABELS;
566 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
568 | MATCHER_IGNORE_THREAD
572 criteria = MATCHCRITERIA_IGNORE_THREAD;
573 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
575 | MATCHER_NOT_IGNORE_THREAD
579 criteria = MATCHCRITERIA_NOT_IGNORE_THREAD;
580 prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
582 | MATCHER_SUBJECT match_type MATCHER_STRING
587 criteria = MATCHCRITERIA_SUBJECT;
589 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
591 | MATCHER_NOT_SUBJECT match_type MATCHER_STRING
596 criteria = MATCHCRITERIA_NOT_SUBJECT;
598 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
600 | MATCHER_FROM match_type MATCHER_STRING
605 criteria = MATCHCRITERIA_FROM;
607 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
609 | MATCHER_NOT_FROM match_type MATCHER_STRING
614 criteria = MATCHCRITERIA_NOT_FROM;
616 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
618 | MATCHER_TO match_type MATCHER_STRING
623 criteria = MATCHCRITERIA_TO;
625 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
627 | MATCHER_NOT_TO match_type MATCHER_STRING
632 criteria = MATCHCRITERIA_NOT_TO;
634 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
636 | MATCHER_CC match_type MATCHER_STRING
641 criteria = MATCHCRITERIA_CC;
643 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
645 | MATCHER_NOT_CC match_type MATCHER_STRING
650 criteria = MATCHCRITERIA_NOT_CC;
652 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
654 | MATCHER_TO_OR_CC match_type MATCHER_STRING
659 criteria = MATCHCRITERIA_TO_OR_CC;
661 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
663 | MATCHER_NOT_TO_AND_NOT_CC match_type MATCHER_STRING
668 criteria = MATCHCRITERIA_NOT_TO_AND_NOT_CC;
670 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
672 | MATCHER_AGE_GREATER MATCHER_INTEGER
677 criteria = MATCHCRITERIA_AGE_GREATER;
678 value = strtol($2, NULL, 0);
679 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
681 | MATCHER_AGE_LOWER MATCHER_INTEGER
686 criteria = MATCHCRITERIA_AGE_LOWER;
687 value = strtol($2, NULL, 0);
688 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
690 | MATCHER_NEWSGROUPS match_type MATCHER_STRING
695 criteria = MATCHCRITERIA_NEWSGROUPS;
697 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
699 | MATCHER_NOT_NEWSGROUPS match_type MATCHER_STRING
704 criteria = MATCHCRITERIA_NOT_NEWSGROUPS;
706 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
708 | MATCHER_INREPLYTO match_type MATCHER_STRING
713 criteria = MATCHCRITERIA_INREPLYTO;
715 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
717 | MATCHER_NOT_INREPLYTO match_type MATCHER_STRING
722 criteria = MATCHCRITERIA_NOT_INREPLYTO;
724 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
726 | MATCHER_REFERENCES match_type MATCHER_STRING
731 criteria = MATCHCRITERIA_REFERENCES;
733 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
735 | MATCHER_NOT_REFERENCES match_type MATCHER_STRING
740 criteria = MATCHCRITERIA_NOT_REFERENCES;
742 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
744 | MATCHER_SCORE_GREATER MATCHER_INTEGER
749 criteria = MATCHCRITERIA_SCORE_GREATER;
750 value = strtol($2, NULL, 0);
751 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
753 | MATCHER_SCORE_LOWER MATCHER_INTEGER
758 criteria = MATCHCRITERIA_SCORE_LOWER;
759 value = strtol($2, NULL, 0);
760 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
762 | MATCHER_SCORE_EQUAL MATCHER_INTEGER
767 criteria = MATCHCRITERIA_SCORE_EQUAL;
768 value = strtol($2, NULL, 0);
769 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
771 | MATCHER_SIZE_GREATER MATCHER_INTEGER
775 criteria = MATCHCRITERIA_SIZE_GREATER;
776 value = strtol($2, NULL, 0);
777 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
779 | MATCHER_SIZE_SMALLER MATCHER_INTEGER
783 criteria = MATCHCRITERIA_SIZE_SMALLER;
784 value = strtol($2, NULL, 0);
785 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
787 | MATCHER_SIZE_EQUAL MATCHER_INTEGER
791 criteria = MATCHCRITERIA_SIZE_EQUAL;
792 value = strtol($2, NULL, 0);
793 prop = matcherprop_new(criteria, NULL, 0, NULL, value);
795 | MATCHER_HEADER MATCHER_STRING
797 header = g_strdup($2);
798 } match_type MATCHER_STRING
803 criteria = MATCHCRITERIA_HEADER;
805 prop = matcherprop_new(criteria, header, match_type, expr, 0);
808 | MATCHER_NOT_HEADER MATCHER_STRING
810 header = g_strdup($2);
811 } match_type MATCHER_STRING
816 criteria = MATCHCRITERIA_NOT_HEADER;
818 prop = matcherprop_new(criteria, header, match_type, expr, 0);
821 | MATCHER_HEADERS_PART match_type MATCHER_STRING
826 criteria = MATCHCRITERIA_HEADERS_PART;
828 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
830 | MATCHER_NOT_HEADERS_PART match_type MATCHER_STRING
835 criteria = MATCHCRITERIA_NOT_HEADERS_PART;
837 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
839 | MATCHER_MESSAGE match_type MATCHER_STRING
844 criteria = MATCHCRITERIA_MESSAGE;
846 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
848 | MATCHER_NOT_MESSAGE match_type MATCHER_STRING
853 criteria = MATCHCRITERIA_NOT_MESSAGE;
855 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
857 | MATCHER_BODY_PART match_type MATCHER_STRING
862 criteria = MATCHCRITERIA_BODY_PART;
864 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
866 | MATCHER_NOT_BODY_PART match_type MATCHER_STRING
871 criteria = MATCHCRITERIA_NOT_BODY_PART;
873 prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
875 | MATCHER_TEST MATCHER_STRING
880 criteria = MATCHCRITERIA_TEST;
882 prop = matcherprop_new(criteria, NULL, 0, expr, 0);
884 | MATCHER_NOT_TEST MATCHER_STRING
889 criteria = MATCHCRITERIA_NOT_TEST;
891 prop = matcherprop_new(criteria, NULL, 0, expr, 0);
896 MATCHER_EXECUTE MATCHER_STRING
899 gint action_type = 0;
901 action_type = MATCHACTION_EXECUTE;
903 action = filteringaction_new(action_type, 0, cmd, 0, 0);
905 | MATCHER_MOVE MATCHER_STRING
907 gchar *destination = NULL;
908 gint action_type = 0;
910 action_type = MATCHACTION_MOVE;
912 action = filteringaction_new(action_type, 0, destination, 0, 0);
914 | MATCHER_COPY MATCHER_STRING
916 gchar *destination = NULL;
917 gint action_type = 0;
919 action_type = MATCHACTION_COPY;
921 action = filteringaction_new(action_type, 0, destination, 0, 0);
925 gint action_type = 0;
927 action_type = MATCHACTION_DELETE;
928 action = filteringaction_new(action_type, 0, NULL, 0, 0);
932 gint action_type = 0;
934 action_type = MATCHACTION_MARK;
935 action = filteringaction_new(action_type, 0, NULL, 0, 0);
939 gint action_type = 0;
941 action_type = MATCHACTION_UNMARK;
942 action = filteringaction_new(action_type, 0, NULL, 0, 0);
946 gint action_type = 0;
948 action_type = MATCHACTION_LOCK;
949 action = filteringaction_new(action_type, 0, NULL, 0, 0);
953 gint action_type = 0;
955 action_type = MATCHACTION_UNLOCK;
956 action = filteringaction_new(action_type, 0, NULL, 0, 0);
958 | MATCHER_MARK_AS_READ
960 gint action_type = 0;
962 action_type = MATCHACTION_MARK_AS_READ;
963 action = filteringaction_new(action_type, 0, NULL, 0, 0);
965 | MATCHER_MARK_AS_UNREAD
967 gint action_type = 0;
969 action_type = MATCHACTION_MARK_AS_UNREAD;
970 action = filteringaction_new(action_type, 0, NULL, 0, 0);
972 | MATCHER_FORWARD MATCHER_INTEGER MATCHER_STRING
974 gchar *destination = NULL;
975 gint action_type = 0;
978 action_type = MATCHACTION_FORWARD;
979 account_id = strtol($2, NULL, 10);
981 action = filteringaction_new(action_type,
982 account_id, destination, 0, 0);
984 | MATCHER_FORWARD_AS_ATTACHMENT MATCHER_INTEGER MATCHER_STRING
986 gchar *destination = NULL;
987 gint action_type = 0;
990 action_type = MATCHACTION_FORWARD_AS_ATTACHMENT;
991 account_id = strtol($2, NULL, 10);
993 action = filteringaction_new(action_type,
994 account_id, destination, 0, 0);
996 | MATCHER_REDIRECT MATCHER_INTEGER MATCHER_STRING
998 gchar *destination = NULL;
999 gint action_type = 0;
1000 gint account_id = 0;
1002 action_type = MATCHACTION_REDIRECT;
1003 account_id = strtol($2, NULL, 10);
1005 action = filteringaction_new(action_type,
1006 account_id, destination, 0, 0);
1008 | MATCHER_COLOR MATCHER_INTEGER
1010 gint action_type = 0;
1013 action_type = MATCHACTION_COLOR;
1014 color = strtol($2, NULL, 10);
1015 action = filteringaction_new(action_type, 0, NULL, color, 0);
1017 | MATCHER_CHANGE_SCORE MATCHER_INTEGER
1021 score = strtol($2, NULL, 10);
1022 action = filteringaction_new(MATCHACTION_CHANGE_SCORE, 0,
1025 /* backward compatibility */
1026 | MATCHER_SCORE MATCHER_INTEGER
1030 score = strtol($2, NULL, 10);
1031 action = filteringaction_new(MATCHACTION_CHANGE_SCORE, 0,
1034 | MATCHER_SET_SCORE MATCHER_INTEGER
1038 score = strtol($2, NULL, 10);
1039 action = filteringaction_new(MATCHACTION_SET_SCORE, 0,
1044 action = filteringaction_new(MATCHACTION_HIDE, 0, NULL, 0, 0);
1048 action = filteringaction_new(MATCHACTION_STOP, 0, NULL, 0, 0);