fix bug 4394, 'folder processing runs on startup even if all rules are disabled'
authorPaul <paul@claws-mail.org>
Thu, 22 Oct 2020 06:21:21 +0000 (07:21 +0100)
committerPaul <paul@claws-mail.org>
Thu, 22 Oct 2020 06:21:21 +0000 (07:21 +0100)
src/filtering.c
src/filtering.h
src/folder.c

index 9a3cd95a0fd6281941497e511c889d04c5bc5c63..edd0f3a9c770e22220ac7ec1ecc36c1e1f9ed48f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2015 Hiroyuki Yamamoto & The Claws Mail Team
+ * Copyright (C) 1999-2020 the Claws Mail Team and Hiroyuki Yamamoto
  *
  * 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
  *
  * 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
@@ -790,6 +790,17 @@ static gboolean filtering_is_final_action(FilteringAction *filtering_action)
        }
 }
 
        }
 }
 
+gboolean processing_enabled(GSList *filtering_list)
+{
+       GSList  *l;
+       for (l = filtering_list; l != NULL; l = g_slist_next(l)) {
+               FilteringProp * filtering = (FilteringProp *) l->data;
+               if (filtering->enabled)
+                       return TRUE;
+       }
+       return FALSE;
+}
+
 static gboolean filter_msginfo(GSList * filtering_list, MsgInfo * info, PrefsAccount* ac_prefs)
 {
        GSList  *l;
 static gboolean filter_msginfo(GSList * filtering_list, MsgInfo * info, PrefsAccount* ac_prefs)
 {
        GSList  *l;
index 3f8ef26ac2ca0330cc42de8d4be9c243a107118a..7da85b940b3ef5e27c6fbe752ade666424af99ab 100644 (file)
@@ -1,6 +1,6 @@
 /*
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto & The Claws Mail Team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2020 the Claws Mail Team and Hiroyuki Yamamoto
  *
  * 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
  *
  * 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
@@ -86,6 +86,7 @@ void filteringprop_free(FilteringProp *prop);
 FilteringProp * filteringprop_parse(gchar **str);
 
 void filter_msginfo_move_or_delete(GSList *filtering_list, MsgInfo *info);
 FilteringProp * filteringprop_parse(gchar **str);
 
 void filter_msginfo_move_or_delete(GSList *filtering_list, MsgInfo *info);
+gboolean processing_enabled(GSList *filtering_list);
 gboolean filter_message_by_msginfo(GSList *flist, MsgInfo *info, PrefsAccount *ac_prefs,
                                                                   FilteringInvocationType context, gchar *extra_info);
 
 gboolean filter_message_by_msginfo(GSList *flist, MsgInfo *info, PrefsAccount *ac_prefs,
                                                                   FilteringInvocationType context, gchar *extra_info);
 
index b9a9c99f81674aff4edf849f4915f95ccbdabd67..7f06d3342e47c7a3caf0eb322ba0fffb0167d2bf 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2020 the Claws Mail team and Hiroyuki Yamamoto
  *
  * 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
  *
  * 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
@@ -4447,8 +4447,9 @@ void folder_item_apply_processing(FolderItem *item)
 
        processing_list = item->prefs->processing;
 
 
        processing_list = item->prefs->processing;
 
-       if (!pre_global_processing && !processing_list
-       &&  !post_global_processing)
+       if (!processing_enabled(pre_global_processing) &&
+           !processing_enabled(processing_list) &&
+           !processing_enabled(post_global_processing))
                return;
 
        debug_print("processing %s\n", item->name);
                return;
 
        debug_print("processing %s\n", item->name);