[evolution-patches] Exchange : fixes #312848



Hi,

The first patch is for e-d-s, which properly checks that the folder
being deleted is a standard folder, and the other patch is for exchange,
which converts the error from the server to the proper backend value.

-- Sarfraaz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.29.2.4
diff -u -p -u -p -r1.29.2.4 ChangeLog
--- ChangeLog	30 Sep 2005 05:28:43 -0000	1.29.2.4
+++ ChangeLog	21 Oct 2005 09:21:11 -0000
@@ -1,3 +1,9 @@
+2005-10-21  Sarfraaz Ahmed <asarfraaz novell com>
+
+	* storage/exchange-account.c (exchange_account_remove_folder) : Proceed
+	with deletion of folder only if the folder being removed is *not* a 
+	standard folder. This fixes #312848.
+
 2005-09-30  Arunprakash  <arunp novell com>
 
 	* storage/exchange-account.c (setup_account_hierarchies) : Skips the
Index: storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.c,v
retrieving revision 1.16.2.2
diff -u -p -u -p -r1.16.2.2 exchange-account.c
--- storage/exchange-account.c	30 Sep 2005 05:28:43 -0000	1.16.2.2
+++ storage/exchange-account.c	21 Oct 2005 09:21:12 -0000
@@ -362,6 +362,7 @@ hierarchy_new_folder (ExchangeHierarchy 
 	/* This makes the cleanup easier. We just unref it each time
 	 * we find it in account->priv->folders.
 	 */
+	d(printf ("adding folder : %s\n", e_folder_get_name (folder)));
 	key = (char *) e_folder_exchange_get_path (folder);
 	if (!g_hash_table_lookup (account->priv->folders, key)) {
 		/* Avoid dupilcations since the user could add a folder as
@@ -511,12 +512,24 @@ exchange_account_create_folder (Exchange
 	return exchange_hierarchy_create_folder (hier, parent, path, type);
 }
 
+static gboolean
+check_if_sf (gpointer key, gpointer value, gpointer user_data)
+{
+	char *sf_href = (char *)value;
+	char *int_uri = (char *)user_data;
+
+	if (!strcmp (sf_href, int_uri))
+		return TRUE; /* Quit calling the callback */
+
+	return FALSE; /* Continue calling the callback till end of table */
+}
+
 ExchangeAccountFolderResult
 exchange_account_remove_folder (ExchangeAccount *account, const char *path)
 {
 	ExchangeHierarchy *hier;
 	EFolder *folder;
-	const char *name;
+	const char *int_uri;
 
 	g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), 
 				EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR);
@@ -524,9 +537,12 @@ exchange_account_remove_folder (Exchange
 	if (!get_folder (account, path, &folder, &hier))
 		return EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST;
 	
-	name = e_folder_get_name (folder);
-	if (exchange_account_get_standard_uri (account, name))
+	int_uri = e_folder_exchange_get_internal_uri (folder);
+
+	if (g_hash_table_find (account->priv->standard_uris, 
+					check_if_sf, int_uri)) {
 		return EXCHANGE_ACCOUNT_FOLDER_UNSUPPORTED_OPERATION;
+	}
 
 	return exchange_hierarchy_remove_folder (hier, folder);
 }
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.395.2.11
diff -u -p -u -p -r1.395.2.11 ChangeLog
--- ChangeLog	6 Oct 2005 08:27:05 -0000	1.395.2.11
+++ ChangeLog	21 Oct 2005 09:30:43 -0000
@@ -1,3 +1,12 @@
+2005-10-21  Sarfraaz Ahmed <asarfraaz novell com>
+
+	* addressbook/e-book-backend-exchange.c 
+	(e_book_backend_exchange_remove) : Check for the proper return values
+	from the server and return the appropriate status back.
+	* calendar/e-cal-backend-exchange.c (remove_calendar) : Similar
+	* mail/mail-stub-exchange.c (delete_folder) : Similar
+	This fixes #312848.
+
 2005-10-04  Sarfraaz Ahmed <asarfraaz novell com>
 
 	* configure.in : Bumped the version to 2.4.1
