[evolution-kolab/ek-wip-porting] CamelIMAPXExtdStore, CamelKolabIMAPXStore: assertion fixes



commit 679c95c95b67dc6e421b2ab34a876db284b71e4a
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Wed Jan 18 12:54:57 2012 +0100

    CamelIMAPXExtdStore, CamelKolabIMAPXStore: assertion fixes
    
    * SASL authentication mechanism may be NULL in
      authenticate_sync() if SASL is not used, removed
      assertion of non-NULL
    * trash folders and junk folders are created directly
      from CamelStore, so we cannot assert our own types
      here. If we need to, we need to change the types
      of the live objects locally

 src/camel/camel-kolab-imapx-store.c                |   19 ++++++++++++++++---
 src/camel/providers/imapx/camel-imapx-extd-store.c |   17 +++++++++++++++--
 2 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/src/camel/camel-kolab-imapx-store.c b/src/camel/camel-kolab-imapx-store.c
index a2962ab..26aba70 100644
--- a/src/camel/camel-kolab-imapx-store.c
+++ b/src/camel/camel-kolab-imapx-store.c
@@ -345,7 +345,7 @@ kolab_imapx_store_authenticate_sync (CamelService *service,
 	CamelAuthenticationResult result = CAMEL_AUTHENTICATION_ERROR;
 
 	g_assert (CAMEL_IS_SERVICE (service));
-	g_assert (mechanism != NULL); /* FIXME correct? */
+	/* mechanism may be NULL */
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, CAMEL_AUTHENTICATION_ERROR);
 
@@ -469,9 +469,17 @@ kolab_imapx_store_get_junk_folder_sync (CamelStore *self,
 	folder = parent_store_class->get_junk_folder_sync (self,
 	                                                   cancellable,
 	                                                   err);
+	/* CamelIMAPXFolder gets the junk folder from
+	 * its parent class, CamelFolder, and does not
+	 * change it to a CamelIMAPXFolder. That means,
+	 * if we really need a CamelKolabIMAPXFolder
+	 * here, we need to clone the CamelFolder into
+	 * a locally created instance
+	 */
+#if 0
 	if (folder != NULL)
 		g_assert (CAMEL_IS_KOLAB_IMAPX_FOLDER (folder));
-
+#endif
 	return folder;
 }
 
@@ -489,9 +497,14 @@ kolab_imapx_store_get_trash_folder_sync (CamelStore *self,
 	folder = parent_store_class->get_trash_folder_sync (self,
 	                                                    cancellable,
 	                                                    err);
+	/* see kolab_imapx_store_get_junk_folder_sync()
+	 * why we do not have a CamelIMAPXExtdFolder
+	 * here
+	 */
+#if 0
 	if (folder != NULL)
 		g_assert (CAMEL_IS_KOLAB_IMAPX_FOLDER (folder));
-
+#endif
 	return folder;
 }
 
diff --git a/src/camel/providers/imapx/camel-imapx-extd-store.c b/src/camel/providers/imapx/camel-imapx-extd-store.c
index 0f1ad26..97e472b 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-store.c
+++ b/src/camel/providers/imapx/camel-imapx-extd-store.c
@@ -262,9 +262,17 @@ imapx_extd_store_get_junk_folder_sync (CamelStore *self,
 	folder = parent_store_class->get_junk_folder_sync (self,
 	                                                   cancellable,
 	                                                   err);
+	/* CamelIMAPXFolder gets the junk folder from
+	 * its parent class, CamelFolder, and does not
+	 * change it to a CamelIMAPXFolder. That means,
+	 * if we really need a CamelIMAPXExtdFolder
+	 * here, we need to clone the CamelFolder into
+	 * a locally created instance
+	 */
+#if 0
 	if (folder != NULL)
 		g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
-
+#endif
 	return folder;
 }
 
@@ -282,9 +290,14 @@ imapx_extd_store_get_trash_folder_sync (CamelStore *self,
 	folder = parent_store_class->get_trash_folder_sync (self,
 	                                                    cancellable,
 	                                                    err);
+	/* see imapx_extd_store_get_junk_folder_sync()
+	 * why we do not have a CamelIMAPXExtdFolder
+	 * here
+	 */
+#if 0
 	if (folder != NULL)
 		g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
-
+#endif
 	return folder;
 }
 



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