[evolution-patches] [Exchange-Mailer] Mails marked as junk not moved to Junk folder



Hi,

When a mail in an exchange-provider is marked as Junk. It disappears
from the view and is also not moved to the Junk folder. The bug # is
257641. 

Attached patch fixes the issue. Please review.

Sankar

 Novell, Inc. 
Software for the Open Enterprise™
http://www.novell.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.499
diff -u -p -r1.499 ChangeLog
--- ChangeLog	10 May 2006 11:18:32 -0000	1.499
+++ ChangeLog	11 May 2006 08:36:01 -0000
@@ -1,3 +1,15 @@
+2006-05-11  Sankar P  <psankar novell com>
+
+	* camel/camel-exchange-store.c: (construct):
+	  camel/camel-exchange-folder.c: (exchange_sync):
+	 
+	  Support for Mark-as-Junk in Exchange.
+	  Exchange doesnot have VJunk and so when a message was marked as Junk 
+	  in exchange it gets disappeared from the view and there is no way to 
+	  get back the message without clearing the cache. This is fixed with
+	  this commit.
+	  Fixes #257641
+	  
 2006-05-10  Sushma Rai  <rsushma novell com>
 
 	* storage/exchange-autoconfig-wizard.c (owa_page_next): Corrected the
Index: camel/camel-exchange-store.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-store.c,v
retrieving revision 1.28
diff -u -p -r1.28 camel-exchange-store.c
--- camel/camel-exchange-store.c	13 Feb 2006 11:59:42 -0000	1.28
+++ camel/camel-exchange-store.c	11 May 2006 08:36:01 -0000
@@ -285,8 +285,7 @@ construct (CamelService *service, CamelS
 	if (!(exch->storage_path = camel_session_get_storage_path (session, service, ex)))
 		return;
 	
-	if (camel_url_get_param (url, "filter_junk"))
-		CAMEL_STORE (service)->flags |= CAMEL_STORE_VJUNK;
+	CAMEL_STORE (service)->flags &= ~CAMEL_STORE_VJUNK;
 	
 	exch->stub = NULL;
 }
Index: camel/camel-exchange-folder.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-folder.c,v
retrieving revision 1.23
diff -u -p -r1.23 camel-exchange-folder.c
--- camel/camel-exchange-folder.c	4 Mar 2006 09:46:44 -0000	1.23
+++ camel/camel-exchange-folder.c	11 May 2006 08:36:01 -0000
@@ -1129,8 +1129,51 @@ camel_exchange_folder_construct (CamelFo
 static void 
 exchange_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 {
+	int count, i;
+	CamelMessageInfo *info;
+	GPtrArray *uids = NULL;
+	CamelFolder *dest = NULL;
+	const char *uid ;
+
 	if (expunge)
 		exchange_expunge (folder, ex);
-	
+
+	count = camel_folder_summary_count (folder->summary);
+	for (i=0 ; i < count ; i++) {
+		guint32 flags = 0;
+		info = camel_folder_summary_index (folder->summary, i);
+
+		if(!info)
+			continue;
+		flags = camel_message_info_flags (info);	
+
+		if ((flags & CAMEL_MESSAGE_JUNK) ) {
+			/* README: Is the exchange server really capable to understand that mails copied to
+			   the junk folder are spam and will it enhance its knowledge? 
+			   Should look at WebDAV specification to see if there is 
+			   anything else we need to do. */
+
+			uid = camel_message_info_uid (info);
+			if (!uids)
+				uids = g_ptr_array_new ();
+			g_ptr_array_add (uids, (gpointer) uid);
+		}
+	}
+
+	if (uids) {
+		/* FIXME: If the Virtual nature of the Junk and Trash folders are dependant on the 
+		   provider, why cant we make it a part of camel i.e., camel should support both 
+		   virtual and actual junk and Trash folders, one of which the providers can choose 
+		   as per their model. The GW provider also seems to be performing the following 
+		   set of operations. */
+		
+		dest = camel_store_get_folder (folder->parent_store, "personal/Junk E-mail", 0, ex);
+		if (dest) 
+			transfer_messages_to (folder, uids, dest, NULL, TRUE, ex);
+		else { 
+			g_print ("\n\aMissing server-side Junk-folder\n\a");
+			camel_message_info_set_flags (info, CAMEL_MESSAGE_JUNK, 0);
+		}
+	}
 	camel_folder_summary_save (folder->summary);
 }


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