[evolution-kolab/ek-wip-porting-imapx: 6/12] IMAPX: extension preparations, refactoring



commit eca8daa34e5e6db3b9c732c263c202ec1717fc77
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Tue Nov 29 20:15:05 2011 +0100

    IMAPX: extension preparations, refactoring
    
    * added extension code files for CamelIMAPXFolder and CamelIMAPXServer
      (will hold our extension functions to keep the changes to the
      upstream IMAPX files small, re-implantation of metadata code from
      2.30 will take place in extension files as much as possible)
    * renamed our own data structures from CamelIMAPX* to CamelImapx*
      (closer to GObject scheme, makes them distinguishable from
      upstream IMAPX datastructures. However, descendant classes of
      CamelIMAPX* will remain as CamelKolabIMAPX*)
    * added initialization to function-local variables
    * changed free() function prototypes to return void instead of
      gboolean, removed GError** param
    * renamed our own functions to all obey a common naming scheme
      (camel_imapx_metadata_*())
    * renamed our own datastructures to obey a common naming scheme
      (CamelImapxMetadata*)
    * added to CamelIMAPXServer a CamelImapxMetadata* member

 src/camel/providers/imapx/Makefile.am              |    8 +
 .../providers/imapx/camel-imapx-folder-extn.c      |   42 +++
 .../providers/imapx/camel-imapx-folder-extn.h      |   44 +++
 src/camel/providers/imapx/camel-imapx-metadata.c   |  312 ++++++++++----------
 src/camel/providers/imapx/camel-imapx-metadata.h   |   87 +++---
 .../providers/imapx/camel-imapx-server-extn.c      |   70 +++++
 .../providers/imapx/camel-imapx-server-extn.h      |   49 +++
 src/camel/providers/imapx/camel-imapx-server.h     |    4 +
 8 files changed, 412 insertions(+), 204 deletions(-)
---
diff --git a/src/camel/providers/imapx/Makefile.am b/src/camel/providers/imapx/Makefile.am
index 8b9487f..55f865a 100644
--- a/src/camel/providers/imapx/Makefile.am
+++ b/src/camel/providers/imapx/Makefile.am
@@ -5,6 +5,7 @@ libcamelimapx_la_CPPFLAGS = \
 	$(AM_CPPFLAGS)				\
 	$(CAMEL_CFLAGS)				\
 	$(SQLITE_CFLAGS)			\
+	$(GLIB_CFLAGS)				\
 	$(KOLAB_INCLUDE)			\
 	-DG_LOG_DOMAIN=\"camel-imapx\"
 
@@ -12,6 +13,7 @@ libcamelimapx_la_CFLAGS = \
 	$(CFLAGS)				\
 	$(ADD_CFLAGS)				\
 	$(SQLITE_CFLAGS)			\
+	$(GLIB_CFLAGS)				\
 	-std=gnu99				\
 	-Wno-missing-field-initializers		\
 	-Wno-unused-parameter			\
@@ -21,9 +23,11 @@ libcamelimapx_la_CFLAGS = \
 libcamelimapx_la_SOURCES =			\
 	camel-imapx-conn-manager.c		\
 	camel-imapx-folder.c			\
+	camel-imapx-folder-extn.c		\
 	camel-imapx-metadata.c			\
 	camel-imapx-provider.c			\
 	camel-imapx-server.c			\
+	camel-imapx-server-extn.c		\
 	camel-imapx-settings.c			\
 	camel-imapx-store-summary.c		\
 	camel-imapx-store.c			\
@@ -34,8 +38,10 @@ libcamelimapx_la_SOURCES =			\
 noinst_HEADERS =				\
 	camel-imapx-conn-manager.h		\
 	camel-imapx-folder.h			\
+	camel-imapx-folder-extn.h		\
 	camel-imapx-metadata.h			\
 	camel-imapx-server.h			\
+	camel-imapx-server-extn.h		\
 	camel-imapx-settings.h			\
 	camel-imapx-store-summary.h		\
 	camel-imapx-store.h			\
@@ -49,6 +55,7 @@ camel-imapx-tokenise.h: camel-imapx-tokens.txt
 libcamelimapx_la_LIBADD = \
         $(CAMEL_LIBS)				\
         $(SQLITE_LIBS)				\
+	$(GLIB_LIBS)				\
         $(KOLAB_LIB_EKOLABUTIL)
 
 libcamelimapx_la_LDFLAGS = -avoid-version -static $(NO_UNDEFINED)
@@ -62,6 +69,7 @@ test_imapx_CPPFLAGS = \
 	-I$(top_srcdir)				\
 	$(CAMEL_CFLAGS)				\
 	$(ADD_CFLAGS)				\
+	$(GLIB_CFLAGS)				\
 	-DG_LOG_DOMAIN=\"camel-imapx\"
 
 test_imapx_CFLAGS = \
