[evolution-kolab] KolabMailImapClient: make kolab_mail_imap_client_query_folder_info_online() work



commit ce477bcf5176e80a02c2bb7f62c15a81796db0ea
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Thu Aug 16 17:39:45 2012 +0200

    KolabMailImapClient: make kolab_mail_imap_client_query_folder_info_online() work
    
    * this function falsely returned NULL always
    * incorporating the changes of the previous
      commits, it now returns a list of all
      folders on the Kolab server (along with
      folder type), regardless of the folder
      context configured for the KolabMailImapClient
      instance
    * if we cannot determine the type of a given
      folder, instead of not returning the folder
      or setting the type to KOLAB_FOLDER_TYPE_INVAL,
      we _do_ return the folder and set it's type
      to KOLAB_FOLDER_TYPE_UNKNOWN
    * (the Kolab convention for handling folders of
      unknown type is to assume they contain email,
      not PIM data)

 src/libekolab/kolab-mail-imap-client.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-imap-client.c b/src/libekolab/kolab-mail-imap-client.c
index 93773da..d94f826 100644
--- a/src/libekolab/kolab-mail-imap-client.c
+++ b/src/libekolab/kolab-mail-imap-client.c
@@ -664,6 +664,7 @@ mail_imap_client_query_foldernames (KolabMailImapClient *self,
 		                                                     cancellable,
 		                                                     &tmp_err);
 	}
+
 	if (tmp_err != NULL) {
 		g_propagate_error (err, tmp_err);
 		return NULL;
@@ -672,9 +673,14 @@ mail_imap_client_query_foldernames (KolabMailImapClient *self,
 	if (fi == NULL)
 		return NULL;
 
+	if (do_updatedb) {
+		folder_list = camel_kolab_imapx_store_resect_folder_list (priv->store);
+	} else {
+		folder_list = kolab_util_camel_folderlist_from_folderinfo (fi);
+	}
+	
 	camel_store_free_folder_info (CAMEL_STORE (priv->store), fi);
 
-	folder_list = camel_kolab_imapx_store_resect_folder_list (priv->store);
 	return folder_list;
 }
 
@@ -1157,14 +1163,17 @@ kolab_mail_imap_client_query_folder_info_online (KolabMailImapClient *self,
 	while (folder_names_ptr != NULL) {
 		gchar *foldername = (gchar*) folder_names_ptr->data;
 		KolabFolderDescriptor *desc = NULL;
-		KolabFolderTypeID type_id = KOLAB_FOLDER_TYPE_INVAL;
+		KolabFolderTypeID type_id = KOLAB_FOLDER_TYPE_UNKNOWN;
 		type_id = kolab_mail_imap_client_get_folder_type (self,
 		                                                  foldername,
 		                                                  FALSE, /* do not update DBs */
 		                                                  cancellable,
 		                                                  &tmp_err);
-		if (tmp_err != NULL)
-			break;
+		if (tmp_err != NULL) {
+			g_debug ("%s()[%i]: %s", __func__, __LINE__, tmp_err->message);
+			g_error_free (tmp_err);
+			tmp_err = NULL;
+		}
 
 		desc = kolab_util_folder_descriptor_new (foldername,
 		                                         type_id);



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