added "stop" action / added "set score" and "increase/decrease score" actions
authorHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Sun, 12 Oct 2003 21:04:25 +0000 (21:04 +0000)
committerHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Sun, 12 Oct 2003 21:04:25 +0000 (21:04 +0000)
ChangeLog.claws
configure.ac
src/filtering.c
src/filtering.h
src/matcher.c
src/matcher.h
src/matcher_parser_parse.y
src/prefs_filtering_action.c

index d238b35..a905c21 100644 (file)
@@ -1,3 +1,21 @@
+2003-10-12 [hoa]       0.9.6claws17
+
+       * src/filtering.c
+       * src/filtering.h
+       * src/matcher.c
+       * src/matcher.h
+       * src/matcher_parser_parse.y
+       * src/prefs_filtering_action.c
+               added "stop" action : stop applying the filtering rules.
+               added "set score" and "increase/decrease score" actions.
+               That two last action replace the "change_score" action
+               introduced by alfons in 0.8.8claws85.
+               "set score" is to set a given score to the message.
+               "increase/decrease score" will increase or decrease the
+               score if the given value is respectively positive or
+               negative. If someone find a some better name for this last
+               rule, it can be modified.
+
 2003-10-12 [paul]      0.9.6claws16
 
        * AUTHORS
index fc0e5e4..170d2c4 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=16
+EXTRA_VERSION=17
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 9dbe9b7..9c623b7 100644 (file)
@@ -53,17 +53,12 @@ static inline gint strlen_with_check(const gchar *expr, gint fline, const gchar
 
 FilteringAction * filteringaction_new(int type, int account_id,
                                      gchar * destination,
-                                     gint labelcolor)
+                                     gint labelcolor, gint score)
 {
        FilteringAction * action;
 
        action = g_new0(FilteringAction, 1);
 
-       /* NOTE:
-        * if type is MATCHACTION_CHANGE_SCORE, account_id = (-1, 0, 1) and
-        * labelcolor = the score value change
-        */
-
        action->type = type;
        action->account_id = account_id;
        if (destination) {
@@ -74,6 +69,7 @@ FilteringAction * filteringaction_new(int type, int account_id,
                action->unesc_destination = NULL;
        }
        action->labelcolor = labelcolor;        
+        action->score = score;
        return action;
 }
 
@@ -322,17 +318,17 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                }
                return TRUE;
 
-       case MATCHACTION_CHANGE_SCORE:
-               /* NOTE:
-                * action->account_id is 0 if just assignment, -1 if decrement
-                * and 1 if increment by action->labelcolor 
-                * action->labelcolor has the score value change
-                */
-               info->score = action->account_id ==  1 ? info->score + action->labelcolor
-                           : action->account_id == -1 ? info->score - action->labelcolor
-                           : action->labelcolor; 
+       case MATCHACTION_SET_SCORE:
+               info->score = action->score;
+               return TRUE;
+
+       case MATCHACTION_ADD_SCORE:
+               info->score += action->score;
                return TRUE;
 
+       case MATCHACTION_STOP:
+                break;
+
        default:
                break;
        }
@@ -392,19 +388,8 @@ static gboolean filtering_is_final_action(FilteringAction *filtering_action)
        switch(filtering_action->type) {
        case MATCHACTION_MOVE:
        case MATCHACTION_DELETE:
+       case MATCHACTION_STOP:
                return TRUE; /* MsgInfo invalid for message */
-       case MATCHACTION_EXECUTE:
-       case MATCHACTION_COPY:
-       case MATCHACTION_MARK:
-       case MATCHACTION_UNMARK:
-       case MATCHACTION_LOCK:
-       case MATCHACTION_UNLOCK:
-       case MATCHACTION_MARK_AS_READ:
-       case MATCHACTION_MARK_AS_UNREAD:
-       case MATCHACTION_FORWARD:
-       case MATCHACTION_FORWARD_AS_ATTACHMENT:
-       case MATCHACTION_REDIRECT:
-               return FALSE; /* MsgInfo still valid for message */
        default:
                return FALSE;
        }
@@ -469,6 +454,7 @@ gchar *filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *act
        case MATCHACTION_UNLOCK:
        case MATCHACTION_MARK_AS_READ:
        case MATCHACTION_MARK_AS_UNREAD:
