evolution-mapi r20 - in trunk/src: addressbook calendar camel libexchangemapi



Author: jjohnny
Date: Tue Dec  2 08:44:12 2008
New Revision: 20
URL: http://svn.gnome.org/viewvc/evolution-mapi?rev=20&view=rev

Log:
libexchangemapi : Enable exchange_mapi_connection_fetch_items for sorting (new parameter added). Camel : Summary fetch is cancelable. Calendar / Addressbook : fixes for *fetch_items API change.

Modified:
   trunk/src/addressbook/ChangeLog
   trunk/src/addressbook/e-book-backend-mapi.c
   trunk/src/calendar/ChangeLog
   trunk/src/calendar/e-cal-backend-mapi.c
   trunk/src/camel/ChangeLog
   trunk/src/camel/camel-mapi-folder.c
   trunk/src/libexchangemapi/ChangeLog
   trunk/src/libexchangemapi/exchange-mapi-connection.c
   trunk/src/libexchangemapi/exchange-mapi-connection.h

Modified: trunk/src/addressbook/e-book-backend-mapi.c
==============================================================================
--- trunk/src/addressbook/e-book-backend-mapi.c	(original)
+++ trunk/src/addressbook/e-book-backend-mapi.c	Tue Dec  2 08:44:12 2008
@@ -900,7 +900,7 @@
 				return ;				
 			}
 
-			if (!exchange_mapi_connection_fetch_items (priv->fid, &res, 
+			if (!exchange_mapi_connection_fetch_items (priv->fid, &res, NULL,
 								GetPropsList, n_GetPropsList, 
 								mapi_book_build_name_id_for_getprops, NULL, 
 								create_contact_list_cb, &vcard_str, 
@@ -1290,7 +1290,7 @@
 
 		//FIXME: We need to fetch only the query from the server live and not everything.
 		/* execute the query */
-		if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, 
+		if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, NULL,
 							NULL, 0, 
 							NULL, NULL, 
 							create_contact_cb, book_view, 
@@ -1396,7 +1396,7 @@
 	
 	e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache));
 	
-	if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, 
+	if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, NULL,
 						NULL, 0, 
 						NULL, NULL, 
 						cache_contact_cb, ebmapi, 
@@ -1442,7 +1442,7 @@
 	
 	e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache));
 	
