2007-07-27 [paul] 2.10.0cvs74
[claws.git] / src / matcher_parser_parse.y
index 69184e9aac72a7395dfea2b0066e8f4dd13b4f3d..c06bcdd175bad9075c865b004469f3242e48787e 100644 (file)
@@ -5,7 +5,7 @@
  *
  * 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
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -14,8 +14,8 @@
  * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #include "defs.h"
@@ -332,9 +332,13 @@ int matcher_parserwrap(void)
 %token MATCHER_PARTIAL MATCHER_NOT_PARTIAL
 %token MATCHER_COLORLABEL MATCHER_NOT_COLORLABEL
 %token MATCHER_IGNORE_THREAD MATCHER_NOT_IGNORE_THREAD
+%token MATCHER_WATCH_THREAD MATCHER_NOT_WATCH_THREAD
 %token MATCHER_CHANGE_SCORE MATCHER_SET_SCORE
-%token MATCHER_STOP MATCHER_HIDE MATCHER_IGNORE
+%token MATCHER_ADD_TO_ADDRESSBOOK
+%token MATCHER_STOP MATCHER_HIDE MATCHER_IGNORE MATCHER_WATCH
 %token MATCHER_SPAM MATCHER_NOT_SPAM
+%token MATCHER_TAG MATCHER_NOT_TAG MATCHER_SET_TAG MATCHER_UNSET_TAG
+%token MATCHER_TAGGED MATCHER_NOT_TAGGED MATCHER_CLEAR_TAGS
 
 %start file
 
@@ -757,6 +761,20 @@ MATCHER_ALL
        criteria = MATCHCRITERIA_NOT_IGNORE_THREAD;
        prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
 }
+| MATCHER_WATCH_THREAD
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_WATCH_THREAD;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+}
+| MATCHER_NOT_WATCH_THREAD
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NOT_WATCH_THREAD;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+}
 | MATCHER_SUBJECT match_type MATCHER_STRING
 {
        gint criteria = 0;
@@ -847,6 +865,38 @@ MATCHER_ALL
        expr = $3;
        prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
 }
