[evolution-kolab] CamelImapxAcl: function for entry removal from list representation
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] CamelImapxAcl: function for entry removal from list representation
- Date: Mon, 15 Oct 2012 18:18:36 +0000 (UTC)
commit 4e2b72bb6cdc973b60c32384864349b753c82e80
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Oct 15 14:42:53 2012 +0200
CamelImapxAcl: function for entry removal from list representation
* new function for removing a CamelImapxAclEntry
from an ACL in GList representation
src/libekolab/camel-imapx-acl.c | 46 +++++++++++++++++++++++++++++++++++++++
src/libekolab/camel-imapx-acl.h | 5 ++++
2 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/src/libekolab/camel-imapx-acl.c b/src/libekolab/camel-imapx-acl.c
index e1642cb..31205ab 100644
--- a/src/libekolab/camel-imapx-acl.c
+++ b/src/libekolab/camel-imapx-acl.c
@@ -986,6 +986,52 @@ camel_imapx_acl_list_get_rights (const GList *entries,
}
gboolean
+camel_imapx_acl_list_remove_entry (GList **entries,
+ const gchar *access_id,
+ GError **err)
+{
+ CamelImapxAclEntry *entry = NULL;
+ GList *entries_ptr = NULL;
+ GError *tmp_err = NULL;
+ gboolean ok = FALSE;
+ gboolean found = FALSE;
+
+ g_return_val_if_fail (entries != NULL, FALSE);
+ g_return_val_if_fail (access_id != NULL, FALSE);
+ g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+ ok = imapx_acl_entry_validate_access_id (access_id, &tmp_err);
+ if (! ok) {
+ g_propagate_error (err, tmp_err);
+ return FALSE;
+ }
+
+ entries_ptr = *entries;
+ while (entries_ptr != NULL) {
+ entry = (CamelImapxAclEntry *) (entries_ptr->data);
+ if (entry == NULL || entry->access_id == NULL) {
+ g_warning ("%s()[%u] Invalid CamelImapxAclEntry, skipping",
+ __func__, __LINE__);
+ continue;
+ }
+
+ if (g_strcmp0 (entry->access_id, access_id) == 0) {
+ found = TRUE;
+ break;
+ }
+
+ entries_ptr = g_list_next (entries_ptr);
+ }
+
+ if (found) {
+ *entries = g_list_delete_link (*entries,
+ entries_ptr);
+ }
+
+ return found;
+}
+
+gboolean
camel_imapx_acl_list_update_from_entry (GList **entries,
const CamelImapxAclEntry *entry,
GError **err)
diff --git a/src/libekolab/camel-imapx-acl.h b/src/libekolab/camel-imapx-acl.h
index a0a1e99..0e8eca4 100644
--- a/src/libekolab/camel-imapx-acl.h
+++ b/src/libekolab/camel-imapx-acl.h
@@ -146,6 +146,11 @@ camel_imapx_acl_list_get_rights (const GList *entries,
GError **err);
gboolean
+camel_imapx_acl_list_remove_entry (GList **entries,
+ const gchar *access_id,
+ GError **err);
+
+gboolean
camel_imapx_acl_list_update_from_entry (GList **entries,
const CamelImapxAclEntry *entry,
GError **err);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]