aboutsummaryrefslogtreecommitdiff
path: root/libsylph/prefs_common.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-12-22 08:44:10 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-12-22 08:44:10 +0000
commitc77c6ae995dedbe433fa36f1e4fc75ece4537039 (patch)
treee2cd5933e9824e946a1e41ac3729dde5a51a9e9b /libsylph/prefs_common.c
parentd2327d919562327399c0799b36e71178defe9e93 (diff)
Automatically select appropriate Junk folder on filtering.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2767 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/prefs_common.c')
-rw-r--r--libsylph/prefs_common.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c
index ee6040c6..1467db66 100644
--- a/libsylph/prefs_common.c
+++ b/libsylph/prefs_common.c
@@ -566,86 +566,8 @@ void prefs_common_write_config(void)
g_free(path);
}
-static FilterRule *prefs_common_junk_filter_rule_create(gboolean is_manual)
-{
- FilterRule *rule;
- FilterCond *cond;
- FilterAction *action;
- GSList *cond_list = NULL, *action_list = NULL;
- gchar *junk_id;
-
- if (prefs_common.junk_folder)
- junk_id = g_strdup(prefs_common.junk_folder);
- else {
- FolderItem *item;
- item = folder_get_default_junk();
- if (!item)
- return NULL;
- junk_id = folder_item_get_identifier(item);
- if (!junk_id)
- return NULL;
- }
-
- debug_print("prefs_common_junk_filter_rule_create: junk folder: %s\n",
- junk_id);
-
- 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 && !is_manual) {
- action = filter_action_new(FLT_ACTION_COPY, junk_id);
- action_list = g_slist_append(NULL, action);
- action = filter_action_new(FLT_ACTION_DELETE, NULL);
- action_list = g_slist_append(action_list, action);
- } else {
- action = filter_action_new(FLT_ACTION_MOVE, junk_id);
- action_list = g_slist_append(NULL, action);
- }
-
- if (prefs_common.mark_junk_as_read) {
- action = filter_action_new(FLT_ACTION_MARK_READ, NULL);
- action_list = g_slist_append(action_list, action);
- }
-
- 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);
-
- g_free(junk_id);
-
- return rule;
-}
-
void prefs_common_junk_filter_list_set(void)
{
- FilterRule *rule;
-
- debug_print("prefs_common_junk_filter_list_set\n");
-
- 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)
- return;
-
- rule = prefs_common_junk_filter_rule_create(FALSE);
- if (!rule)
- return;
- prefs_common.junk_fltlist = g_slist_append(NULL, rule);
-
- rule = prefs_common_junk_filter_rule_create(TRUE);
- if (!rule)
- return;
- prefs_common.manual_junk_fltlist = g_slist_append(NULL, rule);
}
void prefs_common_junk_folder_rename_path(const gchar *old_path,
@@ -677,6 +599,5 @@ void prefs_common_junk_folder_rename_path(const gchar *old_path,
dest_path);
g_free(prefs_common.junk_folder);
prefs_common.junk_folder = dest_path;
- prefs_common_junk_filter_list_set();
}
}