Index: addressbook/e-book-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/addressbook/e-book-backend-exchange.c,v
retrieving revision 1.41.2.1
diff -u -p -u -p -r1.41.2.1 e-book-backend-exchange.c
--- addressbook/e-book-backend-exchange.c	12 Sep 2005 09:49:25 -0000	1.41.2.1
+++ addressbook/e-book-backend-exchange.c	21 Oct 2005 09:30:43 -0000
@@ -2297,28 +2297,18 @@ e_book_backend_exchange_remove (EBookBac
 	d(printf("ebbe_remove(%p, %p)\n", backend, book));
 	uri = e_folder_exchange_get_internal_uri (bepriv->folder);
 	result = exchange_account_remove_folder (bepriv->account, uri);
-	return GNOME_Evolution_Addressbook_Success;
-	/* FIXME: Folder deletion from contacts view */
-#if 0 
-	EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
-	E2kHTTPStatus status;
-
-	/*
-	char *path;
-	path = strstr (be->priv->exchange_uri, "://");
-	if (path)
-		path = strchr (path + 3, '/');
-	status = exchange_account_remove_folder (be->priv->account, path);
-	g_free (path);
-	 */
-	status = e_folder_exchange_delete (be->priv->folder, NULL);
-	if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status))
-		return GNOME_Evolution_Addressbook_Success;
-	else if (status == E2K_HTTP_UNAUTHORIZED)
-		return GNOME_Evolution_Addressbook_PermissionDenied;
-	else
+	if (result == EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR)
 		return GNOME_Evolution_Addressbook_OtherError;
-#endif
+	if (result == EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST)
+		return GNOME_Evolution_Addressbook_NoSuchBook;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_UNSUPPORTED_OPERATION)
+		return GNOME_Evolution_Addressbook_PermissionDenied;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_OFFLINE)
+		return GNOME_Evolution_Addressbook_OfflineUnavailable;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED)
+		return GNOME_Evolution_Addressbook_PermissionDenied;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_OK)
+		return GNOME_Evolution_Addressbook_Success;
 }
 
 static char *
Index: calendar/e-cal-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.c,v
retrieving revision 1.42
diff -u -p -u -p -r1.42 e-cal-backend-exchange.c
--- calendar/e-cal-backend-exchange.c	27 Aug 2005 13:04:06 -0000	1.42
+++ calendar/e-cal-backend-exchange.c	21 Oct 2005 09:30:44 -0000
@@ -393,7 +393,18 @@ remove_calendar (ECalBackendSync *backen
 	/* FIXME: Deleting calendar/tasks from respective views */
 	uri = e_folder_exchange_get_internal_uri (cbex->folder);
 	result = exchange_account_remove_folder (cbex->account, uri);
-	return GNOME_Evolution_Calendar_Success;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR)
+		return GNOME_Evolution_Calendar_OtherError;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST)
+		return GNOME_Evolution_Calendar_NoSuchCal;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_UNSUPPORTED_OPERATION)
+		return GNOME_Evolution_Calendar_PermissionDenied;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_OFFLINE)
+		return GNOME_Evolution_Calendar_OfflineUnavailable;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED)
+		return GNOME_Evolution_Calendar_PermissionDenied;
+	if (result == EXCHANGE_ACCOUNT_FOLDER_OK)
+		return GNOME_Evolution_Calendar_Success;
 
 	/* status = e_folder_exchange_delete (cbex->folder, NULL);
 	if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
Index: mail/mail-stub-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/mail/mail-stub-exchange.c,v
retrieving revision 1.29.2.1
diff -u -p -u -p -r1.29.2.1 mail-stub-exchange.c
--- mail/mail-stub-exchange.c	28 Sep 2005 11:01:58 -0000	1.29.2.1
+++ mail/mail-stub-exchange.c	21 Oct 2005 09:30:46 -0000
@@ -2546,7 +2546,8 @@ delete_folder (MailStub *stub, const cha
 		g_hash_table_remove (mse->folders_by_name, folder_name);
 		break;
 
-	case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
+	case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED: /* Fall through */
+	case EXCHANGE_ACCOUNT_FOLDER_UNSUPPORTED_OPERATION:
 		mail_stub_return_error (stub, _("Permission denied"));
 		g_object_unref (folder);
 		return;


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