diff --git a/src/camel/providers/imapx/camel-imapx-folder-extn.c b/src/camel/providers/imapx/camel-imapx-folder-extn.c
new file mode 100644
index 0000000..32cb15b
--- /dev/null
+++ b/src/camel/providers/imapx/camel-imapx-folder-extn.c
@@ -0,0 +1,42 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+*            camel-imapx-folder-extn.c
+*
+*  2011-11-25, 21:02:28
+*  Copyright 2011, Christian Hilberg
+*  <hilberg unix-ag org>
+****************************************************************************/
+
+/*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with main.c; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+*/
+
+/*----------------------------------------------------------------------------*/
+
+#include "camel-imapx-folder-extn.h"
+
+/*----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+
+guint64
+camel_imapx_folder_extn_get_uidvalidity (CamelFolder *folder,
+					 GError **err)
+{
+	/* FIXME implement me */
+	g_assert_not_reached ();
+}
+
+/*----------------------------------------------------------------------------*/
\ No newline at end of file
diff --git a/src/camel/providers/imapx/camel-imapx-folder-extn.h b/src/camel/providers/imapx/camel-imapx-folder-extn.h
new file mode 100644
index 0000000..bce6f53
--- /dev/null
+++ b/src/camel/providers/imapx/camel-imapx-folder-extn.h
@@ -0,0 +1,44 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+*            camel-imapx-folder-extn.h
+*
+*  2011-11-25, 21:02:18
+*  Copyright 2011, Christian Hilberg
+*  <hilberg unix-ag org>
+****************************************************************************/
+
+/*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with main.c; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+*/
+
+/*----------------------------------------------------------------------------*/
+
+#ifndef CAMEL_IMAPX_FOLDER_EXTN_H_
+#define CAMEL_IMAPX_FOLDER_EXTN_H_
+
+/*----------------------------------------------------------------------------*/
+
+#include <glib.h>
+#include "camel-imapx-folder.h"
+
+/*----------------------------------------------------------------------------*/
+
+guint64 camel_imapx_folder_extn_get_uidvalidity (CamelFolder *folder, GError **err);
+
+/*----------------------------------------------------------------------------*/
+
+#endif /* CAMEL_IMAPX_FOLDER_EXTN_H_ */
+
+/*----------------------------------------------------------------------------*/
\ No newline at end of file
diff --git a/src/camel/providers/imapx/camel-imapx-metadata.c b/src/camel/providers/imapx/camel-imapx-metadata.c
index e86434a..77c2eca 100644
--- a/src/camel/providers/imapx/camel-imapx-metadata.c
+++ b/src/camel/providers/imapx/camel-imapx-metadata.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 /***************************************************************************
  *            camel-imapx-metadata.c
  *
@@ -37,27 +38,27 @@
 
 /*----------------------------------------------------------------------------*/
 
-CamelIMAPXMetaAttrib*
-camel_imapx_meta_attrib_new (void)
+CamelImapxMetadataAttrib*
+camel_imapx_metadata_attrib_new (void)
 {
-	gint acc;
-	CamelIMAPXMetaAttrib *ma;
+	gint acc = 0;
+	CamelImapxMetadataAttrib *ma = NULL;
 
-	ma = g_new0 (CamelIMAPXMetaAttrib, 1);
+	ma = g_new0 (CamelImapxMetadataAttrib, 1);
 	for (acc = 0; acc < CAMEL_IMAPX_METADATA_LAST_ACCESS; acc++) {
 		ma->data[acc] = NULL;
-		ma->type[acc] = CAMEL_IMAPX_META_ATTRIB_TYPE_UNSET;
+		ma->type[acc] = CAMEL_IMAPX_METADATA_ATTRIB_TYPE_UNSET;
 	}
 	return ma;
 }
 
-gboolean
-camel_imapx_meta_attrib_free (CamelIMAPXMetaAttrib *ma)
+void
+camel_imapx_metadata_attrib_free (CamelImapxMetadataAttrib *ma)
 {
-	gint acc;
+	gint acc = 0;
 
 	if (ma == NULL)
-		return FALSE;
+		return;
 
 	for (acc = 0; acc < CAMEL_IMAPX_METADATA_LAST_ACCESS; acc++) {
 		if (ma->data[acc])
@@ -65,95 +66,89 @@ camel_imapx_meta_attrib_free (CamelIMAPXMetaAttrib *ma)
 	}
 
 	g_free (ma);
-
-	return TRUE;
 }
 
 static void
-camel_imapx_meta_attrib_gdestroy (gpointer data)
+camel_imapx_metadata_attrib_gdestroy (gpointer data)
 {
-	CamelIMAPXMetaAttrib *ma = (CamelIMAPXMetaAttrib *)data;
-	(void)camel_imapx_meta_attrib_free (ma);
+	CamelImapxMetadataAttrib *ma = (CamelImapxMetadataAttrib *)data;
+	camel_imapx_metadata_attrib_free (ma);
 }
 
 /*----------------------------------------------------------------------------*/
 
-CamelIMAPXMetaEntry*
-camel_imapx_meta_entry_new (void)
+CamelImapxMetadataEntry*
+camel_imapx_metadata_entry_new (void)
 {
-	CamelIMAPXMetaEntry *me = g_new0 (CamelIMAPXMetaEntry, 1);
+	CamelImapxMetadataEntry *me = g_new0 (CamelImapxMetadataEntry, 1);
 	me->attributes = g_hash_table_new_full (g_str_hash,
 	                                        g_str_equal,
 	                                        g_free,
-	                                        camel_imapx_meta_attrib_gdestroy);
+	                                        camel_imapx_metadata_attrib_gdestroy);
 	return me;
 }
 
-gboolean
-camel_imapx_meta_entry_free (CamelIMAPXMetaEntry *me)
+void
+camel_imapx_metadata_entry_free (CamelImapxMetadataEntry *me)
 {
 	if (me == NULL)
-		return FALSE;
+		return;
 
 	if (me->attributes)
 		/* needs key:val destroy functions set */
 		g_hash_table_destroy (me->attributes);
 	g_free (me);
-
-	return TRUE;
 }
 
 static void
-camel_imapx_meta_entry_gdestroy (gpointer data)
+camel_imapx_metadata_entry_gdestroy (gpointer data)
 {
-	CamelIMAPXMetaEntry *me = (CamelIMAPXMetaEntry *)data;
-	(void)camel_imapx_meta_entry_free (me);
+	CamelImapxMetadataEntry *me = (CamelImapxMetadataEntry *)data;
+	camel_imapx_metadata_entry_free (me);
 }
 
 /*----------------------------------------------------------------------------*/
 
-CamelIMAPXMetaAnnotation*
-camel_imapx_meta_annotation_new (void)
+CamelImapxMetadataAnnotation*
+camel_imapx_metadata_annotation_new (void)
 {
-	CamelIMAPXMetaAnnotation *man = g_new0 (CamelIMAPXMetaAnnotation, 1);
+	CamelImapxMetadataAnnotation *man = g_new0 (CamelImapxMetadataAnnotation, 1);
 	man->entries = g_hash_table_new_full (g_str_hash,
 	                                      g_str_equal,
 	                                      g_free,
-	                                      camel_imapx_meta_entry_gdestroy);
+	                                      camel_imapx_metadata_entry_gdestroy);
 	return man;
 }
 
