[evolution-kolab] EPlugin: changed ACL removal handling



commit c0b2e36c249f76b64a0f52979beea1dc6cc2ae96
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue Oct 16 12:14:41 2012 +0200

    EPlugin: changed ACL removal handling
    
    * instead of removing a CamelImapxAclEntry from
      the GList in the "Remove" action, we set it's
      rights string to NULL so we can generate a
      DELETEACL command for the access_id in question

 src/eplugin/e-kolab-folder-permissions.c |   38 ++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/src/eplugin/e-kolab-folder-permissions.c b/src/eplugin/e-kolab-folder-permissions.c
index 227a3da..02e933e 100644
--- a/src/eplugin/e-kolab-folder-permissions.c
+++ b/src/eplugin/e-kolab-folder-permissions.c
@@ -426,6 +426,8 @@ kolab_folder_permissions_ui_update_treeview (KolabFolderPermUIData *uidata)
 		entry = (CamelImapxAclEntry *) acl_ptr->data;
 		if (entry == NULL)
 			goto skip;
+		if (entry->rights == NULL)
+			goto skip;
 
 		access_id = entry->access_id;
 		rights = entry->rights;
@@ -748,6 +750,7 @@ kolab_folder_permissions_ui_edit_dialog_cb (KolabFolderPermUIData *uidata)
 static void
 kolab_folder_permissions_ui_acl_remove_cb (KolabFolderPermUIData *uidata)
 {
+	CamelImapxAclEntry *entry = NULL;
 	gchar *access_id = NULL;
 	gchar *rights = NULL;
 	GError *tmp_err = NULL;
@@ -762,23 +765,34 @@ kolab_folder_permissions_ui_acl_remove_cb (KolabFolderPermUIData *uidata)
 	if (! ok)
 		return;
 
-	ok = camel_imapx_acl_list_remove_entry (&(uidata->permissions->acl),
-	                                        access_id,
-	                                        &tmp_err);
-	if (tmp_err != NULL) {
-		g_warning ("%s()[%u] %s",
-		           __func__, __LINE__, tmp_err->message);
-		g_error_free (tmp_err);
-	}
+	entry = camel_imapx_acl_entry_new (access_id, NULL, &tmp_err);
 
-	g_free (access_id);
+	if (access_id != NULL)
+		g_free (access_id);
 	if (rights != NULL)
 		g_free (rights);
 
+	if (entry == NULL)
+		goto exit;
+
+	ok = camel_imapx_acl_list_update_from_entry (&(uidata->permissions->acl),
+	                                             entry,
+	                                             &tmp_err);
+	camel_imapx_acl_entry_free (entry);
+
+	if (! ok)
+		goto exit;
+
 	/* update treeview */
-	if (ok) {
-		kolab_folder_permissions_ui_update_treeview (uidata);
-		uidata->changed = TRUE;
+	kolab_folder_permissions_ui_update_treeview (uidata);
+	uidata->changed = TRUE;
+
+ exit:
+
+	if (tmp_err != NULL) {
+		g_warning ("%s()[%u] %s",
+		           __func__, __LINE__, tmp_err->message);
+		g_error_free (tmp_err);
 	}
 }
 



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