aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-02-14 08:01:28 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-02-14 08:01:28 +0000
commitdac50a4059b01b89aa46565370a1a9a14d957455 (patch)
treed635e4bfa30d49dba8428fbf1e596385c2a8929d /libsylph
parentae3597033e34c838ff5d18f69f3fb64f00c798c4 (diff)
added an option: 'Do not classify message as junk if sender is in the address book'
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3222 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/filter.c13
-rw-r--r--libsylph/prefs_common.c2
-rw-r--r--libsylph/prefs_common.h2
3 files changed, 14 insertions, 3 deletions
diff --git a/libsylph/filter.c b/libsylph/filter.c
index bb6a1c74..813ed329 100644
--- a/libsylph/filter.c
+++ b/libsylph/filter.c
@@ -1586,9 +1586,16 @@ FilterRule *filter_junk_rule_create(PrefsAccount *account,
debug_print("filter_junk_rule_create: junk folder: %s\n",
junk_id);
+ if (prefs_common.nofilter_junk_sender_in_book) {
+ cond = filter_cond_new(FLT_COND_HEADER, FLT_IN_ADDRESSBOOK,
+ FLT_NOT_MATCH, "From", NULL);
+ cond_list = g_slist_append(cond_list, cond);
+ }
+
cond = filter_cond_new(FLT_COND_CMD_TEST, 0, 0, NULL,
prefs_common.junk_classify_cmd);
- cond_list = g_slist_append(NULL, cond);
+ cond_list = g_slist_append(cond_list, cond);
+
if (prefs_common.delete_junk_on_recv && !is_manual) {
action = filter_action_new(FLT_ACTION_COPY, junk_id);
action_list = g_slist_append(NULL, action);
@@ -1605,10 +1612,10 @@ FilterRule *filter_junk_rule_create(PrefsAccount *account,
}
if (is_manual)
- rule = filter_rule_new(_("Junk mail filter (manual)"), FLT_OR,
+ rule = filter_rule_new(_("Junk mail filter (manual)"), FLT_AND,
cond_list, action_list);
else
- rule = filter_rule_new(_("Junk mail filter"), FLT_OR,
+ rule = filter_rule_new(_("Junk mail filter"), FLT_AND,
cond_list, action_list);
g_free(junk_id);
diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c
index 46806d4e..0c3de0bc 100644
--- a/libsylph/prefs_common.c
+++ b/libsylph/prefs_common.c
@@ -393,6 +393,8 @@ static PrefParam param[] = {
P_BOOL},
{"delete_junk_on_receive", "TRUE", &prefs_common.delete_junk_on_recv,
P_BOOL},
+ {"nofilter_junk_sender_in_book", "TRUE",
+ &prefs_common.nofilter_junk_sender_in_book, P_BOOL},
{"mark_junk_as_read", "FALSE", &prefs_common.mark_junk_as_read, P_BOOL},
/* Privacy */
diff --git a/libsylph/prefs_common.h b/libsylph/prefs_common.h
index 471d95c8..266ae13d 100644
--- a/libsylph/prefs_common.h
+++ b/libsylph/prefs_common.h
@@ -343,6 +343,8 @@ struct _PrefsCommon
gint attach_toolbutton_pos; /* Message - Attachment */
gboolean enable_newmsg_notify_window; /* Receive */
+
+ gboolean nofilter_junk_sender_in_book; /* Junk Mail */
};
extern PrefsCommon prefs_common;