[evolution-patches] (groupwise)fix for bug 72302 - deleted emails not syncing up



Hi,
The attached patch fixes the problem of mails deleted from the server
not syncing up at Evolution.

Thanks,
partha
Index: camel-groupwise-folder.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-folder.c,v
retrieving revision 1.46
diff -u -p -r1.46 camel-groupwise-folder.c
--- camel-groupwise-folder.c	5 Apr 2005 06:08:24 -0000	1.46
+++ camel-groupwise-folder.c	6 Apr 2005 09:21:42 -0000
@@ -75,6 +75,7 @@ static void groupwise_transfer_messages_
 static int gw_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args) ;
 void convert_to_calendar (EGwItem *item, char **str, int *len) ;
 static void convert_to_task (EGwItem *item, char **str, int *len);
+static void gw_update_all_items ( CamelFolder *folder, GList *item_list, CamelException *ex);
 
 #define d(x) x
 
@@ -730,6 +731,23 @@ groupwise_refresh_info(CamelFolder *fold
 	} 	
 
 	gw_update_summary (folder, list, ex) ;
+	
+	t_str = g_strdup (time_string);
+	status = e_gw_connection_get_quick_messages (cnc, container_id,	"id",
+				&t_str, "All", NULL, NULL, -1, &slist) ;
+	g_free (t_str), t_str = NULL;
+	if (status != E_GW_CONNECTION_STATUS_OK) {
+		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
+		CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
+		g_free (container_id) ;
+		return ;
+	}
+	
+	for ( sl = slist ; sl != NULL; sl = sl->next) {
+		list = g_list_append (list, sl->data) ;
+	}
+	
+	gw_update_all_items (folder, list, ex);
 
 end:
 	CAMEL_SERVICE_UNLOCK (gw_store, connect_lock);
@@ -861,6 +879,44 @@ gw_update_summary ( CamelFolder *folder,
 		} */
 	camel_folder_change_info_free (changes) ;
 	g_ptr_array_free (msg, TRUE) ;
+}
+
+static void
+gw_update_all_items ( CamelFolder *folder, GList *item_list, CamelException *ex) 
+{
+	CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
+	GPtrArray *summary = camel_folder_get_summary (folder);
+	int index = 0;
+	GList *item_ids = NULL, *temp_list = NULL, *l = NULL;
+	CamelFolderChangeInfo *changes = NULL ;
+
+	changes = camel_folder_change_info_new () ;
+	/*item_ids : List of ids from the summary*/
+	while (index < summary->len) {
+		CamelMessageInfo *info = g_ptr_array_index (summary, index);
+		item_ids = g_list_append (item_ids, info->uid);
+		index ++;
+	}
+	l = item_ids;
+	camel_folder_free_summary (folder, summary);
+
+	/*item_list : List of ids from the server*/
+	for ( ; item_list != NULL ; item_list = g_list_next (item_list) ) 
+		temp_list = g_list_append (temp_list, (const char *)item_list->data);
+
+	for (; item_ids != NULL ; item_ids = g_list_next (item_ids)) {
+		GList *temp = NULL;
+		temp = g_list_find_custom (temp_list, (const char *)item_ids->data, (GCompareFunc) strcmp);
+		if (!temp) {
+			camel_folder_summary_remove_uid (folder->summary, (const char *)item_ids->data) ;
+			camel_data_cache_remove(gw_folder->cache, "cache", (const char *)item_ids->data, ex);
+			camel_folder_change_info_remove_uid(changes, (const char *)item_ids->data);
+		}
+	}
+	camel_object_trigger_event (folder, "folder_changed", changes) ;
+
+	g_list_free (l);
+	g_list_free (temp_list);
 }
 
 static void
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/ChangeLog,v
retrieving revision 1.45
diff -u -p -r1.45 ChangeLog
--- ChangeLog	5 Apr 2005 06:08:24 -0000	1.45
+++ ChangeLog	7 Apr 2005 05:51:58 -0000
@@ -1,3 +1,12 @@
+2005-04-07  Parthasarathi Susarla <sparthasarathi novell com>
+	
+	* camel-groupwise-folder.c: 
+	  (groupwise_refresh_info): get the ids of all items
+	  in a folder from the server. 
+	  (gw_update_all_items): update summary with items
+	  that have been deleted from the server.
+	  Fixes bug **72302 **74381 **72303
+	
 2005-04-05  Parthasarathi Susarla <sparthasarathi novell com>
 
 	* camel-groupwise-folder.c: (groupwise_refresh_info):


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