evolution-data-server r9715 - in trunk: camel camel/providers/groupwise servers/groupwise



Author: psankar
Date: Fri Oct 31 10:27:56 2008
New Revision: 9715
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9715&view=rev

Log:
** Fix for bnc bugs #440502, #209514, #434958, #434946,

GroupWise improvements

Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-folder-summary.c
   trunk/camel/providers/groupwise/ChangeLog
   trunk/camel/providers/groupwise/camel-groupwise-folder.c
   trunk/camel/providers/groupwise/camel-groupwise-store.c
   trunk/camel/providers/groupwise/camel-groupwise-summary.c
   trunk/servers/groupwise/ChangeLog
   trunk/servers/groupwise/e-gw-connection.c
   trunk/servers/groupwise/e-gw-connection.h
   trunk/servers/groupwise/e-gw-item.c

Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c	(original)
+++ trunk/camel/camel-folder-summary.c	Fri Oct 31 10:27:56 2008
@@ -2124,6 +2124,7 @@
 	g_ptr_array_foreach (s->uids, (GFunc) camel_pstring_free, NULL);
 	g_ptr_array_free (s->uids, TRUE);
 	s->uids = g_ptr_array_new ();
+	s->visible_count = s->deleted_count = s->unread_count = 0;
 
 	g_hash_table_destroy(s->loaded_infos);
 	s->loaded_infos = g_hash_table_new(g_str_hash, g_str_equal);

Modified: trunk/camel/providers/groupwise/camel-groupwise-folder.c
==============================================================================
--- trunk/camel/providers/groupwise/camel-groupwise-folder.c	(original)
+++ trunk/camel/providers/groupwise/camel-groupwise-folder.c	Fri Oct 31 10:27:56 2008
@@ -93,6 +93,9 @@
 
 #define d(x)  
 
+const char * GET_ITEM_VIEW_WITH_CACHE = "peek default recipient threading attachments subject status priority startDate created delivered size recurrenceKey message notification";
+const char * GET_ITEM_VIEW_WITHOUT_CACHE = "peek default recipient threading hasAttachment subject status priority startDate created delivered size recurrenceKey";
+
 static CamelMimeMessage *
 groupwise_folder_get_message( CamelFolder *folder, const char *uid, CamelException *ex )
 {
@@ -166,7 +169,7 @@
 
 	cnc = cnc_lookup (priv);
 	
-	status = e_gw_connection_get_item (cnc, container_id, uid, "peek default distribution recipient message attachments subject notification created recipientStatus status hasAttachment size recurrenceKey", &item);
+	status = e_gw_connection_get_item (cnc, container_id, uid, GET_ITEM_VIEW_WITH_CACHE, &item);
 	if (status != E_GW_CONNECTION_STATUS_OK) {
 		g_free (container_id);
 		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Could not get message"));
@@ -183,8 +186,11 @@
 		return NULL;
 	}
 
-	if (msg)
+	if (msg) {
 		camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-Source", groupwise_base_url_lookup (priv));
+		mi->info.dirty = TRUE;
+		camel_folder_summary_touch (folder->summary);
+	}
 
 	/* add to cache */
 	CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
@@ -643,6 +649,9 @@
 	}
 	CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
 
+	if (folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)
+		return ;
+
 	count = camel_folder_summary_count (folder->summary);
 	CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
 	for (i=0 ; i < count ; i++) {
@@ -1186,6 +1195,18 @@
 		if (list) {
 			gw_update_cache (folder, list, ex, FALSE);
 		}
+		
+		if (check_all && !is_proxy) {
+				EGwContainer *container;
+				container = e_gw_connection_get_container (cnc, container_id);
+
+				d(printf ("Evolution's folder summary length is : %u\tserver has %u items",
+										camel_folder_summary_count (folder->summary), e_gw_container_get_total_count (container)));
+
+				if (camel_folder_summary_count (folder->summary) == e_gw_container_get_total_count (container))
+						check_all = FALSE;
+				g_object_unref (container);
+		}
 	}
 
 
