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"
32 #include "matcher_parser.h"
33 #include "matcher_parser_lex.h"
36 #define MAX_COLORLABELS (MSG_CLABEL_7 - MSG_CLABEL_NONE)
38 static gint error = 0;
39 static gint bool_op = 0;
40 static gint match_type = 0;
41 static gchar *header = NULL;
43 static MatcherProp *prop;
45 static GSList *matchers_list = NULL;
47 static MatcherList *cond;
48 static gint score = 0;
49 static GSList *action_list = NULL;
50 static FilteringAction *action = NULL;
52 static FilteringProp *filtering;
53 static ScoringProp *scoring = NULL;
55 static GSList **prefs_scoring = NULL;
56 static GSList **prefs_filtering = NULL;
59 static int matcher_parser_dialog = 0;
65 MATCHER_PARSE_CONDITION,
66 MATCHER_PARSE_FILTERING_OR_SCORING,
69 static int matcher_parse_op = MATCHER_PARSE_NONE;
72 /* ******************************************************************** */
74 void matcher_parser_start_parsing(FILE *f)
76 matcher_parserrestart(f);
77 matcher_parserparse();
80 FilteringProp *matcher_parser_get_filtering(gchar *str)
84 /* bad coding to enable the sub-grammar matching
86 matcher_parserlineno = 1;
87 matcher_parse_op = MATCHER_PARSE_NO_EOL;
88 matcher_parserrestart(NULL);
89 matcher_parser_init();
90 bufstate = matcher_parser_scan_string(str);
91 matcher_parser_switch_to_buffer(bufstate);
92 if (matcher_parserparse() != 0)
94 matcher_parse_op = MATCHER_PARSE_NONE;
95 matcher_parser_delete_buffer(bufstate);
99 ScoringProp *matcher_parser_get_scoring(gchar *str)
103 /* bad coding to enable the sub-grammar matching
105 matcher_parserlineno = 1;
106 matcher_parse_op = MATCHER_PARSE_NO_EOL;
107 matcher_parserrestart(NULL);
108 matcher_parser_init();
109 bufstate = matcher_parser_scan_string(str);
110 matcher_parser_switch_to_buffer(bufstate);
111 if (matcher_parserparse() != 0)
113 matcher_parse_op = MATCHER_PARSE_NONE;
114 matcher_parser_delete_buffer(bufstate);
118 static gboolean check_quote_symetry(gchar *str)
124 return TRUE; /* heh, that's symetric */
127 for (walk = str; *walk; walk++) {
129 if (walk == str /* first char */
130 || *(walk - 1) != '\\') /* not escaped */
137 MatcherList *matcher_parser_get_cond(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_CONDITION;
150 matcher_parserrestart(NULL);
151 matcher_parser_init();
152 bufstate = matcher_parser_scan_string(str);
153 matcher_parserparse();
154 matcher_parse_op = MATCHER_PARSE_NONE;
155 matcher_parser_delete_buffer(bufstate);
159 GSList *matcher_parser_get_action_list(gchar *str)
163 if (!check_quote_symetry(str)) {
168 /* bad coding to enable the sub-grammar matching
170 matcher_parserlineno = 1;
171 matcher_parse_op = MATCHER_PARSE_FILTERING_OR_SCORING;
172 matcher_parserrestart(NULL);
173 matcher_parser_init();
174 bufstate = matcher_parser_scan_string(str);
175 matcher_parserparse();
176 matcher_parse_op = MATCHER_PARSE_NONE;
177 matcher_parser_delete_buffer(bufstate);
181 MatcherProp *matcher_parser_get_prop(gchar *str)
186 matcher_parserlineno = 1;
187 list = matcher_parser_get_cond(str);
191 if (list->matchers == NULL)
194 if (list->matchers->next != NULL)
197 prop = list->matchers->data;
199 g_slist_free(list->matchers);
205 void matcher_parsererror(char *str)
210 for (l = matchers_list; l != NULL; l = g_slist_next(l)) {
211 matcherprop_free((MatcherProp *)
215 g_slist_free(matchers_list);
216 matchers_list = NULL;
219 g_warning("scoring / filtering parsing: %i: %s\n",
220 matcher_parserlineno, str);
224 int matcher_parserwrap(void)
235 %token MATCHER_ALL MATCHER_UNREAD MATCHER_NOT_UNREAD
236 %token MATCHER_NEW MATCHER_NOT_NEW MATCHER_MARKED
237 %token MATCHER_NOT_MARKED MATCHER_DELETED MATCHER_NOT_DELETED
238 %token MATCHER_REPLIED MATCHER_NOT_REPLIED MATCHER_FORWARDED
239 %token MATCHER_NOT_FORWARDED MATCHER_SUBJECT MATCHER_NOT_SUBJECT
240 %token MATCHER_FROM MATCHER_NOT_FROM MATCHER_TO MATCHER_NOT_TO
241 %token MATCHER_CC MATCHER_NOT_CC MATCHER_TO_OR_CC MATCHER_NOT_TO_AND_NOT_CC
242 %token MATCHER_AGE_GREATER MATCHER_AGE_LOWER MATCHER_NEWSGROUPS
243 %token MATCHER_NOT_NEWSGROUPS MATCHER_INREPLYTO MATCHER_NOT_INREPLYTO
244 %token MATCHER_REFERENCES MATCHER_NOT_REFERENCES MATCHER_SCORE_GREATER
245 %token MATCHER_SCORE_LOWER MATCHER_HEADER MATCHER_NOT_HEADER
246 %token MATCHER_HEADERS_PART MATCHER_NOT_HEADERS_PART MATCHER_MESSAGE
247 %token MATCHER_NOT_MESSAGE MATCHER_BODY_PART MATCHER_NOT_BODY_PART
248 %token MATCHER_TEST MATCHER_NOT_TEST MATCHER_MATCHCASE MATCHER_MATCH
249 %token MATCHER_REGEXPCASE MATCHER_REGEXP MATCHER_SCORE MATCHER_MOVE
250 %token MATCHER_COPY MATCHER_DELETE MATCHER_MARK MATCHER_UNMARK MATCHER_LOCK MATCHER_UNLOCK
251 %token MATCHER_EXECUTE
252 %token MATCHER_MARK_AS_READ MATCHER_MARK_AS_UNREAD MATCHER_FORWARD
253 %token MATCHER_FORWARD_AS_ATTACHMENT MATCHER_EOL MATCHER_STRING
254 %token MATCHER_OR MATCHER_AND
255 %token MATCHER_COLOR MATCHER_SCORE_EQUAL MATCHER_REDIRECT
256 %token MATCHER_SIZE_GREATER MATCHER_SIZE_SMALLER MATCHER_SIZE_EQUAL
257 %token MATCHER_LOCKED MATCHER_NOT_LOCKED
258 %token MATCHER_COLORLABEL MATCHER_NOT_COLORLABEL
259 %token MATCHER_IGNORE_THREAD MATCHER_NOT_IGNORE_THREAD
260 %token MATCHER_ADD_SCORE MATCHER_SET_SCORE
265 %token <str> MATCHER_STRING
266 %token <str> MATCHER_SECTION
267 %token <str> MATCHER_INTEGER
273 if (matcher_parse_op == MATCHER_PARSE_NONE) {
274 prefs_scoring = &global_scoring;
275 prefs_filtering = &global_processing;
289 { action_list = NULL; }
296 section_notification:
297 MATCHER_SECTION MATCHER_EOL
300 FolderItem *item = NULL;
302 if (matcher_parse_op == MATCHER_PARSE_NONE) {
303 if (!strcmp(folder, "global")) {
304 prefs_scoring = &global_scoring;
305 prefs_filtering = &global_processing;
307 item = folder_find_item_from_identifier(folder);
309 prefs_scoring = &item->prefs->scoring;
310 prefs_filtering = &item->prefs->processing;
312 prefs_scoring = NULL;
313 prefs_filtering = NULL;
321 condition filtering_or_scoring MATCHER_EOL
322 | condition filtering_or_scoring
324 if (matcher_parse_op == MATCHER_PARSE_NO_EOL)
327 matcher_parsererror("parse error");
333 if (matcher_parse_op == MATCHER_PARSE_CONDITION)
336 matcher_parsererror("parse error");
340 | filtering_action_list
342 if (matcher_parse_op == MATCHER_PARSE_FILTERING_OR_SCORING)
345 matcher_parsererror("parse error");
352 filtering_or_scoring:
353 filtering_action_list
355 filtering = filteringprop_new(cond, action_list);
358 if ((matcher_parse_op == MATCHER_PARSE_NONE) && (prefs_filtering != NULL)) {
359 *prefs_filtering = g_slist_append(*prefs_filtering,
366 scoring = scoringprop_new(cond, score);
369 if ((matcher_parse_op == MATCHER_PARSE_NONE)
370 && (prefs_scoring != NULL)) {
371 *prefs_scoring = g_slist_append(*prefs_scoring, scoring);
377 filtering_action_list:
378 filtering_action_b filtering_action_list
385 action_list = g_slist_append(action_list, action);
393 match_type = MATCHTYPE_MATCHCASE;
397 match_type = MATCHTYPE_MATCH;
401 match_type = MATCHTYPE_REGEXPCASE;
405 match_type = MATCHTYPE_REGEXP;
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_unquote_new(criteria, NULL, 0, NULL, 0);
452 criteria = MATCHCRITERIA_UNREAD;
453 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
459 criteria = MATCHCRITERIA_NOT_UNREAD;
460 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
466 criteria = MATCHCRITERIA_NEW;
467 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
473 criteria = MATCHCRITERIA_NOT_NEW;
474 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
480 criteria = MATCHCRITERIA_MARKED;
481 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
487 criteria = MATCHCRITERIA_NOT_MARKED;
488 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
494 criteria = MATCHCRITERIA_DELETED;
495 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
497 | MATCHER_NOT_DELETED
501 criteria = MATCHCRITERIA_NOT_DELETED;
502 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
508 criteria = MATCHCRITERIA_REPLIED;
509 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
511 | MATCHER_NOT_REPLIED
515 criteria = MATCHCRITERIA_NOT_REPLIED;
516 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
522 criteria = MATCHCRITERIA_FORWARDED;
523 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
525 | MATCHER_NOT_FORWARDED
529 criteria = MATCHCRITERIA_NOT_FORWARDED;
530 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
536 criteria = MATCHCRITERIA_LOCKED;
537 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
543 criteria = MATCHCRITERIA_NOT_LOCKED;
544 prop = matcherprop_unquote_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_unquote_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_unquote_new(criteria, NULL, 0, NULL, value);
568 | MATCHER_IGNORE_THREAD
572 criteria = MATCHCRITERIA_IGNORE_THREAD;
573 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
575 | MATCHER_NOT_IGNORE_THREAD
579 criteria = MATCHCRITERIA_NOT_IGNORE_THREAD;
580 prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, 0);
582 | MATCHER_SUBJECT match_type MATCHER_STRING
587 criteria = MATCHCRITERIA_SUBJECT;
589 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
591 | MATCHER_NOT_SUBJECT match_type MATCHER_STRING
596 criteria = MATCHCRITERIA_NOT_SUBJECT;
598 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
600 | MATCHER_FROM match_type MATCHER_STRING
605 criteria = MATCHCRITERIA_FROM;
607 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
609 | MATCHER_NOT_FROM match_type MATCHER_STRING
614 criteria = MATCHCRITERIA_NOT_FROM;
616 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
618 | MATCHER_TO match_type MATCHER_STRING
623 criteria = MATCHCRITERIA_TO;
625 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
627 | MATCHER_NOT_TO match_type MATCHER_STRING
632 criteria = MATCHCRITERIA_NOT_TO;
634 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
636 | MATCHER_CC match_type MATCHER_STRING
641 criteria = MATCHCRITERIA_CC;
643 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
645 | MATCHER_NOT_CC match_type MATCHER_STRING
650 criteria = MATCHCRITERIA_NOT_CC;
652 prop = matcherprop_unquote_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_unquote_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_unquote_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_unquote_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_unquote_new(criteria, NULL, 0, NULL, value);
690 | MATCHER_NEWSGROUPS match_type MATCHER_STRING
695 criteria = MATCHCRITERIA_NEWSGROUPS;
697 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
699 | MATCHER_NOT_NEWSGROUPS match_type MATCHER_STRING
704 criteria = MATCHCRITERIA_NOT_NEWSGROUPS;
706 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
708 | MATCHER_INREPLYTO match_type MATCHER_STRING
713 criteria = MATCHCRITERIA_INREPLYTO;
715 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
717 | MATCHER_NOT_INREPLYTO match_type MATCHER_STRING
722 criteria = MATCHCRITERIA_NOT_INREPLYTO;
724 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
726 | MATCHER_REFERENCES match_type MATCHER_STRING
731 criteria = MATCHCRITERIA_REFERENCES;
733 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
735 | MATCHER_NOT_REFERENCES match_type MATCHER_STRING
740 criteria = MATCHCRITERIA_NOT_REFERENCES;
742 prop = matcherprop_unquote_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_unquote_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_unquote_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_unquote_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_unquote_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_unquote_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_unquote_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_unquote_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_unquote_new(criteria, header, match_type, expr, 0);
821 | MATCHER_HEADERS_PART match_type MATCHER_STRING
826 criteria = MATCHCRITERIA_HEADERS_PART;
828 prop = matcherprop_unquote_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_unquote_new(criteria, NULL, match_type, expr, 0);
839 | MATCHER_MESSAGE match_type MATCHER_STRING
844 criteria = MATCHCRITERIA_MESSAGE;
846 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
848 | MATCHER_NOT_MESSAGE match_type MATCHER_STRING
853 criteria = MATCHCRITERIA_NOT_MESSAGE;
855 prop = matcherprop_unquote_new(criteria, NULL, match_type, expr, 0);
857 | MATCHER_BODY_PART match_type MATCHER_STRING
862 criteria = MATCHCRITERIA_BODY_PART;
864 prop = matcherprop_unquote_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_unquote_new(criteria, NULL, match_type, expr, 0);
875 | MATCHER_TEST MATCHER_STRING
880 criteria = MATCHCRITERIA_TEST;
882 prop = matcherprop_unquote_new(criteria, NULL, 0, expr, 0);
884 | MATCHER_NOT_TEST MATCHER_STRING
889 criteria = MATCHCRITERIA_NOT_TEST;
891 prop = matcherprop_unquote_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_ADD_SCORE MATCHER_INTEGER
1019 gint action_type = MATCHACTION_ADD_SCORE;
1022 score = strtol($2, NULL, 10);
1023 action = filteringaction_new(MATCHACTION_ADD_SCORE, 0,
1026 | MATCHER_SET_SCORE MATCHER_INTEGER
1028 gint action_type = MATCHACTION_SET_SCORE;
1031 score = strtol($2, NULL, 10);
1032 action = filteringaction_new(MATCHACTION_SET_SCORE, 0,
1037 action = filteringaction_new(MATCHACTION_STOP, 0, NULL, 0, 0);
1042 MATCHER_SCORE MATCHER_INTEGER
1044 score = strtol($2, NULL, 0);