[evolution-mapi] Adapt to Camel API changes.



commit 238bc1415eada8ed2755e188e69c50f657c65b68
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Apr 21 08:12:07 2010 -0400

    Adapt to Camel API changes.

 src/camel/camel-mapi-folder.c |   31 +++++++++++++--------
 src/camel/camel-mapi-store.c  |   61 +++++++++++++++++++++++------------------
 2 files changed, 53 insertions(+), 39 deletions(-)
---
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 472083e..830a069 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -138,7 +138,7 @@ mapi_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 
 }
 
-static void
+static gboolean
 mapi_refresh_info(CamelFolder *folder, CamelException *ex)
 {
 	CamelStoreInfo *si;
@@ -172,6 +172,7 @@ mapi_refresh_info(CamelFolder *folder, CamelException *ex)
 	}
 	//#endif
 
+	return !camel_exception_is_set (ex);
 }
 
 void
@@ -810,7 +811,7 @@ static CamelSessionThreadOps deleted_items_sync_ops = {
 	mapi_sync_deleted_free,
 };
 
-static void
+static gboolean
 mapi_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 {
 	CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (folder->parent_store);
@@ -831,7 +832,7 @@ mapi_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 	if (((CamelOfflineStore *) mapi_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL ||
 			((CamelService *)mapi_store)->status == CAMEL_SERVICE_DISCONNECTED) {
 		mapi_sync_summary (folder, ex);
-		return;
+		return !camel_exception_is_set (ex);
 	}
 
 	if (((CamelMapiFolder *)folder)->type & CAMEL_MAPI_FOLDER_PUBLIC)
@@ -844,7 +845,7 @@ mapi_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 	if (!camel_mapi_store_connected (mapi_store, ex)) {
 		camel_service_unlock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
 		camel_exception_clear (ex);
-		return;
+		return TRUE;
 	}
 	camel_service_unlock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
 
@@ -965,6 +966,8 @@ mapi_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 	camel_service_lock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
 	mapi_sync_summary (folder, ex);
 	camel_service_unlock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
+
+	return !camel_exception_is_set (ex);
 }
 
 gboolean
@@ -1978,7 +1981,7 @@ mapi_get_message_info(CamelFolder *folder, const gchar *uid)
 }
 #endif
 
-static void
+static gboolean
 mapi_expunge (CamelFolder *folder, CamelException *ex)
 {
 	CamelMapiStore *mapi_store = CAMEL_MAPI_STORE(folder->parent_store);
@@ -2013,7 +2016,7 @@ mapi_expunge (CamelFolder *folder, CamelException *ex)
 		} else
 			g_warning ("Could not Empty Trash\n");
 
-		return;
+		return TRUE;
 	}
 
 	changes = camel_folder_change_info_new ();
@@ -2074,9 +2077,11 @@ mapi_expunge (CamelFolder *folder, CamelException *ex)
 
 	g_free (folder_id);
 	camel_folder_change_info_free (changes);
+
+	return TRUE;
 }
 
-static void
+static gboolean
 mapi_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 		CamelFolder *destination, GPtrArray **transferred_uids,
 		gboolean delete_originals, CamelException *ex)
@@ -2094,7 +2099,7 @@ mapi_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 
 	/* check for offline operation */
 	if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
-		return;
+		return TRUE;
 
 	folder_id =  camel_mapi_store_folder_id_lookup (mapi_store, source->full_name);
 	exchange_mapi_util_mapi_id_from_string (folder_id, &src_fid);
@@ -2133,7 +2138,7 @@ mapi_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 	g_slist_foreach (src_msg_ids, (GFunc) g_free, NULL);
 	g_slist_free (src_msg_ids);
 
-	return;
+	return !camel_exception_is_set (ex);
 }
 
 static void
@@ -2151,7 +2156,7 @@ mapi_cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2)
 	return strcmp (uid1, uid2);
 }
 
-static void
+static gboolean
 mapi_append_message (CamelFolder *folder, CamelMimeMessage *message,
 		const CamelMessageInfo *info, gchar **appended_uid,
 		CamelException *ex)
@@ -2178,13 +2183,13 @@ mapi_append_message (CamelFolder *folder, CamelMimeMessage *message,
 		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
 				      _("Cannot append message to folder '%s'"),
 				      folder->full_name);
-		return;
+		return FALSE;
 	}
 
 	if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
 		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
 				      _("Offline."));