@@ -1247,6 +1268,10 @@
 
 	gboolean is_proxy = folder->parent_store->flags & CAMEL_STORE_WRITE;
 
+	int folder_needs_caching;
+
+	camel_object_get (folder, NULL, CAMEL_OFFLINE_FOLDER_ARG_SYNC_OFFLINE, &folder_needs_caching, NULL);
+
 	changes = camel_folder_change_info_new ();
 	container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name));
 	if (!container_id) {
@@ -1285,7 +1310,11 @@
 
 		camel_operation_progress (NULL, (100*i)/total_items);
 
-		status = e_gw_connection_get_item (cnc, container_id, id, "peek default distribution recipient message attachments subject notification created recipientStatus status hasAttachment size recurrenceKey", &item);
+		if (folder_needs_caching)
+			status = e_gw_connection_get_item (cnc, container_id, id, GET_ITEM_VIEW_WITH_CACHE, &item);
+		else
+			status = e_gw_connection_get_item (cnc, container_id, id, GET_ITEM_VIEW_WITHOUT_CACHE, &item);
+
 		if (status != E_GW_CONNECTION_STATUS_OK) {
 			i++;
 			continue;
@@ -1354,33 +1383,33 @@
 		mi->server_flags = mi->info.flags;
 
 		org = e_gw_item_get_organizer (item); 
+
 		if (org) {
-			GString *str;
-			int i;
-			str = g_string_new ("");
-			if (org->display_name && org->display_name[0] && org->email != NULL && org->email[0] != '\0') {
-				for (i = 0; org->display_name[i] != '<' && 
-						org->display_name[i] != '\0';
-						i++);
+				GString *str;
+				int i;
+				str = g_string_new ("");
 
-				org->display_name[i] = '\0';
-				str = g_string_append (str, org->display_name);
-				str = g_string_append (str, " ");
-			}
+				if (org->display_name && org->display_name[0] && org->email != NULL && org->email[0] != '\0') {
+						for (i = 0; org->display_name[i] != '<' && 
+										org->display_name[i] != '\0'; 
+										i++);
+
+						org->display_name[i] = '\0';
+						str = g_string_append (str, org->display_name);
+						str = g_string_append (str, " ");
+				}
 
-                        if (org->display_name[0] == '\0') { 
+				if (org->email && org->email[0]) { 
+						g_string_append (str, "<");
+						str = g_string_append (str, org->email);
+						g_string_append (str, ">");
+				}
 
-				str = g_string_append (str, org->email);
-				str = g_string_append (str, " ");
-			}
-			if (org->email && org->email[0]) { 
-				g_string_append (str, "<");
-				str = g_string_append (str, org->email);
-				g_string_append (str, ">");
-			}
-			mi->info.from = camel_pstring_strdup (str->str);
-			g_string_free (str, TRUE);
+
+				mi->info.from = camel_pstring_strdup (str->str);
+				g_string_free (str, TRUE);
 		}
+
 		g_string_truncate (str, 0);
 		recp_list = e_gw_item_get_recipient_list (item);
 		if (recp_list) {
@@ -1426,16 +1455,19 @@
 			}
 		}
 
-		if (!exists) {
-			mi->info.uid = camel_pstring_strdup (e_gw_item_get_id(item));
-			mi->info.size = e_gw_item_get_mail_size (item);	
-			mi->info.subject = camel_pstring_strdup(e_gw_item_get_subject(item));
-		}
-
 		if (exists) {
 			camel_folder_change_info_change_uid (changes, mi->info.uid);
 			camel_message_info_free (pmi);
 		} else {
+			mi->info.uid = camel_pstring_strdup (e_gw_item_get_id(item));
+			mi->info.size = e_gw_item_get_mail_size (item);	
+			mi->info.subject = camel_pstring_strdup(e_gw_item_get_subject(item));
+			mi->info.dirty = TRUE;
+			
+			folder->summary->visible_count ++;
+			if (!(mi->info.flags & CAMEL_MESSAGE_SEEN))
+					folder->summary->unread_count ++;
+
 			camel_folder_summary_add (folder->summary,(CamelMessageInfo *)mi);
 			camel_folder_change_info_add_uid (changes, mi->info.uid);
 			camel_folder_change_info_recent_uid (changes, mi->info.uid);
@@ -1445,27 +1477,30 @@
 		if (!strcmp (folder->full_name, "Junk Mail"))
 			continue;
 
-		/******************** Begine Caching ************************/
-		/* add to cache if its a new message*/
-		t_cache_stream  = camel_data_cache_get (gw_folder->cache, "cache", id, ex);
-		if (t_cache_stream) {
-			camel_object_unref (t_cache_stream);
-
-			mail_msg = groupwise_folder_item_to_msg (folder, item, ex);
-			if (mail_msg)
-				camel_medium_set_header (CAMEL_MEDIUM (mail_msg), "X-Evolution-Source", groupwise_base_url_lookup (priv));
+		if (folder_needs_caching) {
+				/******************** Begine Caching ************************/
+				/* add to cache if its a new message*/
+				t_cache_stream  = camel_data_cache_get (gw_folder->cache, "cache", id, ex);
+				if (t_cache_stream) {
+						camel_object_unref (t_cache_stream);
+
+						mail_msg = groupwise_folder_item_to_msg (folder, item, ex);
+						if (mail_msg)
+								camel_medium_set_header (CAMEL_MEDIUM (mail_msg), "X-Evolution-Source", groupwise_base_url_lookup (priv));
 
-			CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-			if ((cache_stream = camel_data_cache_add (gw_folder->cache, "cache", id, NULL))) {
-				if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) mail_msg, 	cache_stream) == -1 || camel_stream_flush (cache_stream) == -1)
-					camel_data_cache_remove (gw_folder->cache, "cache", id, NULL);
-				camel_object_unref (cache_stream);
-			}
+						CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
+						if ((cache_stream = camel_data_cache_add (gw_folder->cache, "cache", id, NULL))) {
+								if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) mail_msg, 	cache_stream) == -1 || camel_stream_flush (cache_stream) == -1)
+										camel_data_cache_remove (gw_folder->cache, "cache", id, NULL);
+								camel_object_unref (cache_stream);
+						}
 
