From fd4fa414a182c6ca1a75ec7244cc8e6ad409c56a Mon Sep 17 00:00:00 2001 From: hiro Date: Tue, 15 Aug 2006 02:16:17 +0000 Subject: fixed manual junk filtering. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1125 ee746299-78ed-0310-b773-934348b2243d --- libsylph/prefs_common.c | 43 +++++++++++++++++++++++++++++++------------ libsylph/prefs_common.h | 1 + 2 files changed, 32 insertions(+), 12 deletions(-) (limited to 'libsylph') diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c index ead1bd23..24d67589 100644 --- a/libsylph/prefs_common.c +++ b/libsylph/prefs_common.c @@ -462,25 +462,17 @@ void prefs_common_write_config(void) g_free(path); } -void prefs_common_junk_filter_list_set(void) +static FilterRule *prefs_common_junk_filter_rule_create(gboolean is_manual) { FilterRule *rule; FilterCond *cond; FilterAction *action; GSList *cond_list = NULL, *action_list = NULL; - if (prefs_common.junk_fltlist) { - filter_rule_list_free(prefs_common.junk_fltlist); - prefs_common.junk_fltlist = NULL; - } - - if (!prefs_common.junk_classify_cmd || !prefs_common.junk_folder) - return; - cond = filter_cond_new(FLT_COND_CMD_TEST, 0, 0, NULL, prefs_common.junk_classify_cmd); cond_list = g_slist_append(NULL, cond); - if (prefs_common.delete_junk_on_recv) { + if (prefs_common.delete_junk_on_recv && !is_manual) { action = filter_action_new(FLT_ACTION_COPY, prefs_common.junk_folder); action_list = g_slist_append(NULL, action); @@ -497,8 +489,35 @@ void prefs_common_junk_filter_list_set(void) action_list = g_slist_append(action_list, action); } - rule = filter_rule_new(_("Junk mail filter"), FLT_OR, - cond_list, action_list); + if (is_manual) + rule = filter_rule_new(_("Junk mail filter (manual)"), FLT_OR, + cond_list, action_list); + else + rule = filter_rule_new(_("Junk mail filter"), FLT_OR, + cond_list, action_list); + + return rule; +} +void prefs_common_junk_filter_list_set(void) +{ + FilterRule *rule; + + if (prefs_common.junk_fltlist) { + filter_rule_list_free(prefs_common.junk_fltlist); + prefs_common.junk_fltlist = NULL; + } + if (prefs_common.manual_junk_fltlist) { + filter_rule_list_free(prefs_common.manual_junk_fltlist); + prefs_common.manual_junk_fltlist = NULL; + } + + if (!prefs_common.junk_classify_cmd || !prefs_common.junk_folder) + return; + + rule = prefs_common_junk_filter_rule_create(FALSE); prefs_common.junk_fltlist = g_slist_append(NULL, rule); + + rule = prefs_common_junk_filter_rule_create(TRUE); + prefs_common.manual_junk_fltlist = g_slist_append(NULL, rule); } diff --git a/libsylph/prefs_common.h b/libsylph/prefs_common.h index 4abe2da6..5d9eb9d5 100644 --- a/libsylph/prefs_common.h +++ b/libsylph/prefs_common.h @@ -267,6 +267,7 @@ struct _PrefsCommon /* Filtering */ GSList *fltlist; GSList *junk_fltlist; + GSList *manual_junk_fltlist; /* Actions */ GSList *actions_list; -- cgit v1.2.3