+       case MATCHACTION_STOP:
                g_snprintf(dest, destlen, "%s", command_str);
                return dest;
 
@@ -481,6 +467,12 @@ gchar *filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *act
        case MATCHACTION_COLOR:
                g_snprintf(dest, destlen, "%s %d", command_str, action->labelcolor);
                return dest;  
+
+       case MATCHACTION_ADD_SCORE:
+       case MATCHACTION_SET_SCORE:
+               g_snprintf(dest, destlen, "%s %d", command_str, action->score);
+               return dest;  
+
        default:
                return NULL;
        }
index 2f3ffc8..8f1f0c0 100644 (file)
@@ -31,6 +31,7 @@ struct _FilteringAction {
        gchar  *destination;
        gchar  *unesc_destination;      /* for exec cmd line */
        gint    labelcolor;
+       gint    score;
 };
 
 typedef struct _FilteringAction FilteringAction;
@@ -46,8 +47,8 @@ typedef struct _FilteringProp FilteringProp;
 
 
 FilteringAction * filteringaction_new(int type, int account_id,
-                                     gchar *destination,
-                                     gint labelcolor);
+                                     gchar * destination,
+                                      gint labelcolor, gint score);
 void filteringaction_free(FilteringAction *action);
 FilteringAction * filteringaction_parse(gchar **str);
 gboolean filteringaction_apply_action_list (GSList *action_list, MsgInfo *info);
index 59e21d2..5c1bbc5 100644 (file)
@@ -125,7 +125,9 @@ static const MatchParser matchparser_tab[] = {
        {MATCHACTION_EXECUTE, "execute"},
        {MATCHACTION_COLOR, "color"},
        {MATCHACTION_REDIRECT, "redirect"},
-       {MATCHACTION_CHANGE_SCORE, "change_score"}
+       {MATCHACTION_ADD_SCORE, "add_score"},
+       {MATCHACTION_SET_SCORE, "set_score"},
+       {MATCHACTION_STOP, "stop"},
 };
 
 /*!
index 9c19784..9060fb9 100644 (file)
@@ -119,7 +119,9 @@ enum {
        MA_(FORWARD_AS_ATTACHMENT),
        MA_(COLOR),
        MA_(REDIRECT),
-       MA_(CHANGE_SCORE),
+       MA_(ADD_SCORE),
+       MA_(SET_SCORE),
+       MA_(STOP),
        /* boolean operations */
        MB_(OR),
        MB_(AND)
index 72dbaa2..f598d65 100644 (file)
@@ -257,7 +257,8 @@ int matcher_parserwrap(void)
 %token MATCHER_LOCKED MATCHER_NOT_LOCKED
 %token MATCHER_COLORLABEL MATCHER_NOT_COLORLABEL
 %token MATCHER_IGNORE_THREAD MATCHER_NOT_IGNORE_THREAD
-%token MATCHER_CHANGE_SCORE
+%token MATCHER_ADD_SCORE MATCHER_SET_SCORE
+%token MATCHER_STOP
 
 %start file
 
@@ -548,7 +549,7 @@ MATCHER_ALL
        gint value = 0;
 
        criteria = MATCHCRITERIA_COLORLABEL;
-       value = atoi($2);
+       value = strtol($2, NULL, 10);
        if (value < 1) value = 1;
        else if (value > MAX_COLORLABELS) value = MAX_COLORLABELS;
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
@@ -559,7 +560,7 @@ MATCHER_ALL
        gint value = 0;
 
        criteria = MATCHCRITERIA_NOT_COLORLABEL;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        if (value < 1) value = 1;
        else if (value > MAX_COLORLABELS) value = MAX_COLORLABELS;
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
@@ -674,7 +675,7 @@ MATCHER_ALL
        gint value = 0;
 
        criteria = MATCHCRITERIA_AGE_GREATER;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
 }
 | MATCHER_AGE_LOWER MATCHER_INTEGER
@@ -683,7 +684,7 @@ MATCHER_ALL
        gint value = 0;
 
        criteria = MATCHCRITERIA_AGE_LOWER;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
 }
 | MATCHER_NEWSGROUPS match_type MATCHER_STRING