-			camel_object_unref (mail_msg);
-			CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
+						camel_object_unref (mail_msg);
+						CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
+				}
+				/******************** Caching stuff ends *************************/
 		}
-		/******************** Caching stuff ends *************************/
+
 		i++;
 		g_object_unref (item);
 	}
@@ -2136,6 +2171,12 @@
 	EGwConnectionStatus status = E_GW_CONNECTION_STATUS_OK;
 	EGwConnection *cnc;
 	CamelFolderChangeInfo *changes = NULL;
+	gboolean destination_is_trash;
+
+	if (destination == camel_store_get_trash (source->parent_store, NULL))
+		destination_is_trash = TRUE;
+	else
+		destination_is_trash = FALSE;
 
 	count = camel_folder_summary_count (destination->summary);
 	qsort (uids->pdata, uids->len, sizeof (void *), uid_compar);
@@ -2163,6 +2204,9 @@
 		GList *l;
 		int i;
 
+		if (destination_is_trash)
+			delete_originals = TRUE;
+
 		for (l = item_ids, i = 0; l; l = l->next, i++) {
 			CamelMessageInfo *info;
 
@@ -2253,33 +2297,40 @@
 			}
 		}
 
-		if (delete_originals) {
-			if (strcmp(source->full_name, "Sent Items")) {
-				status = e_gw_connection_move_item (cnc, (const char *)uids->pdata[index],
-						dest_container_id, source_container_id);
-			} else {
-				char *container_id = NULL;
-				container_id = e_gw_connection_get_container_id (cnc, "Mailbox");
-				status = e_gw_connection_move_item (cnc, (const char *)uids->pdata[index],
-						dest_container_id, container_id);
-				g_free (container_id);
-			}
+		if (destination_is_trash) {
+				e_gw_connection_remove_item (cnc, source_container_id, (const char*) uids->pdata[index]);
+				camel_folder_summary_remove_uid (source->summary, uids->pdata[index]);
+				camel_folder_change_info_remove_uid (changes, uids->pdata[index]);
+		} else {
+				if (delete_originals) {
+						if (strcmp(source->full_name, "Sent Items")) {
+								status = e_gw_connection_move_item (cnc, (const char *)uids->pdata[index],
+												dest_container_id, source_container_id);
+						} else {
+								char *container_id = NULL;
+								container_id = e_gw_connection_get_container_id (cnc, "Mailbox");
+								status = e_gw_connection_move_item (cnc, (const char *)uids->pdata[index],
+												dest_container_id, container_id);
+								g_free (container_id);
+						}
 
-		} else
-			status = e_gw_connection_move_item (cnc, (const char *)uids->pdata[index],
-					dest_container_id, NULL);
+				} else
+						status = e_gw_connection_move_item (cnc, (const char *)uids->pdata[index],
+										dest_container_id, NULL);
+
+				if (status == E_GW_CONNECTION_STATUS_OK) {
+						if (delete_originals) { 
+								/*if ( !strcmp(source->full_name, SENT) ) {
+								  camel_folder_delete_message(source, uids->pdata[index]);
+								  } else {*/
+								camel_folder_summary_remove_uid (source->summary, uids->pdata[index]);
+								camel_folder_change_info_remove_uid (changes, uids->pdata[index]);
+								//}
+						}
+				} else {
+						g_warning ("Warning!! Could not move item : %s\n", (char *)uids->pdata[index]);
+				}
 
-		if (status == E_GW_CONNECTION_STATUS_OK) {
-			if (delete_originals) { 
-				/*if ( !strcmp(source->full_name, SENT) ) {
-					camel_folder_delete_message(source, uids->pdata[index]);
-				} else {*/
-					camel_folder_summary_remove_uid (source->summary, uids->pdata[index]);
-					camel_folder_change_info_remove_uid (changes, uids->pdata[index]);
-				//}
-			}
-		} else {
-			g_warning ("Warning!! Could not move item : %s\n", (char *)uids->pdata[index]);
 		}
 		index ++;
 	}

