[evolution-kolab] libekolabutil: new lookup array for supported ACL rights strings
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] libekolabutil: new lookup array for supported ACL rights strings
- Date: Wed, 10 Oct 2012 18:38:59 +0000 (UTC)
commit 0fbaad9c4060db0a7ebfc6bba0e2f7adaae97384
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Wed Oct 10 18:05:49 2012 +0200
libekolabutil: new lookup array for supported ACL rights strings
src/libekolabutil/kolab-util-folder.c | 30 +++++++++++++++++++++++-------
src/libekolabutil/kolab-util-folder.h | 20 ++++++++++++--------
2 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/src/libekolabutil/kolab-util-folder.c b/src/libekolabutil/kolab-util-folder.c
index 50c63d1..fe3b5ba 100644
--- a/src/libekolabutil/kolab-util-folder.c
+++ b/src/libekolabutil/kolab-util-folder.c
@@ -54,6 +54,14 @@ static gchar *kolab_folder_type_inv_map[] = {
"contact.default" /* KOLAB_FOLDER_TYPE_CONTACT_DEFAULT */
};
+static gchar *kolab_folder_perm_inv_map[] = {
+ "---NOCHANGE---", /* KOLAB_FOLDER_PERM_NOCHANGE */
+ "lrs", /* KOLAB_FOLDER_PERM_READ */
+ "lrsip", /* KOLAB_FOLDER_PERM_APPEND */
+ "lrswipte", /* KOLAB_FOLDER_PERM_WRITE */
+ "lrswipaxte" /* KOLAB_FOLDER_PERM_ALL */
+};
+
static KolabFolderTypeID kolab_folder_type_nums[KOLAB_FOLDER_LAST_TYPE];
static GHashTable *kolab_folder_type_map = NULL;
static GMutex init_lock;
@@ -76,7 +84,7 @@ util_folder_init (void)
&(kolab_folder_type_nums[ii]));
}
}
-
+
g_mutex_unlock (&init_lock);
}
@@ -95,7 +103,7 @@ kolab_util_folder_type_get_id (const gchar *typestring)
g_assert (typestring != NULL);
util_folder_init ();
-
+
map_entry = g_hash_table_lookup (kolab_folder_type_map, typestring);
if (map_entry == NULL)
@@ -111,12 +119,10 @@ kolab_util_folder_type_get_string (KolabFolderTypeID foldertype)
g_assert (foldertype < KOLAB_FOLDER_LAST_TYPE);
util_folder_init ();
-
+
return kolab_folder_type_inv_map[foldertype];
}
-/*----------------------------------------------------------------------------*/
-
KolabFolderContextID
kolab_util_folder_type_map_to_context_id (KolabFolderTypeID type_id)
{
@@ -171,6 +177,16 @@ kolab_util_folder_type_match_with_context_id (KolabFolderTypeID type_id,
/*----------------------------------------------------------------------------*/
+const gchar*
+kolab_util_folder_perm_get_string (KolabFolderPermID perm_id)
+{
+ g_assert (perm_id < KOLAB_FOLDER_LAST_PERM);
+
+ return kolab_folder_perm_inv_map[perm_id];
+}
+
+/*----------------------------------------------------------------------------*/
+
KolabFolderDescriptor*
kolab_util_folder_descriptor_new (const gchar *foldername,
KolabFolderTypeID type_id)
@@ -239,13 +255,13 @@ kolab_util_folder_timestamp_table_update (GHashTable *table,
{
gint64 timestamp = 0;
gint64 *stamp_ptr = NULL;
-
+
g_return_if_fail (table != NULL);
g_return_if_fail (foldername != NULL);
timestamp = g_get_monotonic_time ();
g_return_if_fail (timestamp >= 0);
-
+
stamp_ptr = (gint64*) g_malloc0 (sizeof (gint64));
g_return_if_fail (stamp_ptr != NULL);
diff --git a/src/libekolabutil/kolab-util-folder.h b/src/libekolabutil/kolab-util-folder.h
index f2e8b41..71ba91f 100644
--- a/src/libekolabutil/kolab-util-folder.h
+++ b/src/libekolabutil/kolab-util-folder.h
@@ -66,13 +66,13 @@ typedef enum {
* TODO check whether this annotation info is needed
* (used for events, tasks)
*
-typedef enum {
- KOLAB_INCIDENCES_FOR_INVAL = 0,
- KOLAB_INCIDENCES_FOR_NOBODY = 1 << 0,
- KOLAB_INCIDENCES_FOR_ADMINS = 1 << 1,
- KOLAB_INCIDENCES_FOR_READERS = 1 << 2
-} KolabFolderMetaIncidencesForID;
- */
+ typedef enum {
+ KOLAB_INCIDENCES_FOR_INVAL = 0,
+ KOLAB_INCIDENCES_FOR_NOBODY = 1 << 0,
+ KOLAB_INCIDENCES_FOR_ADMINS = 1 << 1,
+ KOLAB_INCIDENCES_FOR_READERS = 1 << 2
+ } KolabFolderMetaIncidencesForID;
+*/
/* IMAP folder annotation: /vendor/kolab/pxfb-readable-for
* TODO do we need to care for the (p)xfb annotation locally?
@@ -123,7 +123,11 @@ KolabFolderContextID
kolab_util_folder_type_map_to_context_id (KolabFolderTypeID type_id);
gboolean
-kolab_util_folder_type_match_with_context_id (KolabFolderTypeID type_id, KolabFolderContextID context_id);
+kolab_util_folder_type_match_with_context_id (KolabFolderTypeID type_id,
+ KolabFolderContextID context_id);
+
+const gchar*
+kolab_util_folder_perm_get_string (KolabFolderPermID perm_id);
KolabFolderDescriptor*
kolab_util_folder_descriptor_new (const gchar *foldername,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]