-	if (!exchange_mapi_connection_fetch_items ( priv->fid, &res, 
+	if (!exchange_mapi_connection_fetch_items ( priv->fid, &res, NULL,
 						NULL, 0, 
 						NULL, NULL, 
 						cache_contact_cb, ebmapi, 

Modified: trunk/src/calendar/e-cal-backend-mapi.c
==============================================================================
--- trunk/src/calendar/e-cal-backend-mapi.c	(original)
+++ trunk/src/calendar/e-cal-backend-mapi.c	Tue Dec  2 08:44:12 2008
@@ -563,7 +563,7 @@
 //	e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache));
 	/* FIXME: GetProps does not seem to work for tasks :-( */
 	if (kind == ICAL_VTODO_COMPONENT) {
-		if (!exchange_mapi_connection_fetch_items (priv->fid, use_restriction ? &res : NULL, 
+		if (!exchange_mapi_connection_fetch_items (priv->fid, use_restriction ? &res : NULL, NULL,
 						NULL, 0, NULL, NULL, 
 						mapi_cal_get_changes_cb, cbmapi, 
 						MAPI_OPTIONS_FETCH_ALL)) {
@@ -573,7 +573,7 @@
 			g_static_mutex_unlock (&updating);
 			return FALSE;
 		}
-	} else if (!exchange_mapi_connection_fetch_items (priv->fid, use_restriction ? &res : NULL, 
+	} else if (!exchange_mapi_connection_fetch_items (priv->fid, use_restriction ? &res : NULL, NULL,
 						cal_GetPropsList, G_N_ELEMENTS (cal_GetPropsList), 
 						exchange_mapi_cal_util_build_name_id, GINT_TO_POINTER(kind), 
 						mapi_cal_get_changes_cb, cbmapi, 
@@ -599,7 +599,7 @@
 	 * The items in the list are pointers to internal data, 
 	 * so should not be freed, only the list should. */
 	priv->cache_keys = e_cal_backend_cache_get_keys (priv->cache);
-	if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, 
+	if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, NULL,
 						cal_IDList, G_N_ELEMENTS (cal_IDList), 
 						NULL, NULL, 
 						handle_deleted_items_cb, cbmapi, 
@@ -956,7 +956,7 @@
 //	e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache));
 	/* FIXME: GetProps does not seem to work for tasks :-( */
 	if (kind == ICAL_VTODO_COMPONENT) {
-		if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, 
+		if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, NULL,
 						NULL, 0, NULL, NULL, 
 						mapi_cal_cache_create_cb, cbmapi, 
 						MAPI_OPTIONS_FETCH_ALL)) {
@@ -965,7 +965,7 @@
 			g_mutex_unlock (priv->mutex);
 			return GNOME_Evolution_Calendar_OtherError;
 		}
-	} else if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, 
+	} else if (!exchange_mapi_connection_fetch_items (priv->fid, NULL, NULL,
 						cal_GetPropsList, G_N_ELEMENTS (cal_GetPropsList), 
 						exchange_mapi_cal_util_build_name_id, GINT_TO_POINTER(kind), 
 						mapi_cal_cache_create_cb, cbmapi, 
@@ -1271,7 +1271,7 @@
 	set_SPropValue_proptag (&sprop, proptag, (const void *) &sb);
 	cast_mapi_SPropValue (&(res.res.resProperty.lpProp), &sprop);
 
-	exchange_mapi_connection_fetch_items (priv->fid, &res, 
+	exchange_mapi_connection_fetch_items (priv->fid, &res, NULL,
 					NULL, 0, 
 					NULL, NULL, 
 					capture_req_props, cbdata, 

Modified: trunk/src/camel/camel-mapi-folder.c
==============================================================================
--- trunk/src/camel/camel-mapi-folder.c	(original)
+++ trunk/src/camel/camel-mapi-folder.c	Tue Dec  2 08:44:12 2008
@@ -271,6 +271,9 @@
 	if (item_data->total > 0)
                camel_operation_progress (NULL, (item_data->index * 100)/item_data->total);
 
+	if (camel_operation_cancel_check(NULL))
+		return FALSE;
+
 	return TRUE;
 }
 
@@ -545,6 +548,7 @@
 	gboolean status;
 
 	struct mapi_SRestriction *res = NULL;
+	struct SSortOrderSet *sort = NULL;
 	fetch_items_data *fetch_data = g_new0 (fetch_items_data, 1);
 
 	const gchar *folder_id = NULL;
@@ -608,8 +612,16 @@
 			//Creation time ? 
 			set_SPropValue_proptag_date_timeval (&sprop, PR_LAST_MODIFICATION_TIME, &t);
 			cast_mapi_SPropValue (&(res->res.resProperty.lpProp), &sprop);
+
 		} 
 
+		/*Set sort order*/
+		sort = g_new0 (struct SSortOrderSet, 1);
+		sort->cSorts = 1;
+		sort->aSort = g_new0 (struct SSortOrder, sort->cSorts);
+		sort->aSort[0].ulPropTag = PR_LAST_MODIFICATION_TIME;
+		sort->aSort[0].ulOrder = TABLE_SORT_ASCEND;
+
 		exchange_mapi_util_mapi_id_from_string (folder_id, &temp_folder_id);
 
 		if (!camel_mapi_store_connected (mapi_store, ex)) {
@@ -624,7 +636,7 @@
 
 		camel_operation_start (NULL, _("Fetching summary information for new messages in %s"), folder->name);
 
-		status = exchange_mapi_connection_fetch_items  (temp_folder_id, res, 
+		status = exchange_mapi_connection_fetch_items  (temp_folder_id, res, sort,
 								summary_prop_list, G_N_ELEMENTS (summary_prop_list), 
 								NULL, NULL, 
 								fetch_items_cb, fetch_data, 

Modified: trunk/src/libexchangemapi/exchange-mapi-connection.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-connection.c	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-connection.c	Tue Dec  2 08:44:12 2008
@@ -987,7 +987,7 @@
 
 gboolean
 exchange_mapi_connection_fetch_items   (mapi_id_t fid, 
-					struct mapi_SRestriction *res,
+					struct mapi_SRestriction *res, struct SSortOrderSet *sort_order,
 					const uint32_t *GetPropsList, const uint16_t cn_props, 
 					BuildNameID build_name_id, gpointer build_name_data, 
 					FetchCallback cb, gpointer data, 
@@ -1059,6 +1059,14 @@
 		}
 	}
 
+	if (sort_order) {
+		retval = SortTable(&obj_table, sort_order);
+		if (retval != MAPI_E_SUCCESS) {
+			mapi_errstr("SortTable", GetLastError());
+			goto cleanup;
+		}
+	}
+
 	/* Number of items in the container */
 	retval = QueryPosition(&obj_table, NULL, &count);
 	if (retval != MAPI_E_SUCCESS) {
@@ -1119,6 +1127,7 @@
 		GSList *attach_list = NULL;
 		GSList *recip_list = NULL;
 		GSList *stream_list = NULL;
+		gboolean cb_retval = false;
 
 		mapi_object_init(&obj_message);
 
@@ -1184,9 +1193,7 @@
 			item_data->total = SRowSet.cRows;
 			item_data->index = i;
 
-			if (!cb (item_data, data)) {
-				g_warning ("\n%s(%d): %s: Callback failed for message-id %016llX ", __FILE__, __LINE__, __PRETTY_FUNCTION__, *pmid);
-			}
+			cb_retval = cb (item_data, data);
 
 			g_free (item_data);
 		}
@@ -1196,6 +1203,8 @@
 
 	loop_cleanup:
 		mapi_object_release(&obj_message);
+
+		if (!cb_retval) break;
 	}
 
 	result = TRUE;

Modified: trunk/src/libexchangemapi/exchange-mapi-connection.h
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-connection.h	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-connection.h	Tue Dec  2 08:44:12 2008
@@ -124,7 +124,7 @@
 				     guint32 options);
 gboolean
 exchange_mapi_connection_fetch_items   (mapi_id_t fid, 
-					struct mapi_SRestriction *res,
+					struct mapi_SRestriction *res,struct SSortOrderSet *sort_order,
 					const uint32_t *GetPropsList, const uint16_t cn_props, 
 					BuildNameID build_name_id, gpointer build_name_data, 
 					FetchCallback cb, gpointer data, 



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