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 --- ChangeLog | 6 ++++++ ChangeLog.ja | 7 +++++++ libsylph/prefs_common.c | 43 +++++++++++++++++++++++++++++++------------ libsylph/prefs_common.h | 1 + src/summaryview.c | 5 +++-- 5 files changed, 48 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf7c4c83..84fc87cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-15 + + * libsylph/prefs_common.[ch] + src/summaryview.c: don't move to trash on manual junk filtering when + 'Delete junk mails from server on receiving' is set. + 2006-08-10 * src/prefs_ui.[ch] diff --git a/ChangeLog.ja b/ChangeLog.ja index c7df6b39..16c4a7b3 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,10 @@ +2006-08-15 + + * libsylph/prefs_common.[ch] + src/summaryview.c: 「受信時に迷惑メールをサーバから削除する」が指定 + されている場合、手動でのフィルタリングでゴミ箱に移動しないように + した。 + 2006-08-10 * src/prefs_ui.[ch] 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; diff --git a/src/summaryview.c b/src/summaryview.c index 38d30e9d..28b6341f 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -4384,7 +4384,8 @@ static gboolean summary_filter_junk_func(GtkTreeModel *model, GtkTreePath *path, fltinfo = filter_info_new(); fltinfo->flags = msginfo->flags; - filter_apply_msginfo(prefs_common.junk_fltlist, msginfo, fltinfo); + filter_apply_msginfo(prefs_common.manual_junk_fltlist, + msginfo, fltinfo); if (fltinfo->actions[FLT_ACTION_MOVE] || fltinfo->actions[FLT_ACTION_COPY] || @@ -4481,7 +4482,7 @@ void summary_filter(SummaryView *summaryview, gboolean selected_only) void summary_filter_junk(SummaryView *summaryview, gboolean selected_only) { - if (prefs_common.junk_fltlist) + if (prefs_common.manual_junk_fltlist) summary_filter_real(summaryview, summary_filter_junk_func, selected_only); } -- cgit v1.2.3