[evolution-kolab] KolabMailAccess: implemented folder existence check



commit 2b6e3d593741c4cd927513f38aa095a420b4f5c6
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Wed Sep 19 19:12:26 2012 +0200

    KolabMailAccess: implemented folder existence check

 src/libekolab/kolab-mail-imap-client.c |   36 +++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-imap-client.c b/src/libekolab/kolab-mail-imap-client.c
index f94e83e..e067db5 100644
--- a/src/libekolab/kolab-mail-imap-client.c
+++ b/src/libekolab/kolab-mail-imap-client.c
@@ -630,8 +630,8 @@ mail_imap_client_update_folder (KolabMailImapClient *self,
 
 static GList*
 mail_imap_client_query_foldernames (KolabMailImapClient *self,
-                                    GCancellable *cancellable,
                                     gboolean do_updatedb,
+                                    GCancellable *cancellable,
                                     GError **err)
 {
 	KolabMailImapClientPrivate *priv = NULL;
@@ -1438,8 +1438,8 @@ kolab_mail_imap_client_query_foldernames (KolabMailImapClient *self,
 	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
 
 	folder_list = mail_imap_client_query_foldernames (self,
-	                                                  cancellable,
 	                                                  TRUE, /* update SQlite DBs */
+	                                                  cancellable,
 	                                                  err);
 	return folder_list;
 }
@@ -1509,8 +1509,8 @@ kolab_mail_imap_client_query_folder_info_online (KolabMailImapClient *self,
 	}
 
 	folder_names = mail_imap_client_query_foldernames (self,
-	                                                   cancellable,
 	                                                   FALSE, /* do not update DBs */
+	                                                   cancellable,
 	                                                   &tmp_err);
 	if (tmp_err != NULL) {
 		g_propagate_error (err, tmp_err);
@@ -1717,7 +1717,8 @@ kolab_mail_imap_client_delete_folder (KolabMailImapClient *self,
 
 	g_assert (priv->is_up == TRUE);
 
-	/* TODO implement me */
+	/* FIXME */
+	g_warning ("%s()[%u] FIXME implement me", __func__, __LINE__);
 
 	return TRUE;
 }
@@ -1729,19 +1730,40 @@ kolab_mail_imap_client_exists_folder (KolabMailImapClient *self,
                                       GError **err)
 {
 	KolabMailImapClientPrivate *priv = NULL;
+	GList *folders = NULL;
+	GList *folders_ptr = NULL;
+	GError *tmp_err = NULL;
+	gboolean exists = FALSE;
 
 	g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
 	g_assert (foldername != NULL);
-	(void)cancellable; /* FIXME */ /* cancellable may be NULL */
+	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
 	priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self);
 
 	g_assert (priv->is_up == TRUE);
 
-	/* TODO implement me */
+	folders = mail_imap_client_query_foldernames (self,
+	                                              FALSE,
+	                                              cancellable,
+	                                              &tmp_err);
+	if (tmp_err != NULL) {
+		g_propagate_error (err, tmp_err);
+		return FALSE;
+	}
 
-	return TRUE;
+	folders_ptr = folders;
+	while (folders_ptr != NULL) {
+		exists = g_str_equal (folders_ptr->data, foldername);
+		if (exists)
+			break;
+		folders_ptr = g_list_next (folders_ptr);
+	}
+
+	kolab_util_glib_glist_free (folders);
+
+	return exists;
 }
 
 /*----------------------------------------------------------------------------*/



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