revise label colouring, add filter action for label colouring, fix filtering issues
[claws.git] / src / prefs_matcher.c
index 62e94149c3ff0db1c91f47a349c7041c23226688..df2a165d10b97f4092c2eb42a359f44242bc00db 100644 (file)
@@ -70,6 +70,8 @@ static struct Matcher {
        GtkWidget *case_chkbtn;
        GtkWidget *regexp_chkbtn;
 
        GtkWidget *case_chkbtn;
        GtkWidget *regexp_chkbtn;
 
+       GtkWidget *exec_btn;
+
        GtkWidget *cond_clist;
 } matcher;
 
        GtkWidget *cond_clist;
 } matcher;
 
@@ -84,19 +86,26 @@ enum {
        CRITERIA_CC = 4,
        CRITERIA_TO_OR_CC = 5,
        CRITERIA_NEWSGROUPS = 6,
        CRITERIA_CC = 4,
        CRITERIA_TO_OR_CC = 5,
        CRITERIA_NEWSGROUPS = 6,
-       CRITERIA_AGE_GREATER = 7,
-       CRITERIA_AGE_LOWER = 8,
-       CRITERIA_HEADER = 9,
-       CRITERIA_HEADERS_PART = 10,
-       CRITERIA_BODY_PART = 11,
-       CRITERIA_MESSAGE = 12,
-
-       CRITERIA_UNREAD = 13,
-       CRITERIA_NEW = 14,
-       CRITERIA_MARKED = 15,
-       CRITERIA_DELETED = 16,
-       CRITERIA_REPLIED = 17,
-       CRITERIA_FORWARDED = 18
+       CRITERIA_INREPLYTO = 7,
+       CRITERIA_REFERENCES = 8,
+       CRITERIA_AGE_GREATER = 9,
+       CRITERIA_AGE_LOWER = 10,
+       CRITERIA_HEADER = 11,
+       CRITERIA_HEADERS_PART = 12,
+       CRITERIA_BODY_PART = 13,
+       CRITERIA_MESSAGE = 14,
+
+       CRITERIA_UNREAD = 15,
+       CRITERIA_NEW = 16,
+       CRITERIA_MARKED = 17,
+       CRITERIA_DELETED = 18,
+       CRITERIA_REPLIED = 19,
+       CRITERIA_FORWARDED = 20,
+
+       CRITERIA_SCORE_GREATER = 21,
+       CRITERIA_SCORE_LOWER = 22,
+
+       CRITERIA_EXECUTE = 23
 };
 
 enum {
 };
 
 enum {
@@ -123,22 +132,24 @@ enum {
 };
 
 gchar * predicate_flag_text [] = {
 };
 
 gchar * predicate_flag_text [] = {
-       "flag enabled", "flag disabled"
+       "yes", "no"
 };
 
 gchar * criteria_text [] = {
        "All messages", "Subject",
        "From", "To", "Cc", "To or Cc",
 };
 
 gchar * criteria_text [] = {
        "All messages", "Subject",
        "From", "To", "Cc", "To or Cc",
-       "Newsgroups",
+       "Newsgroups", "In reply to", "References",
        "Age greater than", "Age lower than",
        "Header", "Headers part",
        "Body part", "Whole message",
        "Unread flag", "New flag",
        "Marked flag", "Deleted flag",
        "Age greater than", "Age lower than",
        "Header", "Headers part",
        "Body part", "Whole message",
        "Unread flag", "New flag",
        "Marked flag", "Deleted flag",
-       "Replied flag", "Forwarded flag"
+       "Replied flag", "Forwarded flag",
+       "Score greater than", "Score lower than",
+       "Execute"
 };
 
 };
 
-gint get_sel_from_list(GtkList * list)
+static gint get_sel_from_list(GtkList * list)
 {
        gint row = 0;
        void * sel;
 {
        gint row = 0;
        void * sel;
@@ -198,6 +209,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                                          GtkWidget *widget,
                                          gpointer user_data);
 static MatcherList * prefs_matcher_get_list(void);
                                          GtkWidget *widget,
                                          gpointer user_data);
 static MatcherList * prefs_matcher_get_list(void);
