[evolution-patches] 57114, camel trash problems in connector



camel-exchange-store overrides get_trash() to return the non-virtual
"Deleted Items" folder, since that's where deleted messages go in
Exchange (and we need to override camel_store_get_trash in order for the
"Empty Trash" command to work). This makes that work again. (It also
changes get_junk to match, although we don't currently override that.)

This changes the semantics of overriding get_trash/get_junk, but it
doesn't look like it matters for any of the classes that do override it,
besides CamelExchangeStore, so I'm pretty sure that all the same locking
happens the same way with this patch as before, but the calls just
happen in different places.


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2146
diff -u -w -r1.2146 ChangeLog
--- ChangeLog	24 May 2004 08:02:10 -0000	1.2146
+++ ChangeLog	25 May 2004 17:48:47 -0000
@@ -1,3 +1,15 @@
+2004-05-25  Dan Winship  <danw novell com>
+
+	* camel-store.c (camel_store_get_trash): Make this just invoke the
+	virtual method. (In particular, don't assume that the trash
+	folder's name is CAMEL_VTRASH_NAME). #57114
+	(get_trash): Do all the real work here.
+	(camel_store_get_junk, get_junk): Likewise.
+	(camel_store_get_folder): when fetching the vtrash or vjunk
+	folder, just fall back to the get_vtrash() or get_vjunk() method
+	without doing anything else (since they do their own object bag
+	handling now).
+
 2004-05-24  Not Zed  <NotZed Ximian com>
 
 	* camel-mime-utils.c (camel_header_newsgroups_decode):
Index: camel-store.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-store.c,v
retrieving revision 1.151
diff -u -w -r1.151 camel-store.c
--- camel-store.c	22 May 2004 01:37:22 -0000	1.151
+++ camel-store.c	25 May 2004 17:48:47 -0000
@@ -233,6 +233,13 @@
 	
 	g_return_val_if_fail (folder_name != NULL, NULL);
 	
+	/* Handle special folders specially */
+	if ((store->flags & CAMEL_STORE_VTRASH) && strcmp(folder_name, CAMEL_VTRASH_NAME) == 0) {
+		return CS_CLASS(store)->get_trash(store, ex);
+	} else if ((store->flags & CAMEL_STORE_VJUNK) && strcmp(folder_name, CAMEL_VJUNK_NAME) == 0) {
+		return CS_CLASS(store)->get_junk(store, ex);
+	}
+
 	/* O_EXCL doesn't make sense if we aren't requesting to also create the folder if it doesn't exist */
 	if (!(flags & CAMEL_STORE_FOLDER_CREATE))
 		flags &= ~CAMEL_STORE_FOLDER_EXCL;
@@ -251,11 +258,6 @@
 	}
 	
 	if (!folder) {
-		if ((store->flags & CAMEL_STORE_VTRASH) && strcmp(folder_name, CAMEL_VTRASH_NAME) == 0) {
-			folder = CS_CLASS(store)->get_trash(store, ex);
-		} else if ((store->flags & CAMEL_STORE_VJUNK) && strcmp(folder_name, CAMEL_VJUNK_NAME) == 0) {
-			folder = CS_CLASS(store)->get_junk(store, ex);
-		} else {
 			folder = CS_CLASS (store)->get_folder(store, folder_name, flags, ex);
 			if (folder) {
 				CamelVeeFolder *vfolder;
@@ -283,7 +285,6 @@
 
 		if (folder)
 			camel_object_trigger_event(store, "folder_opened", folder);
-	}
 
 	return folder;
 }
@@ -569,37 +570,15 @@
 static CamelFolder *
 get_trash(CamelStore *store, CamelException *ex)
 {
-	return get_special(store, CAMEL_VTRASH_FOLDER_TRASH);
-}
-
-static CamelFolder *
-get_junk(CamelStore *store, CamelException *ex)
-{
-	return get_special(store, CAMEL_VTRASH_FOLDER_JUNK);
-}
-
-/** 
- * camel_store_get_trash:
- * @store: a CamelStore
- * @ex: a CamelException
- *
- * Return value: the folder in the store into which trash is
- * delivered, or %NULL if no such folder exists.
- **/
-CamelFolder *
-camel_store_get_trash (CamelStore *store, CamelException *ex)
-{
 	CamelFolder *folder;
 
-	/* TODO: This is quite redundant, since get_folder(CAMEL_VTRASH_NAME) does the same */
-
 	if ((store->flags & CAMEL_STORE_VTRASH) == 0
 	    || store->folders == NULL)
 		return NULL;
 
 	folder = camel_object_bag_reserve(store->folders, CAMEL_VTRASH_NAME);
 	if (!folder) {
-		folder = CS_CLASS(store)->get_trash(store, ex);
+		folder = get_special(store, CAMEL_VTRASH_FOLDER_TRASH);
 
 		if (folder) {
 			camel_object_bag_add(store->folders, CAMEL_VTRASH_NAME, folder);
@@ -612,19 +591,25 @@
 }
 
 /** 
- * camel_store_get_junk:
+ * camel_store_get_trash:
  * @store: a CamelStore
  * @ex: a CamelException
  *
- * Return value: the folder in the store into which junk is
+ * Return value: the folder in the store into which trash is
  * delivered, or %NULL if no such folder exists.
  **/
 CamelFolder *
-camel_store_get_junk (CamelStore *store, CamelException *ex)
+camel_store_get_trash (CamelStore *store, CamelException *ex)
 {
-	CamelFolder *folder;
+	g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
 
-	/* TODO: This is quite redundant, since get_folder(CAMEL_VJUNK_NAME) does the same */
+	return CS_CLASS(store)->get_trash(store, ex);
+}
+
+static CamelFolder *
+get_junk(CamelStore *store, CamelException *ex)
+{
+	CamelFolder *folder;
 
 	if ((store->flags & CAMEL_STORE_VJUNK) == 0
 	    || store->folders == NULL)
@@ -632,7 +617,7 @@
 
 	folder = camel_object_bag_reserve(store->folders, CAMEL_VJUNK_NAME);
 	if (!folder) {
-		folder = CS_CLASS(store)->get_junk(store, ex);
+		folder = get_special(store, CAMEL_VTRASH_FOLDER_JUNK);
 
 		if (folder) {
 			camel_object_bag_add(store->folders, CAMEL_VJUNK_NAME, folder);
@@ -642,6 +627,22 @@
 	}
 	
 	return folder;
+}
+
+/** 
+ * camel_store_get_junk:
+ * @store: a CamelStore
+ * @ex: a CamelException
+ *
+ * Return value: the folder in the store into which junk is
+ * delivered, or %NULL if no such folder exists.
+ **/
+CamelFolder *
+camel_store_get_junk (CamelStore *store, CamelException *ex)
+{
+	g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
+
+	return CS_CLASS(store)->get_junk(store, ex);
 }
 
 static void
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.30
diff -u -r1.30 ChangeLog
--- ChangeLog	25 May 2004 13:19:12 -0000	1.30
+++ ChangeLog	25 May 2004 17:49:01 -0000
@@ -1,3 +1,9 @@
+2004-05-25  Dan Winship  <danw novell com>
+
+	* camel/camel-exchange-store.c (get_trash): Update to match the
+	camel changes for #57114. (Call camel_store_get_folder() rather
+	than using the virtual method directly.)
+
 2004-05-25  Nicel KM  <mnicel novell com>
 
 	* calendar/e-cal-backend-exchange.c (get_object_list):
Index: camel/camel-exchange-store.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-store.c,v
retrieving revision 1.2
diff -u -r1.2 camel-exchange-store.c
--- camel/camel-exchange-store.c	21 May 2004 18:42:08 -0000	1.2
+++ camel/camel-exchange-store.c	25 May 2004 17:49:01 -0000
@@ -304,7 +304,7 @@
 			return NULL;
 	}
 
-	return CS_CLASS (store)->get_folder (store, exch->trash_name, 0, ex);
+	return camel_store_get_folder (store, exch->trash_name, 0, ex);
 }
 
 /* Note: steals @name and @uri */


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