-gboolean
-camel_imapx_meta_annotation_free (CamelIMAPXMetaAnnotation *man)
+void
+camel_imapx_metadata_annotation_free (CamelImapxMetadataAnnotation *man)
 {
 	if (man == NULL)
-		return FALSE;
+		return;
 
 	if (man->entries)
 		/* needs key:val destroy functions set */
 		g_hash_table_destroy (man->entries);
 	g_free (man);
-	return TRUE;
 }
 
 static void
-camel_imapx_meta_annotation_gdestroy (gpointer data)
+camel_imapx_metadata_annotation_gdestroy (gpointer data)
 {
-	CamelIMAPXMetaAnnotation *man = (CamelIMAPXMetaAnnotation *)data;
-	(void)camel_imapx_meta_annotation_free (man);
+	CamelImapxMetadataAnnotation *man = (CamelImapxMetadataAnnotation *)data;
+	camel_imapx_metadata_annotation_free (man);
 }
 
 /*----------------------------------------------------------------------------*/
 
-CamelIMAPXMetaData*
-camel_imapx_meta_data_new (imapx_meta_data_proto_t proto,
-			   gboolean locked)
+CamelImapxMetadata*
+camel_imapx_metadata_new (camel_imapx_metadata_proto_t proto,
+                          gboolean locked)
 {
-	CamelIMAPXMetaData *md;
-
+	CamelImapxMetadata *md = NULL;
 	g_assert (proto < CAMEL_IMAPX_METADATA_LAST_PROTO);
 
-	md = g_new0 (CamelIMAPXMetaData, 1);
+	md = g_new0 (CamelImapxMetadata, 1);
 	md->md_lock = g_mutex_new ();
 
 	if (locked)
@@ -163,15 +158,15 @@ camel_imapx_meta_data_new (imapx_meta_data_proto_t proto,
 	md->mboxes = g_hash_table_new_full (g_str_hash,
 	                                    g_str_equal,
 	                                    g_free,
-	                                    camel_imapx_meta_annotation_gdestroy);
+	                                    camel_imapx_metadata_annotation_gdestroy);
 	return md;
 }
 
-gboolean
-camel_imapx_meta_data_free (CamelIMAPXMetaData *md)
+void
+camel_imapx_metadata_free (CamelImapxMetadata *md)
 {
 	if (md == NULL)
-		return FALSE;
+		return;
 
 	if (md->mboxes)
 		g_hash_table_destroy (md->mboxes);
@@ -181,15 +176,13 @@ camel_imapx_meta_data_free (CamelIMAPXMetaData *md)
 	g_mutex_free (md->md_lock);
 
 	g_free (md);
-
-	return TRUE;
 }
 
-CamelIMAPXMetaData*
-camel_imapx_meta_data_resect (CamelIMAPXMetaData **md)
+CamelImapxMetadata*
+camel_imapx_metadata_resect (CamelImapxMetadata **md)
 {
-	CamelIMAPXMetaData *tmp_md;
-	GMutex *tmp_lock;
+	CamelImapxMetadata *tmp_md = NULL;
+	GMutex *tmp_lock = NULL;
 
 	if (md == NULL)
 		return NULL;
@@ -198,7 +191,7 @@ camel_imapx_meta_data_resect (CamelIMAPXMetaData **md)
 	g_mutex_lock ((*md)->md_lock);
 
 	tmp_md = *md;
-	*md = camel_imapx_meta_data_new (tmp_md->proto, FALSE);
+	*md = camel_imapx_metadata_new (tmp_md->proto, FALSE);
 
 	/* (swap lock pointers of md and tmp_md) */
 	tmp_lock = tmp_md->md_lock;		/* locked   */
@@ -211,10 +204,10 @@ camel_imapx_meta_data_resect (CamelIMAPXMetaData **md)
 	return tmp_md;
 }
 
