2007-10-05 [wwp] 3.0.2cvs14
[claws.git] / src / filtering.c
index 441592cd8ade17d5a80dec69565c12a52a64e6db..16362ce6fde4fcca89178332e1ebd4198226cb47 100644 (file)
@@ -57,7 +57,7 @@ static inline gint strlen_with_check(const gchar *expr, gint fline, const gchar
         if (str) 
                return strlen(str);
        else {
-               debug_print("%s(%d) - invalid string %s\n", __FILE__, fline, expr);
+               debug_print("%s(%d) - invalid string %s\n", __FILE__, fline, expr?expr:"(null)");
                return 0;
        }
 }
@@ -274,7 +274,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                        folder_find_item_from_identifier(action->destination);
                if (!dest_folder) {
                        debug_print("*** folder not found '%s'\n",
-                               action->destination ?action->destination :"");
+                               action->destination ?action->destination :"(null)");
                        return FALSE;
                }
                
@@ -296,7 +296,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
 
                if (!dest_folder) {
                        debug_print("*** folder not found '%s'\n",
-                               action->destination ?action->destination :"");
+                               action->destination ?action->destination :"(null)");
                        return FALSE;
                }
 
@@ -317,7 +317,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                val = tags_get_id_for_str(action->destination);
                if (val == -1) {
                        debug_print("*** tag '%s' not found\n",
-                               action->destination ?action->destination :"");
+                               action->destination ?action->destination :"(null)");
                        return FALSE;
                }
                
@@ -433,6 +433,10 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                 procmsg_msginfo_set_flags(info, MSG_IGNORE_THREAD, 0);
                 return TRUE;
 
+       case MATCHACTION_WATCH:
+                procmsg_msginfo_set_flags(info, MSG_WATCH_THREAD, 0);
+                return TRUE;
+
        case MATCHACTION_ADD_TO_ADDRESSBOOK:
                {
                        AddressDataSource *book = NULL;
@@ -821,6 +825,8 @@ static gboolean filter_msginfo(GSList * filtering_list, MsgInfo * info, PrefsAcc
 gboolean filter_message_by_msginfo(GSList *flist, MsgInfo *info, PrefsAccount* ac_prefs,
                                                                   FilteringInvocationType context, gchar *extra_info)
 {
+       gboolean ret;
+
        if (prefs_common.enable_filtering_debug) {
                gchar *tmp = _("undetermined");
 
@@ -875,7 +881,10 @@ gboolean filter_message_by_msginfo(GSList *flist, MsgInfo *info, PrefsAccount* a
                }
        } else
                debug_filtering_session = FALSE;
-       return filter_msginfo(flist, info, ac_prefs);
+
+       ret = filter_msginfo(flist, info, ac_prefs);
+       debug_filtering_session = FALSE;
+       return ret;
 }
 
 gchar *filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *action)
@@ -912,6 +921,7 @@ gchar *filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *act
        case MATCHACTION_STOP:
        case MATCHACTION_HIDE:
        case MATCHACTION_IGNORE:
+       case MATCHACTION_WATCH:
        case MATCHACTION_CLEAR_TAGS:
                g_snprintf(dest, destlen, "%s", command_str);
                return dest;