Modified: trunk/camel/providers/groupwise/camel-groupwise-store.c
==============================================================================
--- trunk/camel/providers/groupwise/camel-groupwise-store.c	(original)
+++ trunk/camel/providers/groupwise/camel-groupwise-store.c	Fri Oct 31 10:27:56 2008
@@ -56,6 +56,7 @@
 #define JUNK_ENABLE 1
 #define JUNK_PERSISTENCE 14
 
+const char * CREATE_CURSOR_VIEW = "peek id default recipient threading hasAttachment subject status priority startDate created delivered size recurrenceKey";
 
 struct _CamelGroupwiseStorePrivate {
 	char *server_name;
@@ -469,13 +470,11 @@
 static void
 groupwise_forget_folder (CamelGroupwiseStore *gw_store, const char *folder_name, CamelException *ex)
 {
-	CamelFolderSummary *summary;
 	CamelGroupwiseStorePrivate *priv = gw_store->priv;
-	char *summary_file, *state_file;
+	char *state_file;
 	char *folder_dir, *storage_path;
 	CamelFolderInfo *fi;
 	const char *name;
-
 	
 	name = folder_name;
 
@@ -487,19 +486,6 @@
 		return;
 	}
 
-	summary_file = g_strdup_printf ("%s/summary", folder_dir);
-	summary = camel_groupwise_summary_new(NULL,summary_file);
-	if(!summary) {
-		g_free(summary_file);
-		g_free(folder_dir);
-		return;
-	}
-
-	camel_object_unref (summary);
-	g_unlink (summary_file);
-	g_free (summary_file);
-
-
 	state_file = g_strdup_printf ("%s/cmeta", folder_dir);
 	g_unlink (state_file);
 	g_free (state_file);
@@ -611,7 +597,7 @@
 		d(g_print ("\n\n** %s **: No summary as yet : using get cursor request\n\n", folder->name);)
 
 		status = e_gw_connection_create_cursor (priv->cnc, container_id, 
-				"peek id recipient attachments distribution subject status options priority startDate created delivered size hasAttachment",
+				CREATE_CURSOR_VIEW,
 				NULL,
 				&cursor);
 		if (status != E_GW_CONNECTION_STATUS_OK) {
@@ -624,37 +610,50 @@
 		camel_folder_summary_clear (folder->summary);
 
 		while (!done) {
-			status = e_gw_connection_read_cursor (priv->cnc, container_id, 
-							      cursor, FALSE, 
-							      CURSOR_ITEM_LIMIT, position, &list);
-			if (status != E_GW_CONNECTION_STATUS_OK) {
-				all_ok = FALSE;
-				break;
-				/*
-				CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
-				e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
-				//camel_folder_summary_clear (folder->summary);
-				camel_folder_summary_save_to_db (folder->summary, ex);
-				camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
-				camel_operation_end (NULL);
-				camel_object_unref (folder);
-				g_free (container_id);
-				return NULL;*/
-			}
-			
-			count += g_list_length (list);
-		
-			if (total > 0)
-				camel_operation_progress (NULL, (100*count)/total);
-			gw_update_summary (folder, list,  ex);
-			
-			if (!list)
-				done = TRUE;
-			g_list_foreach (list, (GFunc)g_object_unref, NULL);
-			g_list_free (list);
-			list = NULL;
-			position = E_GW_CURSOR_POSITION_CURRENT;
-      		}
+				status = e_gw_connection_read_cursor (priv->cnc, container_id, 
+								cursor, FALSE, 
+								CURSOR_ITEM_LIMIT, position, &list);
+				if (status != E_GW_CONNECTION_STATUS_OK) {
+						all_ok = FALSE;
+						break;
+						/*
+						   CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
+						   e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
+						//camel_folder_summary_clear (folder->summary);
+						camel_folder_summary_save_to_db (folder->summary, ex);
+						camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
+						camel_operation_end (NULL);
+						camel_object_unref (folder);
+						g_free (container_id);
+						return NULL;*/
+				}
+
+				/* This full block is repeated in the reload_folder code as well. We need
+				better modularity */
+				count += CURSOR_ITEM_LIMIT;
+
+				if (total > 0) {
+						d(printf ("Doing readcursor : [total: %d] [count: %d]\n", total, count));
+
+						if (count > total)
+								count = total;
+
+						camel_operation_progress (NULL, (100*count)/total);
+				}
+
+				gw_update_summary (folder, list,  ex);
+
+				/* For shared-folders created by the user, we don't get the total number of messages, 
+				in the getFolderList call. So, we need to wait until an empty list is returned in the 
+				read cursor call. Hence, we need the !list checking in the code below */
+				if (count == total || !list)
+						done = TRUE;
+
+				g_list_foreach (list, (GFunc)g_object_unref, NULL);
+				g_list_free (list);
+				list = NULL;
+				position = E_GW_CURSOR_POSITION_CURRENT;
+		}
 
 		e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
 
@@ -721,51 +720,63 @@
 
 	summary_count = camel_folder_summary_count (folder->summary);
 	if(!summary_count || !summary->time_string) {
-		d(g_print ("\n\n** %s **: Summary missing???? Reloading summary....\n\n", folder->name);)
+			d(g_print ("\n\n** %s **: Summary missing???? Reloading summary....\n\n", folder->name);)
 
-		status = e_gw_connection_create_cursor (priv->cnc, container_id, 
-				"peek id recipient attachments distribution subject status options priority startDate created delivered size hasAttachment",
-				NULL,
-				&cursor);
-		if (status != E_GW_CONNECTION_STATUS_OK) {
-			CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
-			g_free (container_id);
-			return;
-		}
+					status = e_gw_connection_create_cursor (priv->cnc, container_id, 
+									CREATE_CURSOR_VIEW,
+									NULL,
+									&cursor);
+			if (status != E_GW_CONNECTION_STATUS_OK) {
+					CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
+					g_free (container_id);
+					return;
+			}
 
-		camel_operation_start (NULL, _("Fetching summary information for new messages in %s"), folder->name);
+			camel_operation_start (NULL, _("Fetching summary information for new messages in %s"), folder->name);
 
-		while (!done) {
-			status = e_gw_connection_read_cursor (priv->cnc, container_id, 
-							      cursor, FALSE, 
-							      CURSOR_ITEM_LIMIT, position, &list);
-			if (status != E_GW_CONNECTION_STATUS_OK) {
-				CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
-				e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
-				camel_folder_summary_save_to_db (folder->summary, ex);
-				camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
-				camel_operation_end (NULL);
-				g_free (container_id);
-				return;
+			while (!done) {
+					status = e_gw_connection_read_cursor (priv->cnc, container_id, 
+									cursor, FALSE, 
+									CURSOR_ITEM_LIMIT, position, &list);
+					if (status != E_GW_CONNECTION_STATUS_OK) {
+							CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
+							e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
+							camel_folder_summary_save_to_db (folder->summary, ex);
+							camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
+							camel_operation_end (NULL);
+							g_free (container_id);
+							return;
+					}
+					/* This full block is repeated in the get_folder code as well. We need
+					   better modularity */
+					count += CURSOR_ITEM_LIMIT;
+
+					if (total > 0) {
+							d(printf ("Doing readcursor : [total: %d] [count: %d]\n", total, count));
+
+							if (count > total)
+									count = total;
+
+							camel_operation_progress (NULL, (100*count)/total);
+					}
+
+					gw_update_summary (folder, list,  ex);
+
+					/* For shared-folders created by the user, we don't get the total number of messages, 
+					   in the getFolderList call. So, we need to wait until an empty list is returned in the 
+					   read cursor call. Hence, we need the !list checking in the code below */
+					if (count == total || !list)
+							done = TRUE;
+
+					g_list_foreach (list, (GFunc)g_object_unref, NULL);
+					g_list_free (list);
+					list = NULL;
+					position = E_GW_CURSOR_POSITION_CURRENT;
 			}
-			
-			count += g_list_length (list);
-		
-			if (total > 0)
-				camel_operation_progress (NULL, (100*count)/total);
-			gw_update_summary (folder, list,  ex);
-			
-			if (!list)
-				done = TRUE;
-			g_list_foreach (list, (GFunc)g_object_unref, NULL);
-			g_list_free (list);
-			list = NULL;
-			position = E_GW_CURSOR_POSITION_CURRENT;
-      		}
 
-		e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
+			e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
 
-		camel_operation_end (NULL);
+			camel_operation_end (NULL);
 	} 
 
 	if (done) {
@@ -867,6 +878,9 @@
 	if (e_gw_container_get_is_shared_by_me (container))
 		fi->flags |= CAMEL_FOLDER_SHARED_BY_ME;
 
+	if (e_gw_container_get_is_system_folder (container))
+		fi->flags |= CAMEL_FOLDER_SYSTEM;
+
 	fi->total = e_gw_container_get_total_count (container);
 	fi->unread = e_gw_container_get_unread_count (container);
 

Modified: trunk/camel/providers/groupwise/camel-groupwise-summary.c
==============================================================================
--- trunk/camel/providers/groupwise/camel-groupwise-summary.c	(original)
+++ trunk/camel/providers/groupwise/camel-groupwise-summary.c	Fri Oct 31 10:27:56 2008
@@ -171,7 +171,7 @@
 
 	camel_exception_init (&ex);
 	if (camel_folder_summary_load_from_db (summary, &ex) == -1) {
-		camel_folder_summary_clear (summary);
+		camel_folder_summary_clear_db (summary);
 	}
 
 	return summary;
@@ -394,6 +394,7 @@
 							mi->summary->unread_count -- ;
 				}
 
+				mi->dirty = TRUE;
 				camel_folder_summary_touch(mi->summary);
 		}
 	}
