[evolution-kolab] CamelIMAPXExtdStore: adapt to camel-imapx-acl API change



commit 0dfcf745ed817f8a1c748ca61eba16b1d504f0be
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue Oct 16 15:32:16 2012 +0200

    CamelIMAPXExtdStore: adapt to camel-imapx-acl API change
    
    * API change: expecting foldername and GList
      of CamelImapxAclEntry instances instead of
      a CamelImapxAcl instance in the ACL setter
      function now
    * moved the IMAPX token definitions to
      camel-imapx-acl.h

 src/libekolab/camel-imapx-extd-server-acl.c |   27 +++++++++++++++++----------
 src/libekolab/camel-imapx-extd-server-acl.h |   12 ++----------
 2 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/src/libekolab/camel-imapx-extd-server-acl.c b/src/libekolab/camel-imapx-extd-server-acl.c
index d79c616..e2336f2 100644
--- a/src/libekolab/camel-imapx-extd-server-acl.c
+++ b/src/libekolab/camel-imapx-extd-server-acl.c
@@ -35,6 +35,7 @@
 #include "camel-imapx-extd-store-friend.h"
 #include "camel-imapx-extd-server.h"
 #include "camel-imapx-extd-utils.h"
+#include "camel-imapx-acl.h"
 
 #include "camel-imapx-extd-server-acl.h"
 
@@ -273,48 +274,54 @@ camel_imapx_extd_server_get_acl (CamelIMAPXServer *is,
 
 gboolean
 camel_imapx_extd_server_set_acl (CamelIMAPXServer *is,
-                                 CamelImapxAcl *acl,
+                                 const gchar *foldername,
+                                 const GList *entries,
                                  GCancellable *cancellable,
                                  GError **err)
 {
 	static GMutex setter_lock;
 	GList *commands = NULL;
-	GList *cur_cmd = NULL;
+	GList *cmd_ptr = NULL;
+	CamelImapxAclCmd *cmd = NULL;
 	GError *tmp_err = NULL;
 	gboolean ok = TRUE;
 
 	g_assert (CAMEL_IS_IMAPX_SERVER (is));
-	g_return_val_if_fail (acl != NULL, FALSE);
+	g_return_val_if_fail (foldername != NULL, FALSE);
+	g_return_val_if_fail (entries != NULL, FALSE);
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
 	g_mutex_lock (&setter_lock);
 
-	commands = camel_imapx_acl_commandlist_new (acl,
+	commands = camel_imapx_acl_commandlist_new (entries,
+	                                            foldername,
 	                                            &tmp_err);
 
 	if (commands == NULL)
 		goto exit;
 
-	cur_cmd = commands;
-	while (cur_cmd != NULL) {
-		/* TODO move SETACL string to -acl.[hc] */
+	cmd_ptr = commands;
+	while (cmd_ptr != NULL) {
+		cmd = (CamelImapxAclCmd *) (cmd_ptr->data);
 		ok = camel_imapx_extd_utils_command_run (is,
-		                                         IMAPX_IMAP_TOKEN_SETACL,
-		                                         (gchar *) cur_cmd->data,
+		                                         cmd->token,
+		                                         cmd->command,
 		                                         cancellable,
 		                                         &tmp_err);
 		if (! ok)
 			goto exit;
 
-		cur_cmd = g_list_next (cur_cmd);
+		cmd_ptr = g_list_next (cmd_ptr);
 	}
 
  exit:
+
 	if (tmp_err != NULL) {
 		g_propagate_error (err, tmp_err);
 		ok = FALSE;
 	}
+
 	if (commands != NULL)
 		camel_imapx_acl_commandlist_free (commands);
 
diff --git a/src/libekolab/camel-imapx-extd-server-acl.h b/src/libekolab/camel-imapx-extd-server-acl.h
index b6ec3e4..83838d5 100644
--- a/src/libekolab/camel-imapx-extd-server-acl.h
+++ b/src/libekolab/camel-imapx-extd-server-acl.h
@@ -36,15 +36,6 @@
 
 #include <libekolabutil/kolab-util-glib.h>
 
-#include "camel-imapx-acl.h"
-
-/*----------------------------------------------------------------------------*/
-
-#define IMAPX_IMAP_TOKEN_ACL      "ACL"
-#define IMAPX_IMAP_TOKEN_MYRIGHTS "MYRIGHTS"
-#define IMAPX_IMAP_TOKEN_SETACL   "SETACL"
-#define IMAPX_IMAP_TOKEN_GETACL   "GETACL"
-
 /*----------------------------------------------------------------------------*/
 
 KolabGConstList*
@@ -64,7 +55,8 @@ camel_imapx_extd_server_get_acl (CamelIMAPXServer *self,
 
 gboolean
 camel_imapx_extd_server_set_acl (CamelIMAPXServer *self,
-                                 CamelImapxAcl *acl,
+                                 const gchar *foldername,
+                                 const GList *entries,
                                  GCancellable *cancellable,
                                  GError **err);
 



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