-		return;
+		return FALSE;
 	}
 
 	folder_id =  camel_mapi_store_folder_id_lookup (mapi_store,
@@ -2204,6 +2209,8 @@ mapi_append_message (CamelFolder *folder, CamelMimeMessage *message,
 
 	if (appended_uid)
 		*appended_uid = exchange_mapi_util_mapi_ids_to_uid(fid, mid);
+
+	return !camel_exception_is_set (ex);
 }
 
 static void
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index 0e6687e..86a563d 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -80,7 +80,7 @@ static void	camel_mapi_store_init(CamelMapiStore *, CamelMapiStoreClass *);
 static void	camel_mapi_store_finalize(CamelObject *);
 
 /* service methods */
-static void	mapi_construct(CamelService *, CamelSession *,
+static gboolean	mapi_construct(CamelService *, CamelSession *,
 				     CamelProvider *, CamelURL *,
 				     CamelException *);
 static gchar	*mapi_get_name(CamelService *, gboolean );
@@ -91,13 +91,13 @@ static GList	*mapi_query_auth_types(CamelService *, CamelException *);
 /* store methods */
 static CamelFolder	*mapi_get_folder(CamelStore *, const gchar *, guint32, CamelException *);
 static CamelFolderInfo	*mapi_create_folder(CamelStore *, const gchar *, const gchar *, CamelException *);
-static void		mapi_delete_folder(CamelStore *, const gchar *, CamelException *);
-static void		mapi_rename_folder(CamelStore *, const gchar *, const gchar *, CamelException *);
+static gboolean		mapi_delete_folder(CamelStore *, const gchar *, CamelException *);
+static gboolean		mapi_rename_folder(CamelStore *, const gchar *, const gchar *, CamelException *);
 static CamelFolderInfo	*mapi_get_folder_info(CamelStore *, const gchar *, guint32, CamelException *);
-static void		mapi_subscribe_folder(CamelStore *, const gchar *, CamelException *);
+static gboolean		mapi_subscribe_folder(CamelStore *, const gchar *, CamelException *);
 static gboolean mapi_folder_subscribed (CamelStore *store, const gchar *folder_name);
-static void		mapi_unsubscribe_folder(CamelStore *, const gchar *, CamelException *);
-static void		mapi_noop(CamelStore *, CamelException *);
+static gboolean		mapi_unsubscribe_folder(CamelStore *, const gchar *, CamelException *);
+static gboolean		mapi_noop(CamelStore *, CamelException *);
 static CamelFolderInfo * mapi_build_folder_info(CamelMapiStore *mapi_store, const gchar *parent_name, const gchar *folder_name);
 static gboolean mapi_fid_is_system_folder (CamelMapiStore *mapi_store, const gchar *fid);
 
@@ -268,7 +268,7 @@ static void camel_mapi_store_finalize(CamelObject *object)
 }
 
 /* service methods */
-static void mapi_construct(CamelService *service, CamelSession *session,
+static gboolean mapi_construct(CamelService *service, CamelSession *session,
 				 CamelProvider *provider, CamelURL *url,
 				 CamelException *ex)
 {
@@ -277,10 +277,8 @@ static void mapi_construct(CamelService *service, CamelSession *session,
 	CamelMapiStorePrivate *priv = mapi_store->priv;
 	gchar *path = NULL;
 
-	CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex);
-
-	if (camel_exception_is_set (ex))
-		return;
+	if (!CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex))
+		return FALSE;
 
 /*	if (!(url->host || url->user)) { */
 /*		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, */
@@ -290,7 +288,7 @@ static void mapi_construct(CamelService *service, CamelSession *session,
 	/*storage path*/
 	priv->storage_path = camel_session_get_storage_path (session, service, ex);
 	if (!priv->storage_path)
-		return;
+		return FALSE;
 
 	/*store summary*/
 	path = g_alloca (strlen (priv->storage_path) + 32);
@@ -325,6 +323,7 @@ static void mapi_construct(CamelService *service, CamelSession *session,
 
 	store->flags |= CAMEL_STORE_SUBSCRIPTIONS;
 
+	return TRUE;
 }
 
 static char
@@ -648,7 +647,7 @@ mapi_forget_folder (CamelMapiStore *mapi_store, const gchar *folder_name, CamelE
 	camel_folder_info_free (fi);
 }
 
-static void
+static gboolean
 mapi_delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 {
 	CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (store);
@@ -662,7 +661,7 @@ mapi_delete_folder(CamelStore *store, const gchar *folder_name, CamelException *
 
 	if (!camel_mapi_store_connected ((CamelMapiStore *)store, ex)) {
 		camel_service_unlock (CAMEL_SERVICE (store), CS_REC_CONNECT_LOCK);
-		return;
+		return !camel_exception_is_set (ex);
 	}
 
 	folder_id = g_hash_table_lookup (priv->name_hash, folder_name);
@@ -682,6 +681,8 @@ mapi_delete_folder(CamelStore *store, const gchar *folder_name, CamelException *
 	}
 
 	camel_service_unlock (CAMEL_SERVICE (store), CS_REC_CONNECT_LOCK);
+
+	return !camel_exception_is_set (ex);
 }
 
 static void
@@ -733,7 +734,7 @@ mapi_rename_folder_infos (CamelMapiStore *mapi_store, const gchar *old_name, con
 	}
 }
 
-static void
+static gboolean
 mapi_rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_name, CamelException *ex)
 {
 	CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (store);
@@ -748,7 +749,7 @@ mapi_rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_na
 
 	if (!camel_mapi_store_connected ((CamelMapiStore *)store, ex)) {
 		camel_service_unlock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
-		return;
+		return !camel_exception_is_set (ex);
 	}
 
 	/* Need a full name of a folder */
@@ -759,7 +760,7 @@ mapi_rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_na
 				      _("Cannot rename MAPI folder '%s'. Folder does not exist."),
 				      old_name);
 		camel_service_unlock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
-		return;
+		return FALSE;
 	}
 
 	/*Do not allow rename for system folders.*/
@@ -770,7 +771,7 @@ mapi_rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_na
 				      _("Cannot rename MAPI default folder '%s' to '%s'."),
 				      old_name, new_name);
 		camel_service_unlock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
