diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-01-20 04:49:28 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-01-20 04:49:28 +0000 |
commit | e4c8db7b4c62806e29d8f6aad4180642f7d994d6 (patch) | |
tree | c3cf40dac3babebae8a6ea0dbc1eae610f489b5f /src | |
parent | 890921332f2f03f0aaead00067321f7b5137bcd2 (diff) |
check the return value of junk filter command and show error dialog on failure.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2809 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/inc.c | 10 | ||||
-rw-r--r-- | src/summaryview.c | 42 |
2 files changed, 39 insertions, 13 deletions
@@ -1313,7 +1313,10 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) fltinfo); if (fltinfo->drop_done) is_junk = TRUE; - else if (fltinfo->error == FLT_ERROR_EXEC_FAILED) { + else if (fltinfo->error == FLT_ERROR_EXEC_FAILED || + fltinfo->last_exec_exit_status >= 3) { + g_warning("inc_drop_message: junk filter command returned %d", + fltinfo->last_exec_exit_status); alertpanel_error (_("Execution of the junk filter command failed.\n" "Please check the junk mail control setting.")); @@ -1337,7 +1340,10 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) msginfo, fltinfo); if (fltinfo->drop_done) is_junk = TRUE; - else if (fltinfo->error == FLT_ERROR_EXEC_FAILED) { + else if (fltinfo->error == FLT_ERROR_EXEC_FAILED || + fltinfo->last_exec_exit_status >= 3) { + g_warning("inc_drop_message: junk filter command returned %d", + fltinfo->last_exec_exit_status); alertpanel_error (_("Execution of the junk filter command failed.\n" "Please check the junk mail control setting.")); diff --git a/src/summaryview.c b/src/summaryview.c index ab01fe5b..8429839d 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -4733,8 +4733,10 @@ static gboolean summary_filter_junk_func(GtkTreeModel *model, GtkTreePath *path, fltinfo->actions[FLT_ACTION_DELETE] || fltinfo->actions[FLT_ACTION_MARK_READ]) summaryview->filtered++; - else if (fltinfo->error == FLT_ERROR_EXEC_FAILED) { + else if (fltinfo->error == FLT_ERROR_EXEC_FAILED || + fltinfo->last_exec_exit_status >= 3) { if (summaryview->flt_count == 1) { + g_warning("summary_filter_junk_func: junk filter command returned %d", fltinfo->last_exec_exit_status); alertpanel_error (_("Execution of the junk filter command failed.\n" "Please check the junk mail control setting.")); @@ -4922,18 +4924,28 @@ static void summary_junk_func(GtkTreeModel *model, GtkTreePath *path, ret = filter_action_exec(&rule, msginfo, file, fltinfo); - if (ret == 0 && - msginfo->flags.perm_flags != fltinfo->flags.perm_flags) { - msginfo->flags = fltinfo->flags; - summary_set_row(summaryview, iter, msginfo); - if (MSG_IS_IMAP(msginfo->flags)) { - if (fltinfo->actions[FLT_ACTION_MARK_READ]) - imap_msg_unset_perm_flags(msginfo, - MSG_NEW | MSG_UNREAD); + if (ret < 0 || fltinfo->last_exec_exit_status != 0) { + g_warning("summary_junk_func: junk filter command returned %d", + fltinfo->last_exec_exit_status); + alertpanel_error + (_("Execution of the junk filter command failed.\n" + "Please check the junk mail control setting.")); + } else { + if (ret == 0 && + msginfo->flags.perm_flags != fltinfo->flags.perm_flags) { + msginfo->flags = fltinfo->flags; + summary_set_row(summaryview, iter, msginfo); + if (MSG_IS_IMAP(msginfo->flags)) { + if (fltinfo->actions[FLT_ACTION_MARK_READ]) + imap_msg_unset_perm_flags + (msginfo, MSG_NEW | MSG_UNREAD); + } } + if (ret == 0 && fltinfo->actions[FLT_ACTION_MOVE] && + fltinfo->move_dest) + summary_move_row_to(summaryview, iter, + fltinfo->move_dest); } - if (ret == 0 && fltinfo->actions[FLT_ACTION_MOVE] && fltinfo->move_dest) - summary_move_row_to(summaryview, iter, fltinfo->move_dest); filter_info_free(fltinfo); g_slist_free(rule.action_list); @@ -4963,6 +4975,14 @@ static void summary_not_junk_func(GtkTreeModel *model, GtkTreePath *path, ret = filter_action_exec(&rule, msginfo, file, fltinfo); + if (ret < 0 || fltinfo->last_exec_exit_status != 0) { + g_warning("summary_not_junk_func: junk filter command returned %d", + fltinfo->last_exec_exit_status); + alertpanel_error + (_("Execution of the junk filter command failed.\n" + "Please check the junk mail control setting.")); + } + filter_info_free(fltinfo); g_slist_free(rule.action_list); g_free(file); |