diff options
-rw-r--r-- | camel/ChangeLog | 6 | ||||
-rw-r--r-- | camel/camel-folder-summary.h | 6 | ||||
-rw-r--r-- | camel/camel-folder.c | 59 |
3 files changed, 35 insertions, 36 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 1241ffc3fe..49df310c27 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,7 +1,7 @@ -2004-03-17 Jeffrey Stedfast <fejj@ximian.com> +2004-03-17 Radek Doulik <rodo@ximian.com> - * camel-folder.c (folder_changed): Don't bloody junktest filter - mail unless the user has configured Evolution to do so. + * camel-folder-summary.h: use 1<<30 for CAMEL_MESSAGE_JUNK_LEARN, + 1<<17 was already used by imap provider and maybe others 2004-03-17 Not Zed <NotZed@Ximian.com> diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h index d7ed505a1a..fc995874af 100644 --- a/camel/camel-folder-summary.h +++ b/camel/camel-folder-summary.h @@ -70,7 +70,11 @@ enum _CamelMessageFlags { /* following flags are for the folder, and are not really permanent flags */ CAMEL_MESSAGE_FOLDER_FLAGGED = 1<<16, /* for use by the folder implementation */ - CAMEL_MESSAGE_JUNK_LEARN = 1<<17, /* used when setting CAMEL_MESSAGE_JUNK flag + + /* flags after 1<<16 are used by camel providers, + if adding non permanent flags, add them to the end */ + + CAMEL_MESSAGE_JUNK_LEARN = 1<<30, /* used when setting CAMEL_MESSAGE_JUNK flag to say that we request junk plugin to learn that message as junk/non junk */ CAMEL_MESSAGE_USER = 1<<31 /* supports user flags */ diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 909a5e429c..620881b1fc 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -1714,42 +1714,37 @@ folder_changed (CamelObject *obj, gpointer event_data) camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)))); return ret; } - - 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); + + 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])); } + /* 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); } } - - driver = camel_session_get_filter_driver (session, source, NULL); + 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); + CAMEL_FOLDER_LOCK(folder, change_lock); if (driver) { |