@@ -489,7 +490,7 @@
 		camel_message_info_free(info);
 	}
 
-	camel_folder_summary_clear (summary);
+	camel_folder_summary_clear_db (summary);
 	//camel_folder_summary_save (summary);
 
 	if (uncache)

Modified: trunk/servers/groupwise/e-gw-connection.c
==============================================================================
--- trunk/servers/groupwise/e-gw-connection.c	(original)
+++ trunk/servers/groupwise/e-gw-connection.c	Fri Oct 31 10:27:56 2008
@@ -734,7 +734,6 @@
 	if (!cnc)
 		return E_GW_CONNECTION_STATUS_UNKNOWN;
 
-	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
 	g_return_val_if_fail (container_list != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
 
 	msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getFolderListRequest");
@@ -824,6 +823,49 @@
 	return container_id;
 }
 
+EGwContainer *
+e_gw_connection_get_container (EGwConnection *cnc, const char * uid)
+{
+		SoupSoapMessage *msg;
+		SoupSoapResponse *response;
+		EGwConnectionStatus status;
+
+		g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
+		g_return_val_if_fail (uid!= NULL, NULL);
+
+		msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getFolderRequest");
+		if (!msg) {
+				g_warning (G_STRLOC ": Could not build SOAP message");
+				return NULL;
+		}
+
+		e_gw_message_write_string_parameter (msg, "uid", NULL, uid);
+		e_gw_message_write_string_parameter (msg, "view", NULL, "count");
+		e_gw_message_write_footer (msg);
+
+		/* send message to server */
+		response = e_gw_connection_send_message (cnc, msg);
+		if (!response) {
+				g_object_unref (msg);
+				return NULL;
+		}
+
+		status = e_gw_connection_parse_response_status (response);
+		g_object_unref (msg);
+
+		if (status == E_GW_CONNECTION_STATUS_OK) {
+				EGwContainer *container;
+				SoupSoapParameter *subparam;
+
+				subparam = soup_soap_response_get_first_parameter_by_name (response, "folder");
+				container = e_gw_container_new_from_soap_parameter (subparam);
+
+				return container;
+		}
+
+		return NULL;
+}
+
 EGwConnectionStatus
 e_gw_connection_get_items_delta_info (EGwConnection *cnc, const char *container, gdouble *first_sequence,
 					gdouble *last_sequence, gdouble *last_po_rebuild_time )