+static void prefs_matcher_exec_info_create(void);
 
 void prefs_matcher_open(MatcherList * matchers, PrefsMatcherSignal * cb)
 {
 
 void prefs_matcher_open(MatcherList * matchers, PrefsMatcherSignal * cb)
 {
@@ -267,6 +279,8 @@ static void prefs_matcher_create(void)
        GtkWidget *up_btn;
        GtkWidget *down_btn;
 
        GtkWidget *up_btn;
        GtkWidget *down_btn;
 
+       GtkWidget *exec_btn;
+
        GList *combo_items;
        gint i;
 
        GList *combo_items;
        gint i;
 
@@ -310,7 +324,7 @@ static void prefs_matcher_create(void)
        gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
 
        gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
 
-       table1 = gtk_table_new (2, 3, FALSE);
+       table1 = gtk_table_new (2, 4, FALSE);
        gtk_widget_show (table1);
 
        gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, FALSE, 0);
        gtk_widget_show (table1);
 
        gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, FALSE, 0);
@@ -385,6 +399,13 @@ static void prefs_matcher_create(void)
        gtk_table_attach (GTK_TABLE (table1), value_entry, 2, 3, 1, 2,
                          GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);
 
        gtk_table_attach (GTK_TABLE (table1), value_entry, 2, 3, 1, 2,
                          GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);
 
+       exec_btn = gtk_button_new_with_label (_("Info ..."));
+       gtk_widget_show (exec_btn);
+       gtk_table_attach (GTK_TABLE (table1), exec_btn, 3, 4, 1, 2,
+                         GTK_FILL | GTK_SHRINK | GTK_EXPAND, 0, 0, 0);
+       gtk_signal_connect (GTK_OBJECT (exec_btn), "clicked",
+                           GTK_SIGNAL_FUNC (prefs_matcher_exec_info),
+                           NULL);
 
        /* predicate */
 
 
        /* predicate */
 
@@ -574,6 +595,7 @@ static void prefs_matcher_create(void)
        matcher.case_chkbtn = case_chkbtn;
        matcher.regexp_chkbtn = regexp_chkbtn;
        matcher.bool_op_list = bool_op_list;
        matcher.case_chkbtn = case_chkbtn;
        matcher.regexp_chkbtn = regexp_chkbtn;
        matcher.bool_op_list = bool_op_list;
+       matcher.exec_btn = exec_btn;
 
        matcher.cond_clist   = cond_clist;
 }
 
        matcher.cond_clist   = cond_clist;
 }
@@ -608,11 +630,17 @@ static void prefs_matcher_reset_condition(void)
        gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), "");
 }
 
        gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), "");
 }
 
+static void prefs_matcher_update_hscrollbar(void)
+{
+       gint optwidth = gtk_clist_optimal_column_width(GTK_CLIST(matcher.cond_clist), 0);
+       gtk_clist_set_column_width(GTK_CLIST(matcher.cond_clist), 0, optwidth);
+}
+
 static void prefs_matcher_set_dialog(MatcherList * matchers)
 {
        GtkCList *clist = GTK_CLIST(matcher.cond_clist);
        GSList * cur;
 static void prefs_matcher_set_dialog(MatcherList * matchers)
 {
        GtkCList *clist = GTK_CLIST(matcher.cond_clist);
        GSList * cur;
-       gboolean bool_op = 0;
+       gboolean bool_op = 1;
 
        gtk_clist_freeze(clist);
        gtk_clist_clear(clist);
 
        gtk_clist_freeze(clist);
        gtk_clist_clear(clist);
@@ -628,6 +656,8 @@ static void prefs_matcher_set_dialog(MatcherList * matchers)
 
                bool_op = matchers->bool_and;
        }
 
                bool_op = matchers->bool_and;
        }
+       
+       prefs_matcher_update_hscrollbar();
 
        gtk_clist_thaw(clist);
 
 
        gtk_clist_thaw(clist);
 
@@ -670,6 +700,84 @@ static MatcherList * prefs_matcher_get_list(void)
        return matchers;
 }
 
        return matchers;
 }
 
