evolution-data-server r8475 - in trunk/camel: . providers/imap



Author: msuman
Date: Mon Feb 11 05:10:24 2008
New Revision: 8475
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8475&view=rev

Log:
Patch from Milan Crha  <mcrha redhat com> ** Fix for bug #515054 (New flag CAMEL_MESSAGE_NOTJUNK, Read/write CAMEL_MESSAGE_NOTJUNK flags from/to server if supported)

Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-filter-search.c
   trunk/camel/camel-folder-summary.c
   trunk/camel/camel-folder-summary.h
   trunk/camel/providers/imap/ChangeLog
   trunk/camel/providers/imap/camel-imap-utils.c

Modified: trunk/camel/camel-filter-search.c
==============================================================================
--- trunk/camel/camel-filter-search.c	(original)
+++ trunk/camel/camel-filter-search.c	Mon Feb 11 05:10:24 2008
@@ -644,10 +644,10 @@
 {
 	ESExpResult *r;
 	gboolean retval = FALSE;
+	CamelMessageInfo *info = fms->info;
 	
 	d(printf("doing junk test for message from '%s'\n", camel_message_info_from (fms->info)));
-	if (fms->session->junk_plugin != NULL) {
-		CamelMessageInfo *info = fms->info;
+	if (fms->session->junk_plugin != NULL && (camel_message_info_flags (info) & (CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_NOTJUNK)) == 0) {
 		const GHashTable *ht = camel_session_get_junk_headers (fms->session);
 		struct _camel_header_param *node = ((CamelMessageInfoBase *)info)->headers;
 
@@ -667,7 +667,7 @@
 			retval = camel_session_lookup_addressbook (fms->session, camel_message_info_from (info)) != TRUE;
 			if (camel_debug ("junk"))
 				printf("Sender '%s' in book? %d\n", camel_message_info_from (info), !retval);
-			
+
 			if (retval) /* Not in book. Could be spam. So check for it*/ {
 				d(printf("filtering message\n"));
 				retval = camel_junk_plugin_check_junk (fms->session->junk_plugin, camel_filter_search_get_message (fms, f));
@@ -676,6 +676,11 @@
 
 		if (camel_debug ("junk"))
 			printf("junk filter => %s\n", retval ? "*JUNK*" : "clean");
+	} else if (fms->session->junk_plugin != NULL && camel_debug ("junk")) {
+		if (camel_message_info_flags (info) & CAMEL_MESSAGE_JUNK)
+			printf ("Message has a Junk flag set already, skipping junk test...\n");
+		else if (camel_message_info_flags (info) & CAMEL_MESSAGE_NOTJUNK)
+			printf ("Message has a NotJunk flag set already, skipping junk test...\n");
 	}
 
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);

Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c	(original)
+++ trunk/camel/camel-folder-summary.c	Mon Feb 11 05:10:24 2008
@@ -2670,6 +2670,7 @@
 	{ "seen", CAMEL_MESSAGE_SEEN },
 	{ "attachments", CAMEL_MESSAGE_ATTACHMENTS },
 	{ "junk", CAMEL_MESSAGE_JUNK },
+	{ "notjunk", CAMEL_MESSAGE_NOTJUNK },
 	{ "secure", CAMEL_MESSAGE_SECURE },
 	{ NULL, 0 }
 };

Modified: trunk/camel/camel-folder-summary.h
==============================================================================
--- trunk/camel/camel-folder-summary.h	(original)
+++ trunk/camel/camel-folder-summary.h	Mon Feb 11 05:10:24 2008
@@ -75,6 +75,7 @@
 	CAMEL_MESSAGE_SECURE = 1<<8,
 	CAMEL_MESSAGE_USER_NOT_DELETABLE = 1<<9,
 	CAMEL_MESSAGE_HIDDEN = 1<<10,
+	CAMEL_MESSAGE_NOTJUNK = 1<<11,
 
 	/* following flags are for the folder, and are not really permanent flags */
 	CAMEL_MESSAGE_FOLDER_FLAGGED = 1<<16, /* for use by the folder implementation */

Modified: trunk/camel/providers/imap/camel-imap-utils.c
==============================================================================
--- trunk/camel/providers/imap/camel-imap-utils.c	(original)
+++ trunk/camel/providers/imap/camel-imap-utils.c	Mon Feb 11 05:10:24 2008
@@ -513,6 +513,8 @@
 		g_string_append (gstr, "\\Seen ");
 	if ((flags & CAMEL_MESSAGE_JUNK) != 0 && (permanent_flags & CAMEL_MESSAGE_JUNK) != 0)
 		g_string_append (gstr, "Junk ");
+	if ((flags & CAMEL_MESSAGE_NOTJUNK) != 0 && (permanent_flags & CAMEL_MESSAGE_NOTJUNK) != 0)
+		g_string_append (gstr, "NotJunk ");
 
 	/* send user flags to the server only when it supports it, otherwise store it locally only */
 	if (info && (permanent_flags & CAMEL_MESSAGE_USER) != 0) {
@@ -579,9 +581,11 @@
 		else if (!g_ascii_strncasecmp (flag_list, "\\Recent", len))
 			flags |= CAMEL_IMAP_MESSAGE_RECENT;
 		else if (!g_ascii_strncasecmp(flag_list, "\\*", len))
-			flags |= CAMEL_MESSAGE_USER|CAMEL_MESSAGE_JUNK;
+			flags |= CAMEL_MESSAGE_USER|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_NOTJUNK;
 		else if (!g_ascii_strncasecmp(flag_list, "Junk", len))
 			flags |= CAMEL_MESSAGE_JUNK;
+		else if (!g_ascii_strncasecmp(flag_list, "NotJunk", len))
+			flags |= CAMEL_MESSAGE_NOTJUNK;
 		else if (!g_ascii_strncasecmp(flag_list, "$Label1", len) ||
 			 !g_ascii_strncasecmp(flag_list, "$Label2", len) ||
 			 !g_ascii_strncasecmp(flag_list, "$Label3", len) ||



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]