Modified: trunk/servers/groupwise/e-gw-connection.h
==============================================================================
--- trunk/servers/groupwise/e-gw-connection.h	(original)
+++ trunk/servers/groupwise/e-gw-connection.h	Fri Oct 31 10:27:56 2008
@@ -99,9 +99,12 @@
 const char         *e_gw_connection_get_error_message (EGwConnectionStatus status);
 
 EGwConnectionStatus e_gw_connection_logout (EGwConnection *cnc);
+
 EGwConnectionStatus e_gw_connection_get_container_list (EGwConnection *cnc, const char *top, GList **container_list);
 void                e_gw_connection_free_container_list (GList *container_list);
 char               *e_gw_connection_get_container_id (EGwConnection *cnc, const char *name);
+EGwContainer * e_gw_connection_get_container (EGwConnection *cnc, const char * uid);
+
 EGwConnectionStatus e_gw_connection_get_items (EGwConnection *cnc, const char *container,
 					       const char *view, EGwFilter *filter, GList **list);
 EGwConnectionStatus e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes, GSList **updates);

Modified: trunk/servers/groupwise/e-gw-item.c
==============================================================================
--- trunk/servers/groupwise/e-gw-item.c	(original)
+++ trunk/servers/groupwise/e-gw-item.c	Fri Oct 31 10:27:56 2008
@@ -2058,7 +2058,7 @@
 		} else if (!g_ascii_strcasecmp (name, "alarm")) {
 			char *enabled;
 			enabled = soup_soap_parameter_get_property (child, "enabled");
-			if (!g_ascii_strcasecmp (enabled, "1") ) {
+			if (enabled && !g_ascii_strcasecmp (enabled, "1") ) {
 				value = soup_soap_parameter_get_string_value (child);
 				/* convert it into integer */
 				item->priv->trigger = atoi (value);



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