[evolution-mapi] Bug #634062 - Crash when missing ESource property "public"



commit a4c94b2c075cd721ab493e8e64483a3b12f7bbd6
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 18 16:09:32 2011 +0100

    Bug #634062 - Crash when missing ESource property "public"

 .../exchange-mapi-account-listener.c               |    6 ++----
 src/addressbook/e-book-backend-mapi-contacts.c     |    2 +-
 src/calendar/e-cal-backend-mapi.c                  |   16 ++++++++--------
 3 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-mapi-account-listener.c b/src/account-setup-eplugin/exchange-mapi-account-listener.c
index ba33d10..c74ef6a 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-listener.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-listener.c
@@ -346,8 +346,7 @@ add_cal_esource (EAccount *account, GSList *folders, ExchangeMAPIFolderType fold
 			ESource *source = temp_list->data;
 
 			if (source && E_IS_SOURCE (source)) {
-				if (!e_source_get_property (source, "public") ||
-				    strcmp (e_source_get_property (source, "public"), "yes") != 0)
+				if (g_strcmp0 (e_source_get_property (source, "public"), "yes") != 0)
 					e_source_group_remove_source (group, source);
 			}
 		}
@@ -763,8 +762,7 @@ add_addressbook_sources (EAccount *account, GSList *folders, mapi_id_t trash_fid
 			ESource *source = temp_list->data;
 
 			if (source && E_IS_SOURCE (source)) {
-				if (!e_source_get_property (source, "public") ||
-				    strcmp (e_source_get_property (source, "public"), "yes") != 0)
+				if (g_strcmp0 (e_source_get_property (source, "public"), "yes") != 0)
 					e_source_group_remove_source (group, source);
 			}
 		}
diff --git a/src/addressbook/e-book-backend-mapi-contacts.c b/src/addressbook/e-book-backend-mapi-contacts.c
index 4248228..fb6962b 100644
--- a/src/addressbook/e-book-backend-mapi-contacts.c
+++ b/src/addressbook/e-book-backend-mapi-contacts.c
@@ -648,7 +648,7 @@ ebbm_contacts_load_source (EBookBackendMAPI *ebma, ESource *source, gboolean onl
 		return /* Success */;
 
 	priv->fid = 0;
-	priv->is_public_folder = e_source_get_property (source, "public") && g_str_equal (e_source_get_property (source, "public"), "yes");
+	priv->is_public_folder = g_strcmp0 (e_source_get_property (source, "public"), "yes") == 0;
 
 	exchange_mapi_util_mapi_id_from_string (e_source_get_property (source, "folder-id"), &priv->fid);
 
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index e6dfa86..6a4750f 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -324,7 +324,7 @@ ecbm_remove (ECalBackend *backend, EDataCal *cal, GError **perror)
 		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
 		return;
 	}
-	if (strcmp (e_source_get_property (source, "public"), "yes") != 0) {
+	if (g_strcmp0 (e_source_get_property (source, "public"), "yes") != 0) {
 		GError *mapi_error = NULL;
 
 		if (!exchange_mapi_connection_remove_folder (priv->conn, priv->fid, 0, &mapi_error)) {
@@ -752,7 +752,7 @@ get_deltas (gpointer handle)
 //	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 (strcmp (e_source_get_property(source, "public"), "yes") == 0 ) {
+		if (g_strcmp0 (e_source_get_property (source, "public"), "yes") == 0) {
 			options |= MAPI_OPTIONS_USE_PFSTORE;
 			is_public = TRUE;
 			use_restriction = FALSE;
@@ -778,7 +778,7 @@ get_deltas (gpointer handle)
 			return FALSE;
 		}
 	} else {
-		if (strcmp (e_source_get_property (source, "public"), "yes") == 0) {
+		if (g_strcmp0 (e_source_get_property (source, "public"), "yes") == 0) {
 			options |= MAPI_OPTIONS_USE_PFSTORE;
 			is_public = TRUE;
 			use_restriction = FALSE;
@@ -828,7 +828,7 @@ get_deltas (gpointer handle)
 	copy_strings_in_slist (did.cache_ids);
 	options = 0;
 
-	if (strcmp (e_source_get_property(source, "public"), "yes") == 0 )
+	if (g_strcmp0 (e_source_get_property (source, "public"), "yes") == 0)
 		options = MAPI_OPTIONS_USE_PFSTORE;
 
 	if (!exchange_mapi_connection_fetch_items (priv->conn, priv->fid, NULL, NULL,
@@ -904,7 +904,7 @@ get_deltas (gpointer handle)
 		g_slist_free (did.unknown_mids);
 
 		if (kind == ICAL_VTODO_COMPONENT) {
-			if (strcmp (e_source_get_property(source, "public"), "yes") == 0) {
+			if (g_strcmp0 (e_source_get_property (source, "public"), "yes") == 0) {
 				options |= MAPI_OPTIONS_USE_PFSTORE;
 				is_public = TRUE;
 			}
@@ -928,7 +928,7 @@ get_deltas (gpointer handle)
 				return FALSE;
 			}
 		} else {
-			if (strcmp (e_source_get_property(source, "public"), "yes") == 0) {
+			if (g_strcmp0 (e_source_get_property (source, "public"), "yes") == 0) {
 				options |= MAPI_OPTIONS_USE_PFSTORE;
 				is_public = TRUE;
 			}
@@ -1285,7 +1285,7 @@ populate_cache (ECalBackendMAPI *cbmapi, GError **perror)
 //	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 (strcmp (e_source_get_property(source, "public"), "yes") == 0) {
+		if (g_strcmp0 (e_source_get_property (source, "public"), "yes") == 0) {
 			options |= MAPI_OPTIONS_USE_PFSTORE;
 			is_public = TRUE;
 		}
@@ -1305,7 +1305,7 @@ populate_cache (ECalBackendMAPI *cbmapi, GError **perror)
 			return FALSE;
 		}
 	} else {
-		if (strcmp (e_source_get_property(source, "public"), "yes") ==0 ) {
+		if (g_strcmp0 (e_source_get_property (source, "public"), "yes") == 0) {
 			options |= MAPI_OPTIONS_USE_PFSTORE;
 			is_public = TRUE;
 		}



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