[evolution-kolab/ek-wip-porting] CamelKolabIMAPXStore: handle missing server metadata protocol info more gracefully



commit e72d5593f2bab9b5c944d49157e807d7580ad6b6
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Fri Jul 13 18:08:51 2012 +0200

    CamelKolabIMAPXStore: handle missing server metadata protocol info more gracefully

 src/libekolab/camel-kolab-imapx-store.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/libekolab/camel-kolab-imapx-store.c b/src/libekolab/camel-kolab-imapx-store.c
index 2ab10bf..8911fb8 100644
--- a/src/libekolab/camel-kolab-imapx-store.c
+++ b/src/libekolab/camel-kolab-imapx-store.c
@@ -277,6 +277,12 @@ imapx_store_get_foldertype (CamelKolabIMAPXStore *self,
 
 	/* if not in sqlite db: issue IMAP query */
 	proto = camel_imapx_extd_store_metadata_get_proto (es);
+	if (proto == CAMEL_IMAPX_METADATA_PROTO_INVAL) {
+		g_warning ("%s: could not determine server metadata protocol type",
+		           __func__);
+		return KOLAB_FOLDER_TYPE_UNKNOWN;
+	}
+
 	spec = camel_imapx_metadata_spec_new (proto,
 	                                      foldername,
 	                                      "/vendor/kolab/folder-type",
@@ -370,6 +376,15 @@ imapx_store_set_foldertype (CamelKolabIMAPXStore *self,
 		return FALSE;
 	}
 
+	proto = camel_imapx_extd_store_metadata_get_proto (es);
+	if (proto == CAMEL_IMAPX_METADATA_PROTO_INVAL) {
+		g_set_error (err,
+		             KOLAB_CAMEL_KOLAB_ERROR,
+		             KOLAB_CAMEL_KOLAB_ERROR_SERVER,
+		             "Could not determine server metadata protocol type");
+		return FALSE;
+	}
+
 	/* create local CamelImapxMetadata for setting type */
 	acc = CAMEL_IMAPX_METADATA_ACCESS_SHARED;
 	ma = camel_imapx_metadata_attrib_new ();
@@ -387,7 +402,6 @@ imapx_store_set_foldertype (CamelKolabIMAPXStore *self,
 	g_hash_table_insert (man->entries,
 	                     g_strdup ("/vendor/kolab/folder-type"),
 	                     me);
-	proto = camel_imapx_extd_store_metadata_get_proto (es);
 	md = camel_imapx_metadata_new (proto, FALSE);
 	g_hash_table_insert (md->mboxes,
 	                     g_strdup (foldername),



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