+| MATCHER_TAG match_type MATCHER_STRING
+{
+       gint criteria = 0;
+       gchar *expr = NULL;
+
+       criteria = MATCHCRITERIA_TAG;
+       expr = $3;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+}
+| MATCHER_NOT_TAG match_type MATCHER_STRING
+{
+       gint criteria = 0;
+       gchar *expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_TAG;
+       expr = $3;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+}
+| MATCHER_TAGGED
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_TAGGED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+}
+| MATCHER_NOT_TAGGED
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NOT_TAGGED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+}
 | MATCHER_AGE_GREATER MATCHER_INTEGER
 {
        gint criteria = 0;
@@ -1104,7 +1154,7 @@ MATCHER_EXECUTE MATCHER_STRING
 
        action_type = MATCHACTION_EXECUTE;
        cmd = $2;
-       action = filteringaction_new(action_type, 0, cmd, 0, 0);
+       action = filteringaction_new(action_type, 0, cmd, 0, 0, NULL);
 }
 | MATCHER_MOVE MATCHER_STRING
 {
@@ -1113,7 +1163,32 @@ MATCHER_EXECUTE MATCHER_STRING
 
        action_type = MATCHACTION_MOVE;
        destination = $2;
-       action = filteringaction_new(action_type, 0, destination, 0, 0);
+       action = filteringaction_new(action_type, 0, destination, 0, 0, NULL);
+}
+| MATCHER_SET_TAG MATCHER_STRING
+{
+       gchar *destination = NULL;
+       gint action_type = 0;
+
+       action_type = MATCHACTION_SET_TAG;
+       destination = $2;
+       action = filteringaction_new(action_type, 0, destination, 0, 0, NULL);
+}
+| MATCHER_UNSET_TAG MATCHER_STRING
+{
+       gchar *destination = NULL;
+       gint action_type = 0;
+
+       action_type = MATCHACTION_UNSET_TAG;
+       destination = $2;
+       action = filteringaction_new(action_type, 0, destination, 0, 0, NULL);
+}
+| MATCHER_CLEAR_TAGS
+{
+       gint action_type = 0;
+
+       action_type = MATCHACTION_CLEAR_TAGS;
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_COPY MATCHER_STRING
 {
@@ -1122,70 +1197,70 @@ MATCHER_EXECUTE MATCHER_STRING
 
        action_type = MATCHACTION_COPY;
        destination = $2;
-       action = filteringaction_new(action_type, 0, destination, 0, 0);
+       action = filteringaction_new(action_type, 0, destination, 0, 0, NULL);
 }
 | MATCHER_DELETE
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_DELETE;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_MARK
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_MARK;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_UNMARK
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_UNMARK;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_LOCK
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_LOCK;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_UNLOCK
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_UNLOCK;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_MARK_AS_READ
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_MARK_AS_READ;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_MARK_AS_UNREAD
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_MARK_AS_UNREAD;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_MARK_AS_SPAM
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_MARK_AS_SPAM;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_MARK_AS_HAM
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_MARK_AS_HAM;
-       action = filteringaction_new(action_type, 0, NULL, 0, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_FORWARD MATCHER_INTEGER MATCHER_STRING
 {
@@ -1197,7 +1272,7 @@ MATCHER_EXECUTE MATCHER_STRING
        account_id = strtol($2, NULL, 10);
        destination = $3;
        action = filteringaction_new(action_type,
-            account_id, destination, 0, 0);
+            account_id, destination, 0, 0, NULL);
 }
 | MATCHER_FORWARD_AS_ATTACHMENT MATCHER_INTEGER MATCHER_STRING
 {
@@ -1209,7 +1284,7 @@ MATCHER_EXECUTE MATCHER_STRING
        account_id = strtol($2, NULL, 10);
        destination = $3;
        action = filteringaction_new(action_type,
-            account_id, destination, 0, 0);
+            account_id, destination, 0, 0, NULL);
 }
 | MATCHER_REDIRECT MATCHER_INTEGER MATCHER_STRING
 {
@@ -1221,7 +1296,7 @@ MATCHER_EXECUTE MATCHER_STRING
        account_id = strtol($2, NULL, 10);
        destination = $3;
        action = filteringaction_new(action_type,
-            account_id, destination, 0, 0);
+            account_id, destination, 0, 0, NULL);
 }
 | MATCHER_COLOR MATCHER_INTEGER
 {
@@ -1230,7 +1305,7 @@ MATCHER_EXECUTE MATCHER_STRING
 
        action_type = MATCHACTION_COLOR;
        color = strtol($2, NULL, 10);
-       action = filteringaction_new(action_type, 0, NULL, color, 0);
+       action = filteringaction_new(action_type, 0, NULL, color, 0, NULL);
 }
 | MATCHER_CHANGE_SCORE MATCHER_INTEGER
 {
@@ -1238,7 +1313,7 @@ MATCHER_EXECUTE MATCHER_STRING
         
         score = strtol($2, NULL, 10);
        action = filteringaction_new(MATCHACTION_CHANGE_SCORE, 0,
-                                    NULL, 0, score);
+                                    NULL, 0, score, NULL);
 }
 /* backward compatibility */
 | MATCHER_SCORE MATCHER_INTEGER
@@ -1247,7 +1322,7 @@ MATCHER_EXECUTE MATCHER_STRING
         
         score = strtol($2, NULL, 10);
        action = filteringaction_new(MATCHACTION_CHANGE_SCORE, 0,
-                                    NULL, 0, score);
+                                    NULL, 0, score, NULL);
 }
 | MATCHER_SET_SCORE MATCHER_INTEGER
 {
@@ -1255,18 +1330,31 @@ MATCHER_EXECUTE MATCHER_STRING
         
         score = strtol($2, NULL, 10);
        action = filteringaction_new(MATCHACTION_SET_SCORE, 0,
-                                    NULL, 0, score);
+                                    NULL, 0, score, NULL);
 }
 | MATCHER_HIDE
 {
-       action = filteringaction_new(MATCHACTION_HIDE, 0, NULL, 0, 0);
+       action = filteringaction_new(MATCHACTION_HIDE, 0, NULL, 0, 0, NULL);
 }
 | MATCHER_IGNORE
 {
-       action = filteringaction_new(MATCHACTION_IGNORE, 0, NULL, 0, 0);
+       action = filteringaction_new(MATCHACTION_IGNORE, 0, NULL, 0, 0, NULL);
+}
+| MATCHER_ADD_TO_ADDRESSBOOK MATCHER_STRING
+{
+       header = g_strdup($2);
+} MATCHER_STRING
+{
+       gchar *addressbook = NULL;
+       gint action_type = 0;
+
+       action_type = MATCHACTION_ADD_TO_ADDRESSBOOK;
+       addressbook = $2;
+       action = filteringaction_new(action_type, 0, addressbook, 0, 0, header);
+       g_free(header);
 }
 | MATCHER_STOP
 {
-       action = filteringaction_new(MATCHACTION_STOP, 0, NULL, 0, 0);
+       action = filteringaction_new(MATCHACTION_STOP, 0, NULL, 0, 0, NULL);
 }
 ;