+static gint prefs_matcher_get_criteria_from_matching(gint matching_id)
+{
+       switch(matching_id) {
+       case MATCHING_ALL:
+               return CRITERIA_ALL;
+       case MATCHING_NOT_UNREAD:
+       case MATCHING_UNREAD:
+               return CRITERIA_UNREAD;
+       case MATCHING_NOT_NEW:
+       case MATCHING_NEW:
+               return CRITERIA_NEW;
+       case MATCHING_NOT_MARKED:
+       case MATCHING_MARKED:
+               return CRITERIA_MARKED;
+       case MATCHING_NOT_DELETED:
+       case MATCHING_DELETED:
+               return CRITERIA_DELETED;
+               break;
+       case MATCHING_NOT_REPLIED:
+       case MATCHING_REPLIED:
+               return CRITERIA_REPLIED;
+       case MATCHING_NOT_FORWARDED:
+       case MATCHING_FORWARDED:
+               return CRITERIA_FORWARDED;
+       case MATCHING_NOT_SUBJECT:
+       case MATCHING_SUBJECT:
+               return CRITERIA_SUBJECT;
+       case MATCHING_NOT_FROM:
+       case MATCHING_FROM:
+               return CRITERIA_FROM;
+       case MATCHING_NOT_TO:
+       case MATCHING_TO:
+               return CRITERIA_TO;
+       case MATCHING_NOT_CC:
+       case MATCHING_CC:
+               return CRITERIA_CC;
+       case MATCHING_NOT_NEWSGROUPS:
+       case MATCHING_NEWSGROUPS:
+               return CRITERIA_NEWSGROUPS;
+       case MATCHING_NOT_INREPLYTO:
+       case MATCHING_INREPLYTO:
+               return CRITERIA_INREPLYTO;
+       case MATCHING_NOT_REFERENCES:
+       case MATCHING_REFERENCES:
+               return CRITERIA_REFERENCES;
+       case MATCHING_NOT_TO_AND_NOT_CC:
+       case MATCHING_TO_OR_CC:
+               return CRITERIA_TO_OR_CC;
+       case MATCHING_NOT_BODY_PART:
+       case MATCHING_BODY_PART:
+               return CRITERIA_BODY_PART;
+       case MATCHING_NOT_MESSAGE:
+       case MATCHING_MESSAGE:
+               return CRITERIA_MESSAGE;
+               break;
+       case MATCHING_NOT_HEADERS_PART:
+       case MATCHING_HEADERS_PART:
+               return CRITERIA_HEADERS_PART;
+       case MATCHING_NOT_HEADER:
+       case MATCHING_HEADER:
+               return CRITERIA_HEADER;
+       case MATCHING_AGE_GREATER:
+               return CRITERIA_AGE_GREATER;
+       case MATCHING_AGE_LOWER:
+               return CRITERIA_AGE_LOWER;
+       case MATCHING_SCORE_GREATER:
+               return CRITERIA_SCORE_GREATER;
+       case MATCHING_SCORE_LOWER:
+               return CRITERIA_SCORE_LOWER;
+       case MATCHING_NOT_EXECUTE:
+       case MATCHING_EXECUTE:
+               return CRITERIA_EXECUTE;
+               break;
+       default:
+               return -1;
+       }
+}
+
 static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
 {
        switch (criteria_id) {
 static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
 {
        switch (criteria_id) {
@@ -699,10 +807,18 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
                return MATCHING_TO_OR_CC;
        case CRITERIA_NEWSGROUPS:
                return MATCHING_NEWSGROUPS;
                return MATCHING_TO_OR_CC;
        case CRITERIA_NEWSGROUPS:
                return MATCHING_NEWSGROUPS;
+       case CRITERIA_INREPLYTO:
+               return MATCHING_INREPLYTO;
+       case CRITERIA_REFERENCES:
+               return MATCHING_REFERENCES;
        case CRITERIA_AGE_GREATER:
                return MATCHING_AGE_GREATER;
        case CRITERIA_AGE_LOWER:
                return MATCHING_AGE_LOWER;
        case CRITERIA_AGE_GREATER:
                return MATCHING_AGE_GREATER;
        case CRITERIA_AGE_LOWER:
                return MATCHING_AGE_LOWER;
+       case CRITERIA_SCORE_GREATER:
+               return MATCHING_SCORE_GREATER;
+       case CRITERIA_SCORE_LOWER:
+               return MATCHING_SCORE_LOWER;
        case CRITERIA_HEADER:
                return MATCHING_HEADER;
        case CRITERIA_HEADERS_PART:
        case CRITERIA_HEADER:
                return MATCHING_HEADER;
        case CRITERIA_HEADERS_PART:
@@ -711,6 +827,8 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
                return MATCHING_BODY_PART;
        case CRITERIA_MESSAGE:
                return MATCHING_MESSAGE;
                return MATCHING_BODY_PART;
        case CRITERIA_MESSAGE:
                return MATCHING_MESSAGE;
+       case CRITERIA_EXECUTE:
+               return MATCHING_EXECUTE;
        default:
                return -1;
        }
        default:
                return -1;
        }
@@ -743,12 +861,18 @@ static gint prefs_matcher_not_criteria(gint matcher_criteria)
                return MATCHING_NOT_TO_AND_NOT_CC;
        case MATCHING_NEWSGROUPS:
                return MATCHING_NOT_NEWSGROUPS;
                return MATCHING_NOT_TO_AND_NOT_CC;
        case MATCHING_NEWSGROUPS:
                return MATCHING_NOT_NEWSGROUPS;
+       case MATCHING_INREPLYTO:
+               return MATCHING_NOT_INREPLYTO;
+       case MATCHING_REFERENCES:
+               return MATCHING_NOT_REFERENCES;
        case MATCHING_HEADER:
                return MATCHING_NOT_HEADER;
        case MATCHING_HEADERS_PART:
                return MATCHING_NOT_HEADERS_PART;
        case MATCHING_MESSAGE:
                return MATCHING_NOT_MESSAGE;
        case MATCHING_HEADER:
                return MATCHING_NOT_HEADER;
        case MATCHING_HEADERS_PART:
                return MATCHING_NOT_HEADERS_PART;
        case MATCHING_MESSAGE:
                return MATCHING_NOT_MESSAGE;
+       case MATCHING_EXECUTE:
+               return MATCHING_NOT_EXECUTE;
        case MATCHING_BODY_PART:
                return MATCHING_NOT_BODY_PART;
        default:
        case MATCHING_BODY_PART:
                return MATCHING_NOT_BODY_PART;
        default:
@@ -768,8 +892,8 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
        gboolean case_sensitive;
        gchar * header;
        gchar * expr;
        gboolean case_sensitive;
        gchar * header;
        gchar * expr;
-       gint age;
-       gchar * age_str;
+       gint value;
+       gchar * value_str;
 
        value_criteria = get_sel_from_list(GTK_LIST(matcher.criteria_list));
 
 
        value_criteria = get_sel_from_list(GTK_LIST(matcher.criteria_list));
 
@@ -797,9 +921,12 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
+       case CRITERIA_INREPLYTO:
+       case CRITERIA_REFERENCES:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
+       case CRITERIA_EXECUTE:
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
        case CRITERIA_HEADER:
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
        case CRITERIA_HEADER:
@@ -823,7 +950,7 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
 
        header = NULL;
        expr = NULL;
 
        header = NULL;
        expr = NULL;
-       age = 0;
+       value = 0;
 
        switch (value_criteria) {
        case CRITERIA_ALL:
 
        switch (value_criteria) {
        case CRITERIA_ALL:
@@ -841,9 +968,12 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
+       case CRITERIA_INREPLYTO:
+       case CRITERIA_REFERENCES:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
+       case CRITERIA_EXECUTE:
                expr = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
 
                /*
                expr = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
 
                /*
@@ -856,14 +986,16 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
 
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
 
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
-               age_str = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
+       case CRITERIA_SCORE_GREATER:
+       case CRITERIA_SCORE_LOWER:
+               value_str = gtk_entry_get_text(GTK_ENTRY(matcher.value_entry));
 
 
-               if (*age_str == '\0') {
-                   alertpanel_error(_("Age is not set."));
+               if (*value_str == '\0') {
+                   alertpanel_error(_("Value is not set."));
                    return NULL;
                }
 
                    return NULL;
                }
 
-               age = atoi(age_str);
+               value = atoi(value_str);
 
                break;
 
 
                break;
 
@@ -885,7 +1017,8 @@ static MatcherProp * prefs_matcher_dialog_to_matcher()
                break;
        }
 
                break;
        }
 
-       matcherprop =  matcherprop_new(criteria, header, matchtype, expr, age);
+       matcherprop =  matcherprop_new(criteria, header, matchtype,
+                                      expr, value);
 
        return matcherprop;
 }
 
        return matcherprop;
 }
@@ -903,6 +1036,7 @@ static void prefs_matcher_register_cb(void)
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_substitute_cb(void)
 }
 
 static void prefs_matcher_substitute_cb(void)
@@ -924,6 +1058,8 @@ static void prefs_matcher_substitute_cb(void)
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
+       
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_delete_cb(void)
 }
 
 static void prefs_matcher_delete_cb(void)
@@ -937,6 +1073,8 @@ static void prefs_matcher_delete_cb(void)
                return;
 
        gtk_clist_remove(clist, row);
                return;
 
        gtk_clist_remove(clist, row);
+       
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_up(void)
 }
 
 static void prefs_matcher_up(void)
@@ -970,6 +1108,7 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        gchar * tmp;
        MatcherProp * prop;
        gboolean negative_cond;
        gchar * tmp;
        MatcherProp * prop;
        gboolean negative_cond;
+       gint criteria;
 
        if (!gtk_clist_get_text(GTK_CLIST(matcher.cond_clist),
                                row, 0, &matcher_str))
 
        if (!gtk_clist_get_text(GTK_CLIST(matcher.cond_clist),
                                row, 0, &matcher_str))
@@ -987,132 +1126,31 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        if (tmp == NULL)
                return;
 
        if (tmp == NULL)
                return;
 
-       switch(prop->criteria) {
-       case MATCHING_ALL:
+       criteria = prefs_matcher_get_criteria_from_matching(prop->criteria);
+       if (criteria != -1)
                gtk_list_select_item(GTK_LIST(matcher.criteria_list),
                gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_ALL);
-               break;
+                                    criteria);
 
 
+       switch(prop->criteria) {
        case MATCHING_NOT_UNREAD:
        case MATCHING_NOT_UNREAD:
-               negative_cond = TRUE;
-       case MATCHING_UNREAD:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_UNREAD);
-               break;
-
        case MATCHING_NOT_NEW:
        case MATCHING_NOT_NEW:
-               negative_cond = TRUE;
-       case MATCHING_NEW:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_NEW);
-               break;
-
        case MATCHING_NOT_MARKED:
        case MATCHING_NOT_MARKED:
-               negative_cond = TRUE;
-       case MATCHING_MARKED:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_MARKED);
-               break;
-
        case MATCHING_NOT_DELETED:
        case MATCHING_NOT_DELETED:
-               negative_cond = TRUE;
-       case MATCHING_DELETED:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_DELETED);
-               break;
-
        case MATCHING_NOT_REPLIED:
        case MATCHING_NOT_REPLIED:
-               negative_cond = TRUE;
-       case MATCHING_REPLIED:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_REPLIED);
-               break;
-
        case MATCHING_NOT_FORWARDED:
        case MATCHING_NOT_FORWARDED:
-               negative_cond = TRUE;
-       case MATCHING_FORWARDED:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_FORWARDED);
-               break;
-
        case MATCHING_NOT_SUBJECT:
        case MATCHING_NOT_SUBJECT:
-               negative_cond = TRUE;
-       case MATCHING_SUBJECT:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_SUBJECT);
-               break;
-
        case MATCHING_NOT_FROM:
        case MATCHING_NOT_FROM:
-               negative_cond = TRUE;
-       case MATCHING_FROM:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_FROM);
-               break;
-
        case MATCHING_NOT_TO:
        case MATCHING_NOT_TO:
-               negative_cond = TRUE;
-       case MATCHING_TO:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_TO);
-               break;
-
        case MATCHING_NOT_CC:
        case MATCHING_NOT_CC:
-               negative_cond = TRUE;
-       case MATCHING_CC:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_CC);
-               break;
-
        case MATCHING_NOT_NEWSGROUPS:
        case MATCHING_NOT_NEWSGROUPS:
-               negative_cond = TRUE;
-       case MATCHING_NEWSGROUPS:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_NEWSGROUPS);
-               break;
-
+       case MATCHING_NOT_INREPLYTO:
+       case MATCHING_NOT_REFERENCES:
        case MATCHING_NOT_TO_AND_NOT_CC:
        case MATCHING_NOT_TO_AND_NOT_CC:
-               negative_cond = TRUE;
-       case MATCHING_TO_OR_CC:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_TO_OR_CC);
-               break;
-
        case MATCHING_NOT_BODY_PART:
        case MATCHING_NOT_BODY_PART:
-               negative_cond = TRUE;
-       case MATCHING_BODY_PART:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_BODY_PART);
-               break;
-
        case MATCHING_NOT_MESSAGE:
        case MATCHING_NOT_MESSAGE:
-               negative_cond = TRUE;
-       case MATCHING_MESSAGE:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_MESSAGE);
-               break;
-
        case MATCHING_NOT_HEADERS_PART:
        case MATCHING_NOT_HEADERS_PART:
-               negative_cond = TRUE;
-       case MATCHING_HEADERS_PART:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_HEADERS_PART);
-               break;
-
        case MATCHING_NOT_HEADER:
                negative_cond = TRUE;
        case MATCHING_NOT_HEADER:
                negative_cond = TRUE;
-       case MATCHING_HEADER:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_HEADER);
-               break;
-
-       case MATCHING_AGE_GREATER:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_AGE_GREATER);
-               break;
-
-       case MATCHING_AGE_LOWER:
-               gtk_list_select_item(GTK_LIST(matcher.criteria_list),
-                                    CRITERIA_AGE_LOWER);
                break;
        }
        
                break;
        }
        
@@ -1126,6 +1164,8 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        case MATCHING_NOT_CC:
        case MATCHING_NOT_TO_AND_NOT_CC:
        case MATCHING_NOT_NEWSGROUPS:
        case MATCHING_NOT_CC:
        case MATCHING_NOT_TO_AND_NOT_CC:
        case MATCHING_NOT_NEWSGROUPS:
+       case MATCHING_NOT_INREPLYTO:
+       case MATCHING_NOT_REFERENCES:
        case MATCHING_NOT_HEADERS_PART:
        case MATCHING_NOT_BODY_PART:
        case MATCHING_NOT_MESSAGE:
        case MATCHING_NOT_HEADERS_PART:
        case MATCHING_NOT_BODY_PART:
        case MATCHING_NOT_MESSAGE:
@@ -1135,6 +1175,8 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
        case MATCHING_CC:
        case MATCHING_TO_OR_CC:
        case MATCHING_NEWSGROUPS:
        case MATCHING_CC:
        case MATCHING_TO_OR_CC:
        case MATCHING_NEWSGROUPS:
+       case MATCHING_INREPLYTO:
+       case MATCHING_REFERENCES:
        case MATCHING_HEADERS_PART:
        case MATCHING_BODY_PART:
        case MATCHING_MESSAGE:
        case MATCHING_HEADERS_PART:
        case MATCHING_BODY_PART:
        case MATCHING_MESSAGE:
@@ -1143,7 +1185,9 @@ static void prefs_matcher_select(GtkCList *clist, gint row, gint column,
 
        case MATCHING_AGE_GREATER:
        case MATCHING_AGE_LOWER:
 
        case MATCHING_AGE_GREATER:
        case MATCHING_AGE_LOWER:
-               gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), itos(prop->age));
+       case MATCHING_SCORE_GREATER:
+       case MATCHING_SCORE_LOWER:
+               gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), itos(prop->value));
                break;
 
        case MATCHING_NOT_HEADER:
                break;
 
        case MATCHING_NOT_HEADER:
@@ -1202,6 +1246,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                gtk_widget_show(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
                gtk_widget_show(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
                break;
 
        case CRITERIA_UNREAD:
                break;
 
        case CRITERIA_UNREAD:
@@ -1221,6 +1266,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                gtk_widget_show(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
                gtk_widget_show(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
                break;
 
        case CRITERIA_SUBJECT:
                break;
 
        case CRITERIA_SUBJECT:
@@ -1229,6 +1275,8 @@ static void prefs_matcher_criteria_select(GtkList *list,
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
        case CRITERIA_CC:
        case CRITERIA_TO_OR_CC:
        case CRITERIA_NEWSGROUPS:
+       case CRITERIA_INREPLYTO:
+       case CRITERIA_REFERENCES:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
        case CRITERIA_HEADERS_PART:
        case CRITERIA_BODY_PART:
        case CRITERIA_MESSAGE:
@@ -1243,10 +1291,28 @@ static void prefs_matcher_criteria_select(GtkList *list,
                gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, TRUE);
                gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, TRUE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
+               break;
+
+       case CRITERIA_EXECUTE:
+               gtk_widget_set_sensitive(matcher.header_combo, FALSE);
+               gtk_widget_set_sensitive(matcher.header_label, FALSE);
+               gtk_widget_set_sensitive(matcher.value_label, TRUE);
+               gtk_widget_set_sensitive(matcher.value_entry, TRUE);
+               gtk_widget_set_sensitive(matcher.predicate_label, TRUE);
+               gtk_widget_set_sensitive(matcher.predicate_combo, FALSE);
+               gtk_widget_set_sensitive(matcher.predicate_flag_combo, TRUE);
+               gtk_widget_hide(matcher.predicate_combo);
+               gtk_widget_show(matcher.predicate_flag_combo);
+               gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.exec_btn, TRUE);
                break;
 
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
                break;
 
        case CRITERIA_AGE_GREATER:
        case CRITERIA_AGE_LOWER:
+       case CRITERIA_SCORE_GREATER:
+       case CRITERIA_SCORE_LOWER:
                gtk_widget_set_sensitive(matcher.header_combo, FALSE);
                gtk_widget_set_sensitive(matcher.header_label, FALSE);
                gtk_widget_set_sensitive(matcher.value_label, TRUE);
                gtk_widget_set_sensitive(matcher.header_combo, FALSE);
                gtk_widget_set_sensitive(matcher.header_label, FALSE);
                gtk_widget_set_sensitive(matcher.value_label, TRUE);
@@ -1258,6 +1324,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
                gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, FALSE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, FALSE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
                break;
 
        case CRITERIA_HEADER:
                break;
 
        case CRITERIA_HEADER:
@@ -1272,6 +1339,7 @@ static void prefs_matcher_criteria_select(GtkList *list,
                gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, TRUE);
                gtk_widget_hide(matcher.predicate_flag_combo);
                gtk_widget_set_sensitive(matcher.case_chkbtn, TRUE);
                gtk_widget_set_sensitive(matcher.regexp_chkbtn, TRUE);
+               gtk_widget_set_sensitive(matcher.exec_btn, FALSE);
                break;
        }
 }
                break;
        }
 }
@@ -1310,3 +1378,89 @@ static gint prefs_matcher_deleted(GtkWidget *widget, GdkEventAny *event,
        prefs_matcher_cancel();
        return TRUE;
 }
        prefs_matcher_cancel();
        return TRUE;
 }
+
+static GtkWidget * exec_info_win;
+
+void prefs_matcher_exec_info(void)
+{
+       if (!exec_info_win)
+               prefs_matcher_exec_info_create();
+
+       gtk_widget_show(exec_info_win);
+       gtk_main();
+       gtk_widget_hide(exec_info_win);
+}
+
+static void prefs_matcher_exec_info_create(void)
+{
+       GtkWidget *vbox;
+       GtkWidget *hbox;
+       GtkWidget *hbbox;
+       GtkWidget *label;
+       GtkWidget *ok_btn;
+
+       exec_info_win = gtk_window_new(GTK_WINDOW_DIALOG);
+       gtk_window_set_title(GTK_WINDOW(exec_info_win),
+                            _("Description of symbols"));
+       gtk_container_set_border_width(GTK_CONTAINER(exec_info_win), 8);
+       gtk_window_set_position(GTK_WINDOW(exec_info_win), GTK_WIN_POS_CENTER);
+       gtk_window_set_modal(GTK_WINDOW(exec_info_win), TRUE);
+       gtk_window_set_policy(GTK_WINDOW(exec_info_win), FALSE, TRUE, FALSE);
+
+       vbox = gtk_vbox_new(FALSE, 8);
+       gtk_container_add(GTK_CONTAINER(exec_info_win), vbox);
+
+       hbox = gtk_hbox_new(FALSE, 4);
+       gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
+
+       label = gtk_label_new
+               ("%%:\n"
+                "%s:\n"
+                "%f:\n"
+                "%t:\n"
+                "%c:\n"
+                "%d:\n"
+                "%i:\n"
+                "%n:\n"
+                "%r:\n"
+                "%F:\n"
+                "\\n:\n"
+                "\\:\n"
+                "\\\":\n"
+                "%%:");
+
+       gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
+       gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+
+       label = gtk_label_new
+               (_("%\n"
+                  "Subject\n"
+                  "From\n"
+                  "To\n"
+                  "Cc\n"
+                  "Date\n"
+                  "Message-ID\n"
+                  "Newsgroups\n"
+                  "References\n"
+                  "Filename - should not be modified\n"
+                  "new line\n"
+                  "escape character for quotes\n"
+                  "quote character\n"
+                  "%"));
+
+       gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
+       gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+
+       gtkut_button_set_create(&hbbox, &ok_btn, _("OK"),
+                               NULL, NULL, NULL, NULL);
+       gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
+
+       gtk_widget_grab_default(ok_btn);
+       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
+                                 GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+
+       gtk_signal_connect(GTK_OBJECT(exec_info_win), "delete_event",
+                                         GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+
+       gtk_widget_show_all(vbox);
+}