From 0d0740a85cdc7c15e1941e902499c043c4b0802f Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 17 Mar 2004 17:54:39 +0000 Subject: Don't bloody junktest filter mail unless the user has configured Evolution 2004-03-17 Jeffrey Stedfast * camel-folder.c (folder_changed): Don't bloody junktest filter mail unless the user has configured Evolution to do so. svn path=/trunk/; revision=25102 --- camel/ChangeLog | 5 +++++ camel/camel-folder.c | 59 ++++++++++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 27 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 9166e7e1ab..1241ffc3fe 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2004-03-17 Jeffrey Stedfast + + * camel-folder.c (folder_changed): Don't bloody junktest filter + mail unless the user has configured Evolution to do so. + 2004-03-17 Not Zed * providers/local/camel-maildir-store.c: Reverted jeff's fix for diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 620881b1fc..909a5e429c 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -1714,37 +1714,42 @@ folder_changed (CamelObject *obj, gpointer event_data) camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)))); return ret; } - - if (changed->uid_changed->len) { - int i; - guint32 flags; - - for (i = 0; i < changed->uid_changed->len; i ++) { - flags = camel_folder_get_message_flags (folder, changed->uid_changed->pdata [i]); - if (flags & CAMEL_MESSAGE_JUNK_LEARN) { - if (flags & CAMEL_MESSAGE_JUNK) { - if (!junk) - junk = g_ptr_array_new(); - g_ptr_array_add (junk, g_strdup (changed->uid_changed->pdata [i])); - } else { - if (!notjunk) - notjunk = g_ptr_array_new(); - g_ptr_array_add (notjunk, g_strdup (changed->uid_changed->pdata [i])); + + if ((folder->folder_flags & (CAMEL_FOLDER_FILTER_RECENT|CAMEL_FOLDER_FILTER_JUNK)) && changed->uid_recent->len > 0) { + const char *source; + + if (folder->folder_flags & CAMEL_FOLDER_FILTER_RECENT) + source = FILTER_SOURCE_INCOMING; + else + source = FILTER_SOURCE_JUNKTEST; + + if (folder->folder_flags & CAMEL_FOLDER_FILTER_JUNK) { + guint32 flags; + int i; + + for (i = 0; i < changed->uid_changed->len; i++) { + flags = camel_folder_get_message_flags (folder, changed->uid_changed->pdata[i]); + if (flags & CAMEL_MESSAGE_JUNK_LEARN) { + if (flags & CAMEL_MESSAGE_JUNK) { + if (!junk) + junk = g_ptr_array_new (); + g_ptr_array_add (junk, g_strdup (changed->uid_changed->pdata[i])); + } else { + if (!notjunk) + notjunk = g_ptr_array_new (); + g_ptr_array_add (notjunk, g_strdup (changed->uid_changed->pdata[i])); + } + + /* reset junk learn flag so that we don't process it again */ + camel_folder_set_message_flags (folder, changed->uid_changed->pdata[i], + CAMEL_MESSAGE_JUNK_LEARN, 0); } - /* reset junk learn flag so that we don't process it again */ - camel_folder_set_message_flags (folder, changed->uid_changed->pdata [i], CAMEL_MESSAGE_JUNK_LEARN, 0); } } - d(if (junk || notjunk) printf("** Have '%d' messages for junk filter to learn, launching thread to process them\n", - (junk ? junk->len : 0) + (notjunk ? notjunk->len : 0))); - } - - if ((folder->folder_flags & (CAMEL_FOLDER_FILTER_RECENT|CAMEL_FOLDER_FILTER_JUNK)) - && changed->uid_recent->len > 0) - driver = camel_session_get_filter_driver(session, - (folder->folder_flags & CAMEL_FOLDER_FILTER_RECENT) - ? FILTER_SOURCE_INCOMING : FILTER_SOURCE_JUNKTEST, NULL); + driver = camel_session_get_filter_driver (session, source, NULL); + } + CAMEL_FOLDER_LOCK(folder, change_lock); if (driver) { -- cgit v1.2.3