[evolution-mapi] Bug #617509 - File->Empty trash doesn't expunge Deleted items



commit 4add02b45f02812527e7ff7311a80e6205e93198
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 3 16:49:54 2010 +0200

    Bug #617509 - File->Empty trash doesn't expunge Deleted items

 src/camel/camel-mapi-store.c |   53 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index ca175d4..135bdf5 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -100,6 +100,7 @@ static gboolean		mapi_unsubscribe_folder(CamelStore *, const gchar *, CamelExcep
 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);
+static CamelFolder *mapi_get_trash (CamelStore *store, CamelException *ex);
 
 static void mapi_update_folder_hash_tables (CamelMapiStore *store, const gchar *name, const gchar *fid, const gchar *parent_id);
 /* static const gchar * mapi_folders_hash_table_name_lookup (CamelMapiStore *store, const gchar *fid, gboolean use_cache); */
@@ -233,6 +234,7 @@ camel_mapi_store_class_init (CamelMapiStoreClass *class)
 	store_class->folder_subscribed = mapi_folder_subscribed;
 	store_class->unsubscribe_folder = mapi_unsubscribe_folder;
 	store_class->noop = mapi_noop;
+	store_class->get_trash = mapi_get_trash;
 }
 
 /*
@@ -1743,3 +1745,54 @@ camel_mapi_store_get_exchange_connection (CamelMapiStore *mapi_store)
 
 	return mapi_store->priv->conn;
 }
+
+static CamelFolder *
+mapi_get_folder_with_type (CamelStore *store, guint folder_type, CamelException *ex)
+{
+	CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (store);
+	CamelFolderInfo *all_fi, *fi;
+	CamelFolder *folder = NULL;
+
+	g_return_val_if_fail (mapi_store != NULL, NULL);
+	g_return_val_if_fail (mapi_store->priv != NULL, NULL);
+
+	all_fi = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE, ex);
+	fi = all_fi;
+	while (fi) {
+		CamelFolderInfo *next;
+
+		if ((fi->flags & CAMEL_FOLDER_TYPE_MASK) == folder_type) {
+			folder = camel_store_get_folder (store, fi->full_name, 0, ex);
+			break;
+		}
+
+		/* move to the next, depth-first search */
+		next = fi->child;
+		if (!next)
+			next = fi->next;
+		if (!next) {
+			next = fi->parent;
+			while (next) {
+				CamelFolderInfo *sibl = next->next;
+				if (sibl) {
+					next = sibl;
+					break;
+				} else {
+					next = next->parent;
+				}
+			}
+		}
+
+		fi = next;
+	}
+
+	camel_store_free_folder_info (store, all_fi);
+
+	return folder;
+}
+
+static CamelFolder *
+mapi_get_trash (CamelStore *store, CamelException *ex)
+{
+	return mapi_get_folder_with_type (store, CAMEL_FOLDER_TYPE_TRASH, ex);
+}



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