@@ -746,7 +747,7 @@ MATCHER_ALL
        gint value = 0;
 
        criteria = MATCHCRITERIA_SCORE_GREATER;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
 }
 | MATCHER_SCORE_LOWER MATCHER_INTEGER
@@ -755,7 +756,7 @@ MATCHER_ALL
        gint value = 0;
 
        criteria = MATCHCRITERIA_SCORE_LOWER;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
 }
 | MATCHER_SCORE_EQUAL MATCHER_INTEGER
@@ -764,7 +765,7 @@ MATCHER_ALL
        gint value = 0;
 
        criteria = MATCHCRITERIA_SCORE_EQUAL;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
 }
 | MATCHER_SIZE_GREATER MATCHER_INTEGER 
@@ -772,7 +773,7 @@ MATCHER_ALL
        gint criteria = 0;
        gint value    = 0;
        criteria = MATCHCRITERIA_SIZE_GREATER;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
 }
 | MATCHER_SIZE_SMALLER MATCHER_INTEGER
@@ -780,7 +781,7 @@ MATCHER_ALL
        gint criteria = 0;
        gint value    = 0;
        criteria = MATCHCRITERIA_SIZE_SMALLER;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
 }
 | MATCHER_SIZE_EQUAL MATCHER_INTEGER
@@ -788,7 +789,7 @@ MATCHER_ALL
        gint criteria = 0;
        gint value    = 0;
        criteria = MATCHCRITERIA_SIZE_EQUAL;
-       value = atoi($2);
+       value = strtol($2, NULL, 0);
        prop = matcherprop_unquote_new(criteria, NULL, 0, NULL, value);
 }
 | MATCHER_HEADER MATCHER_STRING
@@ -899,7 +900,7 @@ MATCHER_EXECUTE MATCHER_STRING
 
        action_type = MATCHACTION_EXECUTE;
        cmd = $2;
