[evolution-kolab] KolabDataFolderPermissions: initial implementation



commit f4baf96584101e73958ee7e74f79324709f10b0c
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue Oct 2 15:36:55 2012 +0200

    KolabDataFolderPermissions: initial implementation
    
    * replaced stub implementation by real one
    * we handle ACL as a list of CamelImapxAclEntry instances
    * MYRIGHTS is a simple string, which should be manipulated
      and validated using camel_imapx_acl_*() functions

 src/libekolab/kolab-data-folder-permissions.c |   26 ++++++++++++++++++++----
 src/libekolab/kolab-data-folder-permissions.h |    6 +++-
 2 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/src/libekolab/kolab-data-folder-permissions.c b/src/libekolab/kolab-data-folder-permissions.c
index 7f46a58..0f2d05a 100644
--- a/src/libekolab/kolab-data-folder-permissions.c
+++ b/src/libekolab/kolab-data-folder-permissions.c
@@ -26,6 +26,8 @@
 
 /*----------------------------------------------------------------------------*/
 
+#include "camel-imapx-acl.h"
+
 #include "kolab-data-folder-permissions.h"
 
 /*----------------------------------------------------------------------------*/
@@ -34,23 +36,35 @@ KolabDataFolderPermissions*
 kolab_data_folder_permissions_new (void)
 {
 	KolabDataFolderPermissions *data = NULL;
+
 	data = g_new0 (KolabDataFolderPermissions, 1);
-	/* FIXME set field defaults */
+	data->acl = NULL;
+	data->myrights = NULL;
+
 	return data;
 }
 
 KolabDataFolderPermissions*
-kolab_data_folder_permissions_clone (const KolabDataFolderPermissions *srcdata)
+kolab_data_folder_permissions_clone (const KolabDataFolderPermissions *srcdata,
+                                     GError **err)
 {
 	KolabDataFolderPermissions *data = NULL;
+	GError *tmp_err = NULL;
 
 	if (srcdata == NULL)
 		return NULL;
 
 	data = g_new0 (KolabDataFolderPermissions, 1);
 
-	/* FIXME set fields from srcdata */
-	data->foo = srcdata->foo;
+	data->acl = camel_imapx_acl_clone_list (srcdata->acl,
+	                                        &tmp_err);
+	if (tmp_err != NULL) {
+		g_propagate_error (err, tmp_err);
+		g_free (data);
+		return NULL;
+	}
+
+	data->myrights = g_strdup (srcdata->myrights);
 
 	return data;
 }
@@ -60,7 +74,9 @@ kolab_data_folder_permissions_free (KolabDataFolderPermissions *data)
 {
 	if (data == NULL)
 		return;
-	/* FIXME free fields */
+
+	camel_imapx_acl_free_list (data->acl);
+	g_free (data->myrights);
 	g_free (data);
 }
 
diff --git a/src/libekolab/kolab-data-folder-permissions.h b/src/libekolab/kolab-data-folder-permissions.h
index 4d901ba..ac6cb6e 100644
--- a/src/libekolab/kolab-data-folder-permissions.h
+++ b/src/libekolab/kolab-data-folder-permissions.h
@@ -37,7 +37,8 @@
 
 typedef struct _KolabDataFolderPermissions KolabDataFolderPermissions;
 struct _KolabDataFolderPermissions {
-	gboolean foo; /* FIXME */
+	GList *acl;
+	gchar *myrights;
 };
 
 /*----------------------------------------------------------------------------*/
@@ -46,7 +47,8 @@ KolabDataFolderPermissions*
 kolab_data_folder_permissions_new (void);
 
 KolabDataFolderPermissions*
-kolab_data_folder_permissions_clone (const KolabDataFolderPermissions *srcdata);
+kolab_data_folder_permissions_clone (const KolabDataFolderPermissions *srcdata,
+                                     GError **err);
 
 void
 kolab_data_folder_permissions_free (KolabDataFolderPermissions *data);



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