-imapx_meta_data_proto_t
-camel_imapx_meta_data_get_proto (CamelIMAPXMetaData *md)
+camel_imapx_metadata_proto_t
+camel_imapx_metadata_get_proto (CamelImapxMetadata *md)
 {
-	imapx_meta_data_proto_t mp;
+	camel_imapx_metadata_proto_t mp = CAMEL_IMAPX_METADATA_PROTO_INVAL;
 
 	if (md == NULL)
 		return CAMEL_IMAPX_METADATA_PROTO_INVAL;
@@ -272,29 +265,29 @@ camel_imapx_meta_data_get_proto (CamelIMAPXMetaData *md)
  * nstring = string / "NIL"
  */
 static gboolean
-camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
-						 CamelIMAPXStream *is,
-						 GCancellable *cancellable,
-						 GError **err)
+camel_imapx_metadata_parse_annotation_response (CamelImapxMetadata *md,
+                                                CamelIMAPXStream *is,
+                                                GCancellable *cancellable,
+                                                GError **err)
 {
-	gint tok;
-	guint len;
-	guchar *token;
+	gint tok = 0;
+	guint len = 0;
+	guchar *token = NULL;
 	GError *tmp_err = NULL;
 
-	gchar *mbox_name;
-	gchar *annot_name;
+	gchar *mbox_name = NULL;
+	gchar *annot_name = NULL;
 
-	CamelIMAPXMetaAnnotation *man;
-	CamelIMAPXMetaEntry *me;
+	CamelImapxMetadataAnnotation *man = NULL;
+	CamelImapxMetadataEntry *me = NULL;
 
 	g_assert (md != NULL);
 	g_assert (md->mboxes != NULL);
-	g_assert (is != NULL);
+	g_assert (CAMEL_IS_IMAPX_STREAM (is));
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
 	/* mailbox name */
-	tok = camel_imapx_stream_astring(is, &token, cancellable, &tmp_err);
+	tok = camel_imapx_stream_astring (is, &token, cancellable, &tmp_err);
 	if (tmp_err != NULL) {
 		g_propagate_error (err, tmp_err);
 		return FALSE;
@@ -302,7 +295,7 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 	mbox_name = g_strdup ((gchar *) token);
 
 	/* annotation name */
-	tok = camel_imapx_stream_astring(is, &token, cancellable, &tmp_err);
+	tok = camel_imapx_stream_astring (is, &token, cancellable, &tmp_err);
 	if (tmp_err != NULL) {
 		g_free (mbox_name);
 		g_propagate_error (err, tmp_err);
@@ -313,7 +306,7 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 	/* get annotation structure */
 	man = g_hash_table_lookup (md->mboxes, mbox_name);
 	if (man == NULL) {
-		man = camel_imapx_meta_annotation_new ();
+		man = camel_imapx_metadata_annotation_new ();
 		g_hash_table_insert (md->mboxes,
 		                     g_strdup (mbox_name),
 		                     man);
@@ -322,7 +315,7 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 	/* get entry structure */
 	me = g_hash_table_lookup (man->entries, annot_name);
 	if (me == NULL) {
-		me = camel_imapx_meta_entry_new ();
+		me = camel_imapx_metadata_entry_new ();
 		g_hash_table_insert (man->entries,
 		                     g_strdup (annot_name),
 		                     me);
@@ -349,11 +342,11 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 		return FALSE;
 	}
 	while (TRUE) {
-		CamelIMAPXMetaAttrib *ma;
-		gchar *attrib_name;
-		gchar *attrib_suffix[2];
-		guchar *attrib_value;
-		imapx_meta_data_access_t acc;
+		CamelImapxMetadataAttrib *ma = NULL;
+		gchar *attrib_name = NULL;
+		gchar *attrib_suffix[2] = {NULL, NULL};
+		guchar *attrib_value = NULL;
+		camel_imapx_metadata_access_t acc;
 
 		tok = camel_imapx_stream_token (is, &token, &len, cancellable, &tmp_err);
 		if (tmp_err != NULL) {
@@ -362,13 +355,13 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 		}
 		if (tok == ')')
 			break;
-		camel_imapx_stream_ungettoken(is, tok, token, len);
+		camel_imapx_stream_ungettoken (is, tok, token, len);
 
 		/* we do not handle unsolicited responses here, so
 	 	 * do not ENABLE them on the server
 	 	 */
 		/* attribute name */
-		tok = camel_imapx_stream_astring(is, &token, cancellable, &tmp_err);
+		tok = camel_imapx_stream_astring (is, &token, cancellable, &tmp_err);
 		if (tmp_err != NULL) {
 			g_propagate_error (err, tmp_err);
 			return FALSE;
@@ -376,7 +369,7 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 		attrib_name = g_strdup ((gchar* ) token);
 
 		/* attribute value */
-		tok = camel_imapx_stream_nstring(is, &token, cancellable, &tmp_err);
+		tok = camel_imapx_stream_nstring (is, &token, cancellable, &tmp_err);
 		if (tmp_err != NULL) {
 			g_free (attrib_name);
 			g_propagate_error (err, tmp_err);
@@ -402,13 +395,13 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 		/* get/create and fill attribute structure */
 		ma = g_hash_table_lookup (me->attributes, attrib_name);
 		if (ma == NULL) {
-			ma = camel_imapx_meta_attrib_new ();
+			ma = camel_imapx_metadata_attrib_new ();
 			g_hash_table_insert (me->attributes,
 			                     g_strdup (attrib_name),
 			                     ma);
 		}
-		if ((ma->type[acc] != CAMEL_IMAPX_META_ATTRIB_TYPE_UNSET) &&
-		    (ma->type[acc] != CAMEL_IMAPX_META_ATTRIB_TYPE_NIL)) {
+		if ((ma->type[acc] != CAMEL_IMAPX_METADATA_ATTRIB_TYPE_UNSET) &&
+		    (ma->type[acc] != CAMEL_IMAPX_METADATA_ATTRIB_TYPE_NIL)) {
 			    g_byte_array_free (ma->data[acc], TRUE);
 			    g_byte_array_unref (ma->data[acc]);
 			    /* refcount should now be 0 */
@@ -426,7 +419,7 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 		ma->data[acc]->data[len] = '\0';
 
 		if (attrib_value == NULL) {
-			ma->type[acc] = CAMEL_IMAPX_META_ATTRIB_TYPE_NIL;
+			ma->type[acc] = CAMEL_IMAPX_METADATA_ATTRIB_TYPE_NIL;
 			goto val_add_done;
 		}
 
@@ -435,7 +428,7 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 			/* value is still stored as byte array (guchar),
 			 * no type conversion here (just info)
 			 */
-			ma->type[acc] = CAMEL_IMAPX_META_ATTRIB_TYPE_UTF8;
+			ma->type[acc] = CAMEL_IMAPX_METADATA_ATTRIB_TYPE_UTF8;
 			goto val_add_done;
 		}
 
@@ -443,7 +436,7 @@ camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
 		 * 'nstring' (so it cannot contain NUL bytes). It means a
 		 * NUL-terminated string with unknown encoding here
 		 */
-		ma->type[acc] = CAMEL_IMAPX_META_ATTRIB_TYPE_BINARY;
+		ma->type[acc] = CAMEL_IMAPX_METADATA_ATTRIB_TYPE_BINARY;
 		} /* add done */
 val_add_done:
 
@@ -459,10 +452,10 @@ val_add_done:
 }
 
 static gboolean
-camel_imapx_meta_data_parse_metadata_response (CamelIMAPXMetaData *md,
-					       CamelIMAPXStream *is,
-					       GCancellable *cancellable,
-					       GError **err)
+camel_imapx_metadata_parse_metadata_response (CamelImapxMetadata *md,
+                                              CamelIMAPXStream *is,
+                                              GCancellable *cancellable,
+                                              GError **err)
 {
 	/* TODO implement me*/
 
@@ -470,24 +463,24 @@ camel_imapx_meta_data_parse_metadata_response (CamelIMAPXMetaData *md,
 
 	g_assert (md != NULL);
 	g_assert (md->mboxes != NULL);
-	g_assert (is != NULL);
+	g_assert (CAMEL_IS_IMAPX_STREAM (is));
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
 	return TRUE;
 }
 
 gboolean
-camel_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md,
-						CamelIMAPXStream *is,
-						GCancellable *cancellable,
-						GError **err)
+camel_imapx_metadata_add_from_server_response (CamelImapxMetadata *md,
+                                               CamelIMAPXStream *is,
+                                               GCancellable *cancellable,
+                                               GError **err)
 {
 	GError *tmp_err = NULL;
-	gboolean parse_ok;
+	gboolean parse_ok = FALSE;
 
 	g_assert (md != NULL);
 	g_assert (md->mboxes != NULL);
-	g_assert (is != NULL);
+	g_assert (CAMEL_IS_IMAPX_STREAM (is));
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
 	/* (acquire md lock ) */
@@ -495,16 +488,16 @@ camel_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md,
 
 	switch (md->proto) {
 		case CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE:
-			parse_ok = camel_imapx_meta_data_parse_annotation_response (md,
-										    is,
-										    cancellable,
-										    &tmp_err);
+			parse_ok = camel_imapx_metadata_parse_annotation_response (md,
+			                                                           is,
+			                                                           cancellable,
+			                                                           &tmp_err);
 			break;
 		case CAMEL_IMAPX_METADATA_PROTO_METADATA:
-			parse_ok = camel_imapx_meta_data_parse_metadata_response (md,
-										  is,
-										  cancellable,
-										  &tmp_err);
+			parse_ok = camel_imapx_metadata_parse_metadata_response (md,
+			                                                         is,
+			                                                         cancellable,
+			                                                         &tmp_err);
 			break;
 		case CAMEL_IMAPX_METADATA_PROTO_INVAL:
 			/* (release md lock) */
@@ -519,7 +512,6 @@ camel_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md,
 			/* can't happen... */
 			g_error ("%s: have unknown metadata protocol type %i",
 			         __func__, md->proto);
-
 	}
 
 	/* (release md lock) */
@@ -534,11 +526,12 @@ camel_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md,
 }
 
 GSList*
-camel_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
+camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md)
 {
 	GSList *commands = NULL;
 	GHashTableIter md_iter;
-	gpointer md_key, md_value;
+	gpointer md_key = NULL;
+	gpointer md_value = NULL;
 
 	if (md == NULL)
 		return NULL;
@@ -556,18 +549,20 @@ camel_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 	g_hash_table_iter_init (&md_iter, md->mboxes);
 	while (g_hash_table_iter_next (&md_iter, &md_key, &md_value)) {
 		gchar *mbox_name = (gchar *) md_key;
-		CamelIMAPXMetaAnnotation *man = (CamelIMAPXMetaAnnotation *) md_value;
+		CamelImapxMetadataAnnotation *man = (CamelImapxMetadataAnnotation *) md_value;
 		GHashTableIter man_iter;
-		gpointer man_key, man_value;
+		gpointer man_key = NULL;
+		gpointer man_value = NULL;
 
 		g_hash_table_iter_init (&man_iter, man->entries);
 		while (g_hash_table_iter_next (&man_iter, &man_key, &man_value)) {
 			gchar *annot_name = (gchar *) man_key;
-			CamelIMAPXMetaEntry *me = (CamelIMAPXMetaEntry *) man_value;
+			CamelImapxMetadataEntry *me = (CamelImapxMetadataEntry *) man_value;
 			GString *cmd = NULL;
-			gchar *cmd_top;
+			gchar *cmd_top = NULL;
 			GHashTableIter me_iter;
-			gpointer me_key, me_value;
+			gpointer me_key = NULL;
+			gpointer me_value = NULL;
 			gboolean have_entries = FALSE;
 
 			switch (md->proto) {
@@ -601,12 +596,12 @@ camel_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 			g_hash_table_iter_init (&me_iter, me->attributes);
 			while (g_hash_table_iter_next (&me_iter, &me_key, &me_value)) {
 				gchar *attrib_name = (gchar *) me_key;
-				CamelIMAPXMetaAttrib *ma = (CamelIMAPXMetaAttrib *) me_value;
-				gchar *attrib_str;
-				gint acc;
+				CamelImapxMetadataAttrib *ma = (CamelImapxMetadataAttrib *) me_value;
+				gchar *attrib_str = NULL;
+				gint acc = 0;
 
 				for (acc = 0; acc < CAMEL_IMAPX_METADATA_LAST_ACCESS; acc++) {
-					if (ma->type[acc] == CAMEL_IMAPX_META_ATTRIB_TYPE_UNSET)
+					if (ma->type[acc] == CAMEL_IMAPX_METADATA_ATTRIB_TYPE_UNSET)
 						/* caution: UNSET != NIL (for NIL, a command gets issued) */
 						continue;
 
@@ -660,15 +655,15 @@ camel_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 					/* add attribute value to command string */
 					g_string_append (cmd, " ");
 					switch (ma->type[acc]) {
-					case CAMEL_IMAPX_META_ATTRIB_TYPE_NIL:
+					case CAMEL_IMAPX_METADATA_ATTRIB_TYPE_NIL:
 						/* identical for both protocol versions */
 						g_string_append (cmd, "NIL");
 						break;
-					case CAMEL_IMAPX_META_ATTRIB_TYPE_UTF8:
-					case CAMEL_IMAPX_META_ATTRIB_TYPE_BINARY:
+					case CAMEL_IMAPX_METADATA_ATTRIB_TYPE_UTF8:
+					case CAMEL_IMAPX_METADATA_ATTRIB_TYPE_BINARY:
 						/* TODO correct handling of guchar
 						 *      In theory, we're able to read true binary data into
-						 *      a CamelIMAPXMetaAttrib from the server, but we aren't
+						 *      a CamelImapxMetaAttrib from the server, but we aren't
 						 *      able to write it back just that way. At least, we *could*
 						 *      write strings containing NUL bytes...
 						 * FIXME: We read guchar but write gchar. That needs fixing.
@@ -709,28 +704,27 @@ camel_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 
 /*----------------------------------------------------------------------------*/
 
-CamelIMAPXMetaDataSpec*
-camel_imapx_meta_data_spec_new (CamelIMAPXMetaData *md,
-				const gchar *mailbox_name,
-				const gchar *entry_name,
-				const gchar *attrib_name,
-				GError **err)
+CamelImapxMetadataSpec*
+camel_imapx_metadata_spec_new (camel_imapx_metadata_proto_t proto,
+                               const gchar *mailbox_name,
+                               const gchar *entry_name,
+                               const gchar *attrib_name,
+                               GError **err)
 {
-	CamelIMAPXMetaDataSpec *spec;
-	imapx_meta_data_proto_t mp;
+	CamelImapxMetadataSpec *spec = NULL;
 
+	g_assert ((proto > CAMEL_IMAPX_METADATA_PROTO_INVAL) &&
+	          (proto < CAMEL_IMAPX_METADATA_LAST_PROTO));
 	/* mailbox_name may be NULL when starting search at annotation level */
 	g_assert (entry_name != NULL);
 	/* attrib_name may be NULL, will then be replaced by "value" */
 	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
 
-	mp = camel_imapx_meta_data_get_proto (md);
-
 	/* scan for invalid name tokens */
-	switch (mp) {
+	switch (proto) {
 		case CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE: {
 			gboolean parse_err = FALSE;
-			/* parse for unwanted tokens */
+			/* TODO parse for unwanted tokens */
 			if (parse_err) {
 				g_set_error (err,
 				             KOLAB_CAMEL_ERROR,
@@ -775,11 +769,11 @@ camel_imapx_meta_data_spec_new (CamelIMAPXMetaData *md,
 		default:
 			/* can't happen... */
 			g_error ("%s: have unknown metadata protocol type %i",
-			         __func__, mp);
+			         __func__, proto);
 	}
 
-	spec = g_new0 (CamelIMAPXMetaDataSpec, 1);
-	spec->proto = mp;
+	spec = g_new0 (CamelImapxMetadataSpec, 1);
+	spec->proto = proto;
 
 	if (mailbox_name != NULL)
 		spec->mailbox_name = g_strdup (mailbox_name);
@@ -796,11 +790,11 @@ camel_imapx_meta_data_spec_new (CamelIMAPXMetaData *md,
 	return spec;
 }
 
-gboolean
-camel_imapx_meta_data_spec_free (CamelIMAPXMetaDataSpec *spec)
+void
+camel_imapx_metadata_spec_free (CamelImapxMetadataSpec *spec)
 {
 	if (spec == NULL)
-		return FALSE;
+		return;
 
 	if (spec->mailbox_name)
 		g_free (spec->mailbox_name);
@@ -810,18 +804,16 @@ camel_imapx_meta_data_spec_free (CamelIMAPXMetaDataSpec *spec)
 		g_free (spec->attrib_name);
 
 	g_free (spec);
-
-	return TRUE;
 }
 
 /*----------------------------------------------------------------------------*/
 
-CamelIMAPXMetaAttrib*
-camel_imapx_meta_data_get_attrib_from_entry (CamelIMAPXMetaEntry *me,
-					     CamelIMAPXMetaDataSpec *spec)
+CamelImapxMetadataAttrib*
+camel_imapx_metadata_get_attrib_from_entry (CamelImapxMetadataEntry *me,
+                                            CamelImapxMetadataSpec *spec)
 {
-	CamelIMAPXMetaAttrib *ma;
-	gchar *attrib_name;
+	CamelImapxMetadataAttrib *ma = NULL;
+	gchar *attrib_name = NULL;
 
 	if ((me == NULL) || (spec == NULL))
 		return NULL;
@@ -842,12 +834,12 @@ camel_imapx_meta_data_get_attrib_from_entry (CamelIMAPXMetaEntry *me,
 	return ma;
 }
 
-CamelIMAPXMetaAttrib*
-camel_imapx_meta_data_get_attrib_from_annotation (CamelIMAPXMetaAnnotation *man,
-						  CamelIMAPXMetaDataSpec *spec)
+CamelImapxMetadataAttrib*
+camel_imapx_metadata_get_attrib_from_annotation (CamelImapxMetadataAnnotation *man,
+                                                 CamelImapxMetadataSpec *spec)
 {
-	CamelIMAPXMetaEntry *me;
-	CamelIMAPXMetaAttrib *ma;
+	CamelImapxMetadataEntry *me = NULL;
+	CamelImapxMetadataAttrib *ma = NULL;
 
 	if ((man == NULL) || (spec == NULL))
 		return NULL;
@@ -859,16 +851,16 @@ camel_imapx_meta_data_get_attrib_from_annotation (CamelIMAPXMetaAnnotation *man,
 	if (me == NULL)
 		return NULL;
 
-	ma = camel_imapx_meta_data_get_attrib_from_entry (me, spec);
+	ma = camel_imapx_metadata_get_attrib_from_entry (me, spec);
 	return ma;
 }
 
-CamelIMAPXMetaAttrib*
-camel_imapx_meta_data_get_attrib_from_metadata (CamelIMAPXMetaData *md,
-						CamelIMAPXMetaDataSpec *spec)
+CamelImapxMetadataAttrib*
+camel_imapx_metadata_get_attrib_from_metadata (CamelImapxMetadata *md,
+                                               CamelImapxMetadataSpec *spec)
 {
-	CamelIMAPXMetaAnnotation *man;
-	CamelIMAPXMetaAttrib *ma;
+	CamelImapxMetadataAnnotation *man = NULL;
+	CamelImapxMetadataAttrib *ma = NULL;
 
 	if ((md == NULL) || (spec == NULL))
 		return NULL;
@@ -880,7 +872,7 @@ camel_imapx_meta_data_get_attrib_from_metadata (CamelIMAPXMetaData *md,
 	if (man == NULL)
 		return NULL;
 
-	ma = camel_imapx_meta_data_get_attrib_from_annotation (man, spec);
+	ma = camel_imapx_metadata_get_attrib_from_annotation (man, spec);
 	return ma;
 }
 
diff --git a/src/camel/providers/imapx/camel-imapx-metadata.h b/src/camel/providers/imapx/camel-imapx-metadata.h
index 0efa9ac..9e50d51 100644
--- a/src/camel/providers/imapx/camel-imapx-metadata.h
+++ b/src/camel/providers/imapx/camel-imapx-metadata.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 /***************************************************************************
  *            camel-imapx-metadata.h
  *
@@ -60,84 +61,82 @@
 /*----------------------------------------------------------------------------*/
 
 typedef enum {
-	CAMEL_IMAPX_META_ATTRIB_TYPE_UNSET = 0,
-	CAMEL_IMAPX_META_ATTRIB_TYPE_NIL,
-	CAMEL_IMAPX_META_ATTRIB_TYPE_UTF8,
-	CAMEL_IMAPX_META_ATTRIB_TYPE_BINARY,
-	CAMEL_IMAPX_META_ATTRIB_LAST_TYPE
-} imapx_meta_attrib_type_t;
+	CAMEL_IMAPX_METADATA_ATTRIB_TYPE_UNSET = 0,
+	CAMEL_IMAPX_METADATA_ATTRIB_TYPE_NIL,
+	CAMEL_IMAPX_METADATA_ATTRIB_TYPE_UTF8,
+	CAMEL_IMAPX_METADATA_ATTRIB_TYPE_BINARY,
+	CAMEL_IMAPX_METADATA_ATTRIB_LAST_TYPE
+} camel_imapx_metadata_attrib_type_t;
 
 typedef enum {
 	CAMEL_IMAPX_METADATA_ACCESS_PRIVATE = 0,
 	CAMEL_IMAPX_METADATA_ACCESS_SHARED,
 	CAMEL_IMAPX_METADATA_LAST_ACCESS
-} imapx_meta_data_access_t;
+} camel_imapx_metadata_access_t;
 
 typedef enum {
 	CAMEL_IMAPX_METADATA_PROTO_INVAL = 0,
 	CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE,
 	CAMEL_IMAPX_METADATA_PROTO_METADATA,
 	CAMEL_IMAPX_METADATA_LAST_PROTO
-} imapx_meta_data_proto_t;
+} camel_imapx_metadata_proto_t;
 
 
-typedef struct _CamelIMAPXMetaDataSpec {
-	imapx_meta_data_proto_t proto;
+typedef struct _CamelImapxMetadataSpec {
+	camel_imapx_metadata_proto_t proto;
 	gchar *mailbox_name;
 	gchar *entry_name;
 	gchar *attrib_name;
-} CamelIMAPXMetaDataSpec;
+} CamelImapxMetadataSpec;
 
-typedef struct _CamelIMAPXMetaAttrib {
-	/* attribute name kept as hash table key in CamelIMAPXMetaEntry */
+typedef struct _CamelImapxMetadataAttrib {
+	/* attribute name kept as hash table key in CamelImapxMetaEntry */
 	GByteArray *data[CAMEL_IMAPX_METADATA_LAST_ACCESS]; /* attribute data (UTF-8/Binary/NIL/unset) */
-	imapx_meta_attrib_type_t type[CAMEL_IMAPX_METADATA_LAST_ACCESS]; /* type of data */
-} CamelIMAPXMetaAttrib;
+	camel_imapx_metadata_attrib_type_t type[CAMEL_IMAPX_METADATA_LAST_ACCESS]; /* type of data */
+} CamelImapxMetadataAttrib;
 
-typedef struct _CamelIMAPXMetaEntry {
-	/* entry name kept as hash table key in CamelIMAPXMetaAnnotation */
-	GHashTable *attributes; /* for CamelIMAPXMetaAttribute */
-} CamelIMAPXMetaEntry;
+typedef struct _CamelImapxMetadataEntry {
+	/* entry name kept as hash table key in CamelImapxMetaAnnotation */
+	GHashTable *attributes; /* for CamelImapxMetaAttribute */
+} CamelImapxMetadataEntry;
 
-typedef struct _CamelIMAPXMetaAnnotation {
-	/* annotation name kept as hash table key in CamelIMAPXMetaData */
+typedef struct _CamelImapxMetadataAnnotation {
+	/* annotation name kept as hash table key in CamelImapxMetaData */
 	GHashTable *entries;
-} CamelIMAPXMetaAnnotation;
+} CamelImapxMetadataAnnotation;
 
-typedef struct _CamelIMAPXMetaData {
-	imapx_meta_data_proto_t proto;
+typedef struct _CamelImapxMetadata {
+	camel_imapx_metadata_proto_t proto;
 	GHashTable *mboxes;
 	/* lock needed? */
 	GMutex *md_lock;
-} CamelIMAPXMetaData;
+} CamelImapxMetadata;
 
 /*----------------------------------------------------------------------------*/
 /* TODO check which of these can be made static */
 
+CamelImapxMetadataAttrib *camel_imapx_metadata_attrib_new (void);
+void camel_imapx_metadata_attrib_free (CamelImapxMetadataAttrib *ma);
 
+CamelImapxMetadataEntry *camel_imapx_metadata_entry_new (void);
+void camel_imapx_metadata_entry_free (CamelImapxMetadataEntry *me);
 
-CamelIMAPXMetaAttrib *camel_imapx_meta_attrib_new (void);
-gboolean camel_imapx_meta_attrib_free (CamelIMAPXMetaAttrib*);
+CamelImapxMetadataAnnotation *camel_imapx_metadata_annotation_new (void);
+void camel_imapx_metadata_annotation_free (CamelImapxMetadataAnnotation *man);
 
-CamelIMAPXMetaEntry *camel_imapx_meta_entry_new (void);
-gboolean camel_imapx_meta_entry_free (CamelIMAPXMetaEntry*);
+CamelImapxMetadata *camel_imapx_metadata_new (camel_imapx_metadata_proto_t proto, gboolean locked);
+CamelImapxMetadata *camel_imapx_metadata_resect (CamelImapxMetadata **md);
+void camel_imapx_metadata_free (CamelImapxMetadata *md);
+camel_imapx_metadata_proto_t camel_imapx_metadata_get_proto (CamelImapxMetadata *md);
+gboolean camel_imapx_metadata_add_from_server_response (CamelImapxMetadata *md, CamelIMAPXStream *is, GCancellable *cancellable, GError**);
+GSList *camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md);
 
-CamelIMAPXMetaAnnotation *camel_imapx_meta_annotation_new (void);
-gboolean camel_imapx_meta_annotation_free (CamelIMAPXMetaAnnotation*);
+CamelImapxMetadataSpec *camel_imapx_metadata_spec_new (camel_imapx_metadata_proto_t proto, const gchar *mailbox_name, const gchar *entry_name, const gchar *attrib_name, GError**);
+void camel_imapx_metadata_spec_free (CamelImapxMetadataSpec *spec);
 
-CamelIMAPXMetaData *camel_imapx_meta_data_new (imapx_meta_data_proto_t, gboolean);
-CamelIMAPXMetaData *camel_imapx_meta_data_resect (CamelIMAPXMetaData**);
-gboolean camel_imapx_meta_data_free (CamelIMAPXMetaData*);
-imapx_meta_data_proto_t camel_imapx_meta_data_get_proto (CamelIMAPXMetaData*);
-gboolean camel_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData*, CamelIMAPXStream*, GCancellable *cancellable, GError**);
-GSList *camel_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData*);
-
-CamelIMAPXMetaDataSpec *camel_imapx_meta_data_spec_new (CamelIMAPXMetaData*, const gchar*, const gchar*, const gchar*, GError**);
-gboolean camel_imapx_meta_data_spec_free (CamelIMAPXMetaDataSpec*);
-
-CamelIMAPXMetaAttrib *camel_imapx_meta_data_get_attrib_from_entry (CamelIMAPXMetaEntry*, CamelIMAPXMetaDataSpec*);
-CamelIMAPXMetaAttrib *camel_imapx_meta_data_get_attrib_from_annotation (CamelIMAPXMetaAnnotation*, CamelIMAPXMetaDataSpec*);
-CamelIMAPXMetaAttrib *camel_imapx_meta_data_get_attrib_from_metadata (CamelIMAPXMetaData*, CamelIMAPXMetaDataSpec*);
+CamelImapxMetadataAttrib *camel_imapx_metadata_get_attrib_from_entry (CamelImapxMetadataEntry *me, CamelImapxMetadataSpec *spec);
+CamelImapxMetadataAttrib *camel_imapx_metadata_get_attrib_from_annotation (CamelImapxMetadataAnnotation *ma, CamelImapxMetadataSpec *spec);
+CamelImapxMetadataAttrib *camel_imapx_metadata_get_attrib_from_metadata (CamelImapxMetadata *md, CamelImapxMetadataSpec *spec);
 
 /*----------------------------------------------------------------------------*/
 
diff --git a/src/camel/providers/imapx/camel-imapx-server-extn.c b/src/camel/providers/imapx/camel-imapx-server-extn.c
new file mode 100644
index 0000000..220b754
--- /dev/null
+++ b/src/camel/providers/imapx/camel-imapx-server-extn.c
@@ -0,0 +1,70 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+*            camel-imapx-server-extn.c
+*
+*  2011-11-28, 20:16:38
+*  Copyright 2011, Christian Hilberg
+*  <hilberg unix-ag org>
+****************************************************************************/
+
+/*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with main.c; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+*/
+
+/*----------------------------------------------------------------------------*/
+
+#include "camel-imapx-server-extn.h"
+
+/*----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+
+camel_imapx_metadata_proto_t
+camel_imapx_server_metadata_get_proto (CamelIMAPXServer *is)
+{
+        g_assert (CAMEL_IS_IMAPX_SERVER (is));
+        return camel_imapx_metadata_get_proto (is->metadata);
+}
+
+CamelImapxMetadata*
+camel_imapx_server_get_metadata (CamelIMAPXServer *is,
+                                 CamelImapxMetadataSpec *spec,
+                                 gboolean do_resect,
+                                 GError **err)
+{
+        g_assert (CAMEL_IS_IMAPX_SERVER (is));
+        g_assert (spec != NULL);
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	g_error ("%s: FIXME: implement me", __func__);
+	
+	return NULL;
+}
+
+gboolean
+camel_imapx_server_set_metadata (CamelIMAPXServer *is,
+                                 CamelImapxMetadata *md,
+                                 GError **err)
+{
+        g_assert (CAMEL_IS_IMAPX_SERVER (is));
+        g_assert (md != NULL);
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	g_error ("%s: FIXME: implement me", __func__);
+	
+	return FALSE;	
+}
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-server-extn.h b/src/camel/providers/imapx/camel-imapx-server-extn.h
new file mode 100644
index 0000000..ed39434
--- /dev/null
+++ b/src/camel/providers/imapx/camel-imapx-server-extn.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+*            camel-imapx-server-extn.h
+*
+*  2011-11-28, 20:16:38
+*  Copyright 2011, Christian Hilberg
+*  <hilberg unix-ag org>
+****************************************************************************/
+
+/*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with main.c; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+*/
+
+/*----------------------------------------------------------------------------*/
+
+#ifndef CAMEL_IMAPX_SERVER_EXTN_H_
+#define CAMEL_IMAPX_SERVER_EXTN_H_
+
+/*----------------------------------------------------------------------------*/
+
+#include <glib.h>
+#include "camel-imapx-server.h"
+#include "camel-imapx-metadata.h"
+
+/*----------------------------------------------------------------------------*/
+
+camel_imapx_metadata_proto_t camel_imapx_server_metadata_get_proto (CamelIMAPXServer *is);
+
+CamelImapxMetadata *camel_imapx_server_get_metadata (CamelIMAPXServer *is, CamelImapxMetadataSpec *spec, gboolean do_resect, GError **err);
+
+gboolean camel_imapx_server_set_metadata (CamelIMAPXServer *is, CamelImapxMetadata *md, GError **err);
+
+/*----------------------------------------------------------------------------*/
+
+#endif /* CAMEL_IMAPX_SERVER_EXTN_H_ */
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-server.h b/src/camel/providers/imapx/camel-imapx-server.h
index f4c8fb7..da11d4b 100644
--- a/src/camel/providers/imapx/camel-imapx-server.h
+++ b/src/camel/providers/imapx/camel-imapx-server.h
@@ -55,6 +55,7 @@ typedef struct _CamelIMAPXServerClass CamelIMAPXServerClass;
 typedef struct _CamelIMAPXCommand CamelIMAPXCommand;
 typedef struct _CamelIMAPXIdle CamelIMAPXIdle;
 struct _IMAPXJobQueueInfo;
+struct _CamelImapxMetadata;
 
 struct _CamelIMAPXServer {
 	CamelObject parent;
@@ -121,6 +122,9 @@ struct _CamelIMAPXServer {
 	GCond *fetch_cond;
 	GMutex *fetch_mutex;
 	gint fetch_count;
+
+	/* ANNOTATEMORE / METADATA (RFC 5464) */
+	struct _CamelImapxMetadata *metadata; /* for CamelImapxMetadata, keyed by path */
 };
 
 struct _CamelIMAPXServerClass {



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