-       action = filteringaction_new(action_type, 0, cmd, 0);
+       action = filteringaction_new(action_type, 0, cmd, 0, 0);
 }
 | MATCHER_MOVE MATCHER_STRING
 {
@@ -908,7 +909,7 @@ MATCHER_EXECUTE MATCHER_STRING
 
        action_type = MATCHACTION_MOVE;
        destination = $2;
-       action = filteringaction_new(action_type, 0, destination, 0);
+       action = filteringaction_new(action_type, 0, destination, 0, 0);
 }
 | MATCHER_COPY MATCHER_STRING
 {
@@ -917,56 +918,56 @@ MATCHER_EXECUTE MATCHER_STRING
 
        action_type = MATCHACTION_COPY;
        destination = $2;
-       action = filteringaction_new(action_type, 0, destination, 0);
+       action = filteringaction_new(action_type, 0, destination, 0, 0);
 }
 | MATCHER_DELETE
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_DELETE;
-       action = filteringaction_new(action_type, 0, NULL, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0);
 }
 | MATCHER_MARK
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_MARK;
-       action = filteringaction_new(action_type, 0, NULL, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0);
 }
 | MATCHER_UNMARK
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_UNMARK;
-       action = filteringaction_new(action_type, 0, NULL, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0);
 }
 | MATCHER_LOCK
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_LOCK;
-       action = filteringaction_new(action_type, 0, NULL, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0);
 }
 | MATCHER_UNLOCK
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_UNLOCK;
-       action = filteringaction_new(action_type, 0, NULL, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0);
 }
 | MATCHER_MARK_AS_READ
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_MARK_AS_READ;
-       action = filteringaction_new(action_type, 0, NULL, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0);
 }
 | MATCHER_MARK_AS_UNREAD
 {
        gint action_type = 0;
 
        action_type = MATCHACTION_MARK_AS_UNREAD;
-       action = filteringaction_new(action_type, 0, NULL, 0);
+       action = filteringaction_new(action_type, 0, NULL, 0, 0);
 }
 | MATCHER_FORWARD MATCHER_INTEGER MATCHER_STRING
 {
@@ -975,9 +976,10 @@ MATCHER_EXECUTE MATCHER_STRING
        gint account_id = 0;
 
        action_type = MATCHACTION_FORWARD;
-       account_id = atoi($2);
+       account_id = strtol($2, NULL, 10);
        destination = $3;
-       action = filteringaction_new(action_type, account_id, destination, 0);
+       action = filteringaction_new(action_type,
+            account_id, destination, 0, 0);
 }
 | MATCHER_FORWARD_AS_ATTACHMENT MATCHER_INTEGER MATCHER_STRING
 {
@@ -986,9 +988,10 @@ MATCHER_EXECUTE MATCHER_STRING
        gint account_id = 0;
 
        action_type = MATCHACTION_FORWARD_AS_ATTACHMENT;
-       account_id = atoi($2);
+       account_id = strtol($2, NULL, 10);
        destination = $3;
-       action = filteringaction_new(action_type, account_id, destination, 0);
+       action = filteringaction_new(action_type,
+            account_id, destination, 0, 0);
 }
 | MATCHER_REDIRECT MATCHER_INTEGER MATCHER_STRING
 {
@@ -997,9 +1000,10 @@ MATCHER_EXECUTE MATCHER_STRING
        gint account_id = 0;
 
        action_type = MATCHACTION_REDIRECT;
-       account_id = atoi($2);
+       account_id = strtol($2, NULL, 10);
        destination = $3;
-       action = filteringaction_new(action_type, account_id, destination, 0);
+       action = filteringaction_new(action_type,
+            account_id, destination, 0, 0);
 }
 | MATCHER_COLOR MATCHER_INTEGER
 {
@@ -1007,35 +1011,36 @@ MATCHER_EXECUTE MATCHER_STRING
        gint color = 0;
 
        action_type = MATCHACTION_COLOR;
-       color = atoi($2);
-       action = filteringaction_new(action_type, 0, NULL, color);
-}
-| MATCHER_CHANGE_SCORE MATCHER_STRING
-{
-       gint action_type = MATCHACTION_CHANGE_SCORE;
-       char *last_tok = NULL;
-       const gchar *first_tok;
-       long int chscore;
-       int change_type; /* -1 == decrement, 0 == assign, 1 == increment */     
-
-#define is_number(x) ( ((x) == '+') || ((x) == '-') || (isdigit((x))) ) 
-       /* find start */
-       for (first_tok = $2; *first_tok && !is_number(*first_tok); first_tok++)
-               ;            
-#undef is_number               
-       
-       chscore = strtol(first_tok, &last_tok, 10);
-       if (last_tok == first_tok || *last_tok == 0) 
-               chscore = 0;
-       change_type = *first_tok == '+' ? 1 : *first_tok == '-' ? -1 : 0;
-       action = filteringaction_new(MATCHACTION_CHANGE_SCORE, change_type,
-                                    NULL, chscore);
+       color = strtol($2, NULL, 10);
+       action = filteringaction_new(action_type, 0, NULL, color, 0);
+}
+| MATCHER_ADD_SCORE MATCHER_INTEGER
+{
+       gint action_type = MATCHACTION_ADD_SCORE;
+        gint score = 0;
+        
+        score = strtol($2, NULL, 10);
+       action = filteringaction_new(MATCHACTION_ADD_SCORE, 0,
+                                    NULL, 0, score);
+}
+| MATCHER_SET_SCORE MATCHER_INTEGER
+{
+       gint action_type = MATCHACTION_SET_SCORE;
+        gint score = 0;
+        
+        score = strtol($2, NULL, 10);
+       action = filteringaction_new(MATCHACTION_SET_SCORE, 0,
+                                    NULL, 0, score);
+}
+| MATCHER_STOP
+{
+       action = filteringaction_new(MATCHACTION_STOP, 0, NULL, 0, 0);
 }
 ;
 
 scoring_rule:
 MATCHER_SCORE MATCHER_INTEGER
 {
-       score = atoi($2);
+       score = strtol($2, NULL, 0);
 }
 ;
index 7c0818c..231ddde 100644 (file)
@@ -97,6 +97,7 @@ static struct FilteringAction {
        GtkWidget *exec_btn;
        GtkWidget *color_label;
        GtkWidget *color_optmenu;
+       GtkWidget *score_label;
 
        gint current_action;
 } filtering_action;
