[evolution] Bug 772947 - Global junk test option doesn't respect account settings
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 772947 - Global junk test option doesn't respect account settings
- Date: Thu, 10 Nov 2016 13:24:14 +0000 (UTC)
commit 521881f06eb20de1a830d1f45f39ba1f8f8e8ca7
Author: Milan Crha <mcrha redhat com>
Date: Thu Nov 10 14:24:30 2016 +0100
Bug 772947 - Global junk test option doesn't respect account settings
src/libemail-engine/e-mail-session-utils.c | 3 +-
src/libemail-engine/mail-ops.c | 8 ++----
src/mail/e-mail-ui-session.c | 32 ++++++++++++++++++++-------
3 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/src/libemail-engine/e-mail-session-utils.c b/src/libemail-engine/e-mail-session-utils.c
index 1eba77e..8c76d8d 100644
--- a/src/libemail-engine/e-mail-session-utils.c
+++ b/src/libemail-engine/e-mail-session-utils.c
@@ -908,8 +908,7 @@ e_mail_session_send_to (EMailSession *session,
context->cancellable = g_object_ref (cancellable);
/* Failure here emits a runtime warning but is non-fatal. */
- context->driver = camel_session_get_filter_driver (
- CAMEL_SESSION (session), E_FILTER_SOURCE_OUTGOING, &error);
+ context->driver = camel_session_get_filter_driver (CAMEL_SESSION (session), E_FILTER_SOURCE_OUTGOING,
NULL, &error);
if (context->driver != NULL && get_folder_func)
camel_filter_driver_set_folder_func (
context->driver, get_folder_func, get_folder_data);
diff --git a/src/libemail-engine/mail-ops.c b/src/libemail-engine/mail-ops.c
index 9d99d3f..bb4e842 100644
--- a/src/libemail-engine/mail-ops.c
+++ b/src/libemail-engine/mail-ops.c
@@ -204,8 +204,7 @@ mail_filter_folder (EMailSession *session,
m->cache = NULL;
m->delete = FALSE;
- m->driver = camel_session_get_filter_driver (
- CAMEL_SESSION (session), type, NULL);
+ m->driver = camel_session_get_filter_driver (CAMEL_SESSION (session), type, source_folder, NULL);
if (!notify) {
/* FIXME: have a #define NOTIFY_FILTER_NAME macro? */
@@ -518,7 +517,7 @@ mail_fetch_mail (CamelStore *store,
m->provider_unlock = unlock_func;
m->provider_fetch_inbox = fetch_inbox_func;
- fm->driver = camel_session_get_filter_driver (session, type, NULL);
+ fm->driver = camel_session_get_filter_driver (session, type, NULL, NULL);
camel_filter_driver_set_folder_func (fm->driver, get_folder, get_data);
if (status)
camel_filter_driver_set_status_func (fm->driver, status, status_data);
@@ -1135,8 +1134,7 @@ mail_send_queue (EMailSession *session,
m->done = done;
m->data = data;
- m->driver = camel_session_get_filter_driver (
- CAMEL_SESSION (session), type, NULL);
+ m->driver = camel_session_get_filter_driver (CAMEL_SESSION (session), type, queue, NULL);
camel_filter_driver_set_folder_func (m->driver, get_folder, get_data);
mail_msg_unordered_push (m);
diff --git a/src/mail/e-mail-ui-session.c b/src/mail/e-mail-ui-session.c
index 9fcc2e8..d4fc243 100644
--- a/src/mail/e-mail-ui-session.c
+++ b/src/mail/e-mail-ui-session.c
@@ -209,10 +209,22 @@ session_system_beep (CamelFilterDriver *driver,
g_idle_add ((GSourceFunc) session_play_sound_cb, NULL);
}
+static gboolean
+session_folder_can_filter_junk (CamelFolder *folder)
+{
+ if (!folder)
+ return TRUE;
+
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), TRUE);
+
+ return (camel_folder_get_flags (folder) & CAMEL_FOLDER_FILTER_JUNK) != 0;
+}
+
static CamelFilterDriver *
main_get_filter_driver (CamelSession *session,
- const gchar *type,
- GError **error)
+ const gchar *type,
+ CamelFolder *for_folder,
+ GError **error)
{
EMailSession *ms = E_MAIL_SESSION (session);
CamelFilterDriver *driver;
@@ -259,9 +271,10 @@ main_get_filter_driver (CamelSession *session,
camel_filter_driver_set_system_beep_func (driver, session_system_beep, NULL);
add_junk_test =
- priv->check_junk && (
- g_str_equal (type, E_FILTER_SOURCE_INCOMING) ||
- g_str_equal (type, E_FILTER_SOURCE_JUNKTEST));
+ priv->check_junk &&
+ (g_str_equal (type, E_FILTER_SOURCE_INCOMING) ||
+ g_str_equal (type, E_FILTER_SOURCE_JUNKTEST)) &&
+ session_folder_can_filter_junk (for_folder);
if (add_junk_test) {
/* implicit junk check as 1st rule */
@@ -531,12 +544,13 @@ mail_ui_session_remove_service (CamelSession *session,
static CamelFilterDriver *
mail_ui_session_get_filter_driver (CamelSession *session,
- const gchar *type,
- GError **error)
+ const gchar *type,
+ CamelFolder *for_folder,
+ GError **error)
{
return (CamelFilterDriver *) mail_call_main (
- MAIL_CALL_p_ppp, (MailMainFunc) main_get_filter_driver,
- session, type, error);
+ MAIL_CALL_p_pppp, (MailMainFunc) main_get_filter_driver,
+ session, type, for_folder, error);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]