-		return;
+		return FALSE;
 	}
 
 	old_parent = g_strdup (old_name);
@@ -796,7 +797,7 @@ mapi_rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_na
 		camel_service_unlock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
 		g_free (old_parent);
 		g_free (new_parent);
-		return;
+		return FALSE;
 	}
 
 	if (tmp == NULL || g_str_equal (old_parent, new_parent)) {
@@ -812,7 +813,7 @@ mapi_rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_na
 			camel_service_unlock (CAMEL_SERVICE (mapi_store), CS_REC_CONNECT_LOCK);
 			g_free (old_parent);
 			g_free (new_parent);
-			return;
+			return FALSE;
 		}
 
 		mapi_rename_folder_infos (mapi_store, old_name, new_name);
@@ -861,7 +862,7 @@ mapi_rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_na
 			camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename MAPI folder '%s' to '%s'"), old_name, new_name);
 			g_free (old_parent);
 			g_free (new_parent);
-			return;
+			return FALSE;
 		} else {
 			/* folder was moved, update all subfolders immediately, thus
 			   the next get_folder_info call will know about them */
@@ -909,6 +910,8 @@ mapi_rename_folder(CamelStore *store, const gchar *old_name, const gchar *new_na
 
 	g_free (old_parent);
 	g_free (new_parent);
+
+	return TRUE;
 }
 
 static guint32 hexnib(guint32 c)
@@ -1650,7 +1653,7 @@ camel_mapi_store_get_profile_name (CamelMapiStore *mapi_store)
 	return priv->profile;
 }
 
-static void
+static gboolean
 mapi_subscribe_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 {
 	CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (store);
@@ -1678,7 +1681,7 @@ mapi_subscribe_folder(CamelStore *store, const gchar *folder_name, CamelExceptio
 		if (f_name != NULL)
 			folder_name = ++f_name;
 		else  //Don't process All Public Folder.
-			return;
+			return TRUE;
 	}
 
 	fi = mapi_build_folder_info (mapi_store, parent_name, folder_name);
@@ -1689,6 +1692,8 @@ mapi_subscribe_folder(CamelStore *store, const gchar *folder_name, CamelExceptio
 
 	camel_object_trigger_event (CAMEL_OBJECT (store), "folder_subscribed", fi);
 	camel_folder_info_free (fi);
+
+	return TRUE;
 }
 
 static gboolean
@@ -1706,7 +1711,7 @@ mapi_folder_subscribed (CamelStore *store, const gchar *folder_name)
 	return truth;
 }
 
-static void
+static gboolean
 mapi_unsubscribe_folder(CamelStore *store, const gchar *folder_name, CamelException *ex)
 {
 	CamelFolderInfo *fi;
@@ -1733,19 +1738,21 @@ mapi_unsubscribe_folder(CamelStore *store, const gchar *folder_name, CamelExcept
 		if (f_name != NULL)
 			folder_name = ++f_name;
 		else //Don't process All Public Folder.
-			return;
+			return TRUE;
 	}
 
 	fi = mapi_build_folder_info (mapi_store, parent_name, folder_name);
 
 	camel_object_trigger_event (CAMEL_OBJECT (store), "folder_unsubscribed", fi);
 	camel_folder_info_free (fi);
+
+	return TRUE;
 }
 
-static void
+static gboolean
 mapi_noop(CamelStore *store, CamelException *ex)
 {
-
+	return TRUE;
 }
 
 ExchangeMapiConnection *



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