@@ -117,6 +118,9 @@ typedef enum Action_ {
        ACTION_REDIRECT,
        ACTION_EXECUTE,
        ACTION_COLOR,
+       ACTION_ADD_SCORE,
+       ACTION_SET_SCORE,
+       ACTION_STOP,
        /* add other action constants */
 } Action;
 
@@ -137,7 +141,10 @@ static struct {
        { N_("Forward as attachment"),  ACTION_FORWARD_AS_ATTACHMENT },
        { N_("Redirect"),               ACTION_REDIRECT },
        { N_("Execute"),                ACTION_EXECUTE  },
-       { N_("Color"),                  ACTION_COLOR    }
+       { N_("Color"),                  ACTION_COLOR    },
+       { N_("(In/de)crease score"),    ACTION_ADD_SCORE},
+       { N_("Set score"),              ACTION_SET_SCORE},
+       { N_("Stop filter"),            ACTION_STOP     },
 };
 
 
@@ -220,6 +227,7 @@ static void prefs_filtering_action_create(void)
        GtkWidget *account_list;
        GtkWidget *dest_label;
        GtkWidget *exec_label;
+       GtkWidget *score_label;
        GtkWidget *color_label;
        GtkWidget *account_label;
        GtkWidget *account_combo;
@@ -391,6 +399,11 @@ static void prefs_filtering_action_create(void)
        gtk_misc_set_alignment(GTK_MISC(color_label), 0, 0.5);
        gtk_box_pack_start(GTK_BOX(hbox1), color_label, FALSE, FALSE, 0);
 
+       score_label = gtk_label_new (_("Score"));
+       gtk_widget_show (score_label);
+       gtk_misc_set_alignment (GTK_MISC (score_label), 0, 0.5);
+       gtk_box_pack_start (GTK_BOX (hbox1), score_label, FALSE, FALSE, 0);
+
        dest_entry = gtk_entry_new ();
        gtk_widget_set_usize (dest_entry, 150, -1);
        gtk_widget_show (dest_entry);
@@ -506,6 +519,7 @@ static void prefs_filtering_action_create(void)
        filtering_action.exec_btn = exec_btn;
        filtering_action.color_label   = color_label;
        filtering_action.color_optmenu = color_optmenu;
+       filtering_action.score_label = score_label;
        filtering_action.ok_btn = ok_btn;
        filtering_action.action_clist = action_clist;
 }
@@ -694,6 +708,12 @@ static gint prefs_filtering_action_get_matching_from_action(Action action_id)
                return MATCHACTION_EXECUTE;
        case ACTION_COLOR:
                return MATCHACTION_COLOR;
+       case ACTION_STOP:
+               return MATCHACTION_STOP;
+       case ACTION_ADD_SCORE:
+               return MATCHACTION_ADD_SCORE;
+       case ACTION_SET_SCORE:
+               return MATCHACTION_SET_SCORE;
        default:
                return -1;
        }
@@ -716,12 +736,16 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
        gchar * destination;
        gint labelcolor = 0;
         FilteringAction * action;
-
+        gchar * score_str;
+        gint score;
+        
        action_id = get_sel_from_list(GTK_LIST(filtering_action.action_type_list));
        action_type = prefs_filtering_action_get_matching_from_action(action_id);
        list_id = get_sel_from_list(GTK_LIST(filtering_action.account_list));
        account_id = get_account_id_from_list_id(list_id);
-
+        score = 0;
+        destination = NULL;
+        
        switch (action_id) {
        case ACTION_MOVE:
        case ACTION_COPY:
@@ -750,12 +774,30 @@ static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
                        gtk_option_menu_get_menu(GTK_OPTION_MENU(filtering_action.color_optmenu)));
                destination = NULL;     
                break;
+        case ACTION_ADD_SCORE:
+        case ACTION_SET_SCORE:
+               score_str = gtk_entry_get_text(GTK_ENTRY(filtering_action.dest_entry));
+               if (*score_str == '\0') {
+                       if (alert)
+                                alertpanel_error(_("Score is not set"));
+                       return NULL;
+               }
+                score = strtol(score_str, NULL, 10);
+                break;
+       case ACTION_STOP:
+        case ACTION_DELETE:
+        case ACTION_MARK:
+        case ACTION_UNMARK:
+        case ACTION_LOCK:
+        case ACTION_UNLOCK:
+        case ACTION_MARK_AS_READ:
+        case ACTION_MARK_AS_UNREAD:
        default:
-               destination = NULL;
                break;
        }
        
-       action = filteringaction_new(action_type, account_id, destination, labelcolor);
+       action = filteringaction_new(action_type, account_id,
+            destination, labelcolor, score);
 
         return action;
 }
@@ -971,6 +1013,18 @@ static void prefs_filtering_action_select(GtkCList *clist,
                                     ACTION_COLOR);
                gtk_option_menu_set_history(GTK_OPTION_MENU(filtering_action.color_optmenu), action->labelcolor);     
                break;
+       case MATCHACTION_ADD_SCORE:
+               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+                                    ACTION_ADD_SCORE);
+               break;
+       case MATCHACTION_SET_SCORE:
+               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+                                    ACTION_SET_SCORE);
+               break;
+       case MATCHACTION_STOP:
+               gtk_list_select_item(GTK_LIST(filtering_action.action_type_list),
+                                    ACTION_STOP);
+               break;
        }
 }
 
@@ -1139,6 +1193,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.exec_btn);
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
                break;
        case ACTION_COPY:
                gtk_widget_show(filtering_action.account_label);
@@ -1155,6 +1210,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.exec_btn);
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
                break;
        case ACTION_DELETE:
                gtk_widget_show(filtering_action.account_label);
@@ -1171,6 +1227,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.exec_btn);
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
                break;
        case ACTION_MARK:
        case ACTION_UNMARK:
@@ -1178,6 +1235,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
        case ACTION_UNLOCK:
        case ACTION_MARK_AS_READ:
        case ACTION_MARK_AS_UNREAD:
+        case ACTION_STOP:
                gtk_widget_show(filtering_action.account_label);
                gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
                gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
@@ -1192,6 +1250,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.exec_btn);
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
                break;
        case ACTION_FORWARD:
                gtk_widget_show(filtering_action.account_label);
@@ -1208,6 +1267,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.exec_btn);
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
                break;
        case ACTION_FORWARD_AS_ATTACHMENT:
                gtk_widget_show(filtering_action.account_label);
@@ -1224,6 +1284,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.exec_btn);
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
                break;
        case ACTION_REDIRECT:
                gtk_widget_show(filtering_action.account_label);
@@ -1240,6 +1301,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_hide(filtering_action.exec_btn);
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
                break;
        case ACTION_EXECUTE:
                gtk_widget_show(filtering_action.account_label);
@@ -1255,6 +1317,7 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_show(filtering_action.exec_btn);
                gtk_widget_hide(filtering_action.color_optmenu);
                gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
                break;
        case ACTION_COLOR:
                gtk_widget_show(filtering_action.account_label);
@@ -1269,6 +1332,24 @@ static void prefs_filtering_action_type_select(GtkList *list,
                gtk_widget_set_sensitive(filtering_action.exec_btn, FALSE);
                gtk_widget_show(filtering_action.color_optmenu);
                gtk_widget_show(filtering_action.color_label);
+               gtk_widget_hide(filtering_action.score_label);
+               break;
+       case ACTION_ADD_SCORE:
+       case ACTION_SET_SCORE:
+               gtk_widget_show(filtering_action.account_label);
+               gtk_widget_set_sensitive(filtering_action.account_label, FALSE);
+               gtk_widget_set_sensitive(filtering_action.account_combo, FALSE);
+               gtk_widget_show(filtering_action.dest_entry);
+               gtk_widget_set_sensitive(filtering_action.dest_entry, TRUE);
+               gtk_widget_hide(filtering_action.dest_btn);
+               gtk_widget_hide(filtering_action.dest_label);
+               gtk_widget_hide(filtering_action.recip_label);
+               gtk_widget_hide(filtering_action.exec_label);
+               gtk_widget_show(filtering_action.exec_btn);
+               gtk_widget_set_sensitive(filtering_action.exec_btn, FALSE);
+               gtk_widget_hide(filtering_action.color_optmenu);
+               gtk_widget_hide(filtering_action.color_label);
+               gtk_widget_show(filtering_action.score_label);
                break;
        }
 }