[evolution-kolab/ek-wip-porting-imapx: 5/12] IMAPX: build fixes (src/camel/providers/imapx builds again)



commit b7c324007f0bdedd5a08b3a697dfb1090267b97b
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Fri Nov 25 16:01:02 2011 +0100

    IMAPX: build fixes (src/camel/providers/imapx builds again)
    
    * Makefile.am tweaks (added our own build AM vars, libtool libs,
      changes for building outside of E-D-S Camel)
    * replaced CamelException with GError in camel-imapx-metadata
    * added GCancellable* param to functions which call IMAPX
      functions demanding for one

 src/camel/providers/imapx/Makefile.am            |   34 +++-
 src/camel/providers/imapx/camel-imapx-metadata.c |  235 +++++++++++----------
 src/camel/providers/imapx/camel-imapx-metadata.h |   42 ++--
 3 files changed, 171 insertions(+), 140 deletions(-)
---
diff --git a/src/camel/providers/imapx/Makefile.am b/src/camel/providers/imapx/Makefile.am
index 6315ce4..8b9487f 100644
--- a/src/camel/providers/imapx/Makefile.am
+++ b/src/camel/providers/imapx/Makefile.am
@@ -3,16 +3,25 @@ camel_provider_LTLIBRARIES = libcamelimapx.la
 
 libcamelimapx_la_CPPFLAGS = \
 	$(AM_CPPFLAGS)				\
-	-I..					\
-	-I$(srcdir)/..				\
-	-I$(top_srcdir)/camel			\
-	-I$(top_srcdir)				\
 	$(CAMEL_CFLAGS)				\
+	$(SQLITE_CFLAGS)			\
+	$(KOLAB_INCLUDE)			\
 	-DG_LOG_DOMAIN=\"camel-imapx\"
 
+libcamelimapx_la_CFLAGS = \
+	$(CFLAGS)				\
+	$(ADD_CFLAGS)				\
+	$(SQLITE_CFLAGS)			\
+	-std=gnu99				\
+	-Wno-missing-field-initializers		\
+	-Wno-unused-parameter			\
+	-Wno-switch-default			\
+	-Wno-format
+
 libcamelimapx_la_SOURCES =			\
 	camel-imapx-conn-manager.c		\
 	camel-imapx-folder.c			\
+	camel-imapx-metadata.c			\
 	camel-imapx-provider.c			\
 	camel-imapx-server.c			\
 	camel-imapx-settings.c			\
@@ -25,6 +34,7 @@ libcamelimapx_la_SOURCES =			\
 noinst_HEADERS =				\
 	camel-imapx-conn-manager.h		\
 	camel-imapx-folder.h			\
+	camel-imapx-metadata.h			\
 	camel-imapx-server.h			\
 	camel-imapx-settings.h			\
 	camel-imapx-store-summary.h		\
@@ -37,7 +47,9 @@ camel-imapx-tokenise.h: camel-imapx-tokens.txt
 	@GPERF@ -H imapx_hash -N imapx_tokenise_struct -L ANSI-C -o -t -k1,$$ $< --output-file=$@
 
 libcamelimapx_la_LIBADD = \
-        $(CAMEL_LIBS)
+        $(CAMEL_LIBS)				\
+        $(SQLITE_LIBS)				\
+        $(KOLAB_LIB_EKOLABUTIL)
 
 libcamelimapx_la_LDFLAGS = -avoid-version -static $(NO_UNDEFINED)
 
@@ -47,13 +59,21 @@ test_imapx_CPPFLAGS = \
 	$(AM_CPPFLAGS)				\
 	-I..					\
 	-I$(srcdir)/..				\
-	-I$(top_srcdir)/camel			\
 	-I$(top_srcdir)				\
 	$(CAMEL_CFLAGS)				\
+	$(ADD_CFLAGS)				\
 	-DG_LOG_DOMAIN=\"camel-imapx\"
+
+test_imapx_CFLAGS = \
+	$(CFLAGS)				\
+	$(ADD_CFLAGS)
+
 test_imapx_SOURCES = test-imapx.c
+
 test_imapx_LDADD =				\
-	$(CAMEL_LIBS)
+	$(CAMEL_LIBS)				\
+	$(SQLITE_LIBS)				\
+	$(GLIB_LIBS)
 
 BUILT_SOURCES = camel-imapx-tokenise.h
 CLEANFILES = $(BUILT_SOURCES)
diff --git a/src/camel/providers/imapx/camel-imapx-metadata.c b/src/camel/providers/imapx/camel-imapx-metadata.c
index 59f3705..e86434a 100644
--- a/src/camel/providers/imapx/camel-imapx-metadata.c
+++ b/src/camel/providers/imapx/camel-imapx-metadata.c
@@ -11,17 +11,17 @@
  * 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
  */
- 
+
 /*----------------------------------------------------------------------------*/
 /* ANNOTATEMORE / METADATA (RFC 5464) */
 
@@ -38,7 +38,7 @@
 /*----------------------------------------------------------------------------*/
 
 CamelIMAPXMetaAttrib*
-__KOLAB_imapx_meta_attrib_new (void)
+camel_imapx_meta_attrib_new (void)
 {
 	gint acc;
 	CamelIMAPXMetaAttrib *ma;
@@ -52,45 +52,45 @@ __KOLAB_imapx_meta_attrib_new (void)
 }
 
 gboolean
-__KOLAB_imapx_meta_attrib_free (CamelIMAPXMetaAttrib *ma)
+camel_imapx_meta_attrib_free (CamelIMAPXMetaAttrib *ma)
 {
 	gint acc;
-	
+
 	if (ma == NULL)
 		return FALSE;
-	
+
 	for (acc = 0; acc < CAMEL_IMAPX_METADATA_LAST_ACCESS; acc++) {
 		if (ma->data[acc])
 			g_byte_array_free (ma->data[acc], TRUE);
 	}
 
 	g_free (ma);
-	
+
 	return TRUE;
 }
 
 static void
-imapx_meta_attrib_gdestroy (gpointer data)
+camel_imapx_meta_attrib_gdestroy (gpointer data)
 {
 	CamelIMAPXMetaAttrib *ma = (CamelIMAPXMetaAttrib *)data;
-	(void)__KOLAB_imapx_meta_attrib_free (ma);
+	(void)camel_imapx_meta_attrib_free (ma);
 }
 
 /*----------------------------------------------------------------------------*/
 
 CamelIMAPXMetaEntry*
-__KOLAB_imapx_meta_entry_new (void)
+camel_imapx_meta_entry_new (void)
 {
 	CamelIMAPXMetaEntry *me = g_new0 (CamelIMAPXMetaEntry, 1);
 	me->attributes = g_hash_table_new_full (g_str_hash,
 	                                        g_str_equal,
 	                                        g_free,
-	                                        imapx_meta_attrib_gdestroy);
+	                                        camel_imapx_meta_attrib_gdestroy);
 	return me;
 }
 
 gboolean
-__KOLAB_imapx_meta_entry_free (CamelIMAPXMetaEntry *me)
+camel_imapx_meta_entry_free (CamelIMAPXMetaEntry *me)
 {
 	if (me == NULL)
 		return FALSE;
@@ -104,27 +104,27 @@ __KOLAB_imapx_meta_entry_free (CamelIMAPXMetaEntry *me)
 }
 
 static void
-imapx_meta_entry_gdestroy (gpointer data)
+camel_imapx_meta_entry_gdestroy (gpointer data)
 {
 	CamelIMAPXMetaEntry *me = (CamelIMAPXMetaEntry *)data;
-	(void)__KOLAB_imapx_meta_entry_free (me);
+	(void)camel_imapx_meta_entry_free (me);
 }
 
 /*----------------------------------------------------------------------------*/
 
 CamelIMAPXMetaAnnotation*
-__KOLAB_imapx_meta_annotation_new (void)
+camel_imapx_meta_annotation_new (void)
 {
 	CamelIMAPXMetaAnnotation *man = g_new0 (CamelIMAPXMetaAnnotation, 1);
 	man->entries = g_hash_table_new_full (g_str_hash,
 	                                      g_str_equal,
 	                                      g_free,
-	                                      imapx_meta_entry_gdestroy);
+	                                      camel_imapx_meta_entry_gdestroy);
 	return man;
 }
 
 gboolean
-__KOLAB_imapx_meta_annotation_free (CamelIMAPXMetaAnnotation *man)
+camel_imapx_meta_annotation_free (CamelIMAPXMetaAnnotation *man)
 {
 	if (man == NULL)
 		return FALSE;
@@ -137,19 +137,20 @@ __KOLAB_imapx_meta_annotation_free (CamelIMAPXMetaAnnotation *man)
 }
 
 static void
-imapx_meta_annotation_gdestroy (gpointer data)
+camel_imapx_meta_annotation_gdestroy (gpointer data)
 {
 	CamelIMAPXMetaAnnotation *man = (CamelIMAPXMetaAnnotation *)data;
-	(void)__KOLAB_imapx_meta_annotation_free (man);
+	(void)camel_imapx_meta_annotation_free (man);
 }
 
 /*----------------------------------------------------------------------------*/
 
 CamelIMAPXMetaData*
-__KOLAB_imapx_meta_data_new (imapx_meta_data_proto_t proto, gboolean locked)
+camel_imapx_meta_data_new (imapx_meta_data_proto_t proto,
+			   gboolean locked)
 {
 	CamelIMAPXMetaData *md;
-	
+
 	g_assert (proto < CAMEL_IMAPX_METADATA_LAST_PROTO);
 
 	md = g_new0 (CamelIMAPXMetaData, 1);
@@ -162,12 +163,12 @@ __KOLAB_imapx_meta_data_new (imapx_meta_data_proto_t proto, gboolean locked)
 	md->mboxes = g_hash_table_new_full (g_str_hash,
 	                                    g_str_equal,
 	                                    g_free,
-	                                    imapx_meta_annotation_gdestroy);
+	                                    camel_imapx_meta_annotation_gdestroy);
 	return md;
 }
 
 gboolean
-__KOLAB_imapx_meta_data_free (CamelIMAPXMetaData *md)
+camel_imapx_meta_data_free (CamelIMAPXMetaData *md)
 {
 	if (md == NULL)
 		return FALSE;
@@ -185,7 +186,7 @@ __KOLAB_imapx_meta_data_free (CamelIMAPXMetaData *md)
 }
 
 CamelIMAPXMetaData*
-__KOLAB_imapx_meta_data_resect (CamelIMAPXMetaData **md)
+camel_imapx_meta_data_resect (CamelIMAPXMetaData **md)
 {
 	CamelIMAPXMetaData *tmp_md;
 	GMutex *tmp_lock;
@@ -195,9 +196,9 @@ __KOLAB_imapx_meta_data_resect (CamelIMAPXMetaData **md)
 
 	/* (acquire md lock) */
 	g_mutex_lock ((*md)->md_lock);
-	
+
 	tmp_md = *md;
-	*md = __KOLAB_imapx_meta_data_new (tmp_md->proto, FALSE);
+	*md = camel_imapx_meta_data_new (tmp_md->proto, FALSE);
 
 	/* (swap lock pointers of md and tmp_md) */
 	tmp_lock = tmp_md->md_lock;		/* locked   */
@@ -211,7 +212,7 @@ __KOLAB_imapx_meta_data_resect (CamelIMAPXMetaData **md)
 }
 
 imapx_meta_data_proto_t
-__KOLAB_imapx_meta_data_get_proto (CamelIMAPXMetaData *md)
+camel_imapx_meta_data_get_proto (CamelIMAPXMetaData *md)
 {
 	imapx_meta_data_proto_t mp;
 
@@ -222,12 +223,12 @@ __KOLAB_imapx_meta_data_get_proto (CamelIMAPXMetaData *md)
 
 	/* (acquire md lock) */
 	g_mutex_lock (md->md_lock);
-	
+
 	mp = md->proto;
-	
+
 	/* (acquire md lock) */
 	g_mutex_unlock (md->md_lock);
-	
+
 	return mp;
 }
 
@@ -255,7 +256,7 @@ __KOLAB_imapx_meta_data_get_proto (CamelIMAPXMetaData *md)
  *  ; notification of annotation changes
  *
  * entry-att = entry SP "(" att-value *(SP att-value) ")"
- * 
+ *
  * entry = string
  *  ; slash-separated path to entry
  *  ; MUST NOT contain "*" or "%"
@@ -265,46 +266,46 @@ __KOLAB_imapx_meta_data_get_proto (CamelIMAPXMetaData *md)
  * attrib = string
  *  ; dot-separated attribute name
  *  ; MUST NOT contain "*" or "%"
- * 
+ *
  * value = nstring
  *
  * nstring = string / "NIL"
  */
 static gboolean
-imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md, CamelIMAPXStream *is, GError **err)
+camel_imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md,
+						 CamelIMAPXStream *is,
+						 GCancellable *cancellable,
+						 GError **err)
 {
-	CamelException *ex;
-	GError *tmp_err = NULL;
 	gint tok;
 	guint len;
 	guchar *token;
+	GError *tmp_err = NULL;
 
 	gchar *mbox_name;
 	gchar *annot_name;
 
 	CamelIMAPXMetaAnnotation *man;
 	CamelIMAPXMetaEntry *me;
-	
+
 	g_assert (md != NULL);
 	g_assert (md->mboxes != NULL);
 	g_assert (is != NULL);
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
-	ex = camel_exception_new ();
-	
 	/* mailbox name */
-	tok = __KOLAB_camel_imapx_stream_astring(is, &token, ex);
-	if (camel_exception_is_set (ex)) {
-		kolab_gerror_propagate_from_camelexception (err, ex, KOLAB_CAMEL_ERROR);
+	tok = camel_imapx_stream_astring(is, &token, cancellable, &tmp_err);
+	if (tmp_err != NULL) {
+		g_propagate_error (err, tmp_err);
 		return FALSE;
 	}
 	mbox_name = g_strdup ((gchar *) token);
 
 	/* annotation name */
-	tok = __KOLAB_camel_imapx_stream_astring(is, &token, ex);
-	if (camel_exception_is_set (ex)) {
+	tok = camel_imapx_stream_astring(is, &token, cancellable, &tmp_err);
+	if (tmp_err != NULL) {
 		g_free (mbox_name);
-		kolab_gerror_propagate_from_camelexception (err, ex, KOLAB_CAMEL_ERROR);
+		g_propagate_error (err, tmp_err);
 		return FALSE;
 	}
 	annot_name = g_strdup ((gchar *) token);
@@ -312,7 +313,7 @@ imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md, CamelIMAPXStr
 	/* get annotation structure */
 	man = g_hash_table_lookup (md->mboxes, mbox_name);
 	if (man == NULL) {
-		man = __KOLAB_imapx_meta_annotation_new ();
+		man = camel_imapx_meta_annotation_new ();
 		g_hash_table_insert (md->mboxes,
 		                     g_strdup (mbox_name),
 		                     man);
@@ -321,7 +322,7 @@ imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md, CamelIMAPXStr
 	/* get entry structure */
 	me = g_hash_table_lookup (man->entries, annot_name);
 	if (me == NULL) {
-		me = __KOLAB_imapx_meta_entry_new ();
+		me = camel_imapx_meta_entry_new ();
 		g_hash_table_insert (man->entries,
 		                     g_strdup (annot_name),
 		                     me);
@@ -329,14 +330,14 @@ imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md, CamelIMAPXStr
 
 	g_free (annot_name);
 	g_free (mbox_name);
-	
+
 	/* parse and add entry attributes
 	 * If parse fails, *man and *me will stay around, keeping the
 	 * contents we were able to parse before failure
 	 */
-	tok = __KOLAB_camel_imapx_stream_token (is, &token, &len, ex);
-	if (camel_exception_is_set (ex)) {
-		kolab_gerror_propagate_from_camelexception (err, ex, KOLAB_CAMEL_ERROR);
+	tok = camel_imapx_stream_token (is, &token, &len, cancellable, &tmp_err);
+	if (tmp_err != NULL) {
+		g_propagate_error (err, tmp_err);
 		return FALSE;
 	}
 	if (tok != '(') {
@@ -353,32 +354,32 @@ imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md, CamelIMAPXStr
 		gchar *attrib_suffix[2];
 		guchar *attrib_value;
 		imapx_meta_data_access_t acc;
-		
-		tok = __KOLAB_camel_imapx_stream_token (is, &token, &len, ex);
-		if (camel_exception_is_set (ex)) {
-			kolab_gerror_propagate_from_camelexception (err, ex, KOLAB_CAMEL_ERROR);
+
+		tok = camel_imapx_stream_token (is, &token, &len, cancellable, &tmp_err);
+		if (tmp_err != NULL) {
+			g_propagate_error (err, tmp_err);
 			return FALSE;
 		}
 		if (tok == ')')
 			break;
-		__KOLAB_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 = __KOLAB_camel_imapx_stream_astring(is, &token, ex);
-		if (camel_exception_is_set (ex)) {
-			kolab_gerror_propagate_from_camelexception (err, ex, KOLAB_CAMEL_ERROR);
+		tok = camel_imapx_stream_astring(is, &token, cancellable, &tmp_err);
+		if (tmp_err != NULL) {
+			g_propagate_error (err, tmp_err);
 			return FALSE;
 		}
 		attrib_name = g_strdup ((gchar* ) token);
 
 		/* attribute value */
-		tok = __KOLAB_camel_imapx_stream_nstring(is, &token, ex);
-		if (camel_exception_is_set (ex)) {
+		tok = camel_imapx_stream_nstring(is, &token, cancellable, &tmp_err);
+		if (tmp_err != NULL) {
 			g_free (attrib_name);
-			kolab_gerror_propagate_from_camelexception (err, ex, KOLAB_CAMEL_ERROR);
+			g_propagate_error (err, tmp_err);
 			return FALSE;
 		}
 		attrib_value = token; /* token owned by stream, do not g_free(attrib_value) */
@@ -401,7 +402,7 @@ imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md, CamelIMAPXStr
 		/* get/create and fill attribute structure */
 		ma = g_hash_table_lookup (me->attributes, attrib_name);
 		if (ma == NULL) {
-			ma = __KOLAB_imapx_meta_attrib_new ();
+			ma = camel_imapx_meta_attrib_new ();
 			g_hash_table_insert (me->attributes,
 			                     g_strdup (attrib_name),
 			                     ma);
@@ -429,7 +430,7 @@ imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md, CamelIMAPXStr
 			goto val_add_done;
 		}
 
-		valid_utf8 = g_utf8_validate ((gchar*) attrib_value, len, NULL);
+		valid_utf8 = g_utf8_validate ((gchar*) attrib_value, (gssize) len, NULL);
 		if (valid_utf8) {
 			/* value is still stored as byte array (guchar),
 			 * no type conversion here (just info)
@@ -445,7 +446,7 @@ imapx_meta_data_parse_annotation_response (CamelIMAPXMetaData *md, CamelIMAPXStr
 		ma->type[acc] = CAMEL_IMAPX_META_ATTRIB_TYPE_BINARY;
 		} /* add done */
 val_add_done:
-		
+
 		/* cleanup: restore attrib_name (undo NUL insertion), then free it */
 		if (attrib_suffix[0] != NULL)
 			attrib_suffix[0][0] = '.';
@@ -454,16 +455,19 @@ val_add_done:
 		g_free (attrib_name);
 	}
 
-	camel_exception_free (ex);
-
 	return TRUE;
 }
 
 static gboolean
-imapx_meta_data_parse_metadata_response (CamelIMAPXMetaData *md, CamelIMAPXStream *is, GError **err)
+camel_imapx_meta_data_parse_metadata_response (CamelIMAPXMetaData *md,
+					       CamelIMAPXStream *is,
+					       GCancellable *cancellable,
+					       GError **err)
 {
 	/* TODO implement me*/
 
+	(void)cancellable;
+
 	g_assert (md != NULL);
 	g_assert (md->mboxes != NULL);
 	g_assert (is != NULL);
@@ -473,11 +477,14 @@ imapx_meta_data_parse_metadata_response (CamelIMAPXMetaData *md, CamelIMAPXStrea
 }
 
 gboolean
-__KOLAB_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md, CamelIMAPXStream *is, GError **err)
+camel_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md,
+						CamelIMAPXStream *is,
+						GCancellable *cancellable,
+						GError **err)
 {
 	GError *tmp_err = NULL;
 	gboolean parse_ok;
-	
+
 	g_assert (md != NULL);
 	g_assert (md->mboxes != NULL);
 	g_assert (is != NULL);
@@ -485,17 +492,19 @@ __KOLAB_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md, CamelI
 
 	/* (acquire md lock ) */
 	g_mutex_lock (md->md_lock);
-	
+
 	switch (md->proto) {
 		case CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE:
-			parse_ok = imapx_meta_data_parse_annotation_response (md,
-			                                                      is,
-			                                                      &tmp_err);
+			parse_ok = camel_imapx_meta_data_parse_annotation_response (md,
+										    is,
+										    cancellable,
+										    &tmp_err);
 			break;
 		case CAMEL_IMAPX_METADATA_PROTO_METADATA:
-			parse_ok = imapx_meta_data_parse_metadata_response (md,
-			                                                    is,
-			                                                    &tmp_err);
+			parse_ok = camel_imapx_meta_data_parse_metadata_response (md,
+										  is,
+										  cancellable,
+										  &tmp_err);
 			break;
 		case CAMEL_IMAPX_METADATA_PROTO_INVAL:
 			/* (release md lock) */
@@ -510,9 +519,9 @@ __KOLAB_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md, CamelI
 			/* can't happen... */
 			g_error ("%s: have unknown metadata protocol type %i",
 			         __func__, md->proto);
-			
+
 	}
-	
+
 	/* (release md lock) */
 	g_mutex_unlock (md->md_lock);
 
@@ -520,24 +529,24 @@ __KOLAB_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData *md, CamelI
 		g_propagate_error (err, tmp_err);
 		return FALSE;
 	}
-	
+
 	return TRUE;
 }
 
 GSList*
-__KOLAB_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
+camel_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 {
 	GSList *commands = NULL;
 	GHashTableIter md_iter;
 	gpointer md_key, md_value;
-	
+
 	if (md == NULL)
 		return NULL;
 
 	g_assert (md->md_lock != NULL);
 	/* (acquire md lock ) */
 	g_mutex_lock (md->md_lock);
-	
+
 	if (md->mboxes == NULL) {
 		/* (release md lock) */
 		g_mutex_unlock (md->md_lock);
@@ -581,21 +590,21 @@ __KOLAB_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 					g_string_free (cmd, TRUE);
 				g_debug ("%s: command list empty due to invalid annotation protocol",
 				         __func__);
-				return NULL;					
+				return NULL;
 			default:
 				/* FIXME better handling here */
 				g_assert_not_reached ();
 			}
 			cmd = g_string_new (cmd_top);
 			g_free (cmd_top);
-			
+
 			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;
-				
+
 				for (acc = 0; acc < CAMEL_IMAPX_METADATA_LAST_ACCESS; acc++) {
 					if (ma->type[acc] == CAMEL_IMAPX_META_ATTRIB_TYPE_UNSET)
 						/* caution: UNSET != NIL (for NIL, a command gets issued) */
@@ -616,7 +625,7 @@ __KOLAB_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 							                              attrib_name);
 						else
 							attrib_str = g_strdup_printf ("\"%s.shared\"",
-							                              attrib_name);							
+							                              attrib_name);
 						break;
 					case CAMEL_IMAPX_METADATA_PROTO_METADATA:
 						/* FIXME untested! */
@@ -629,7 +638,7 @@ __KOLAB_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 						else
 							attrib_str = g_strdup_printf ("/shared%s/%s",
 							                              annot_name,
-							                              attrib_name);							
+							                              attrib_name);
 						break;
 					case CAMEL_IMAPX_METADATA_PROTO_INVAL:
 						/* (release md lock) */
@@ -637,13 +646,13 @@ __KOLAB_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 						if (commands != NULL)
 							g_slist_free (commands);
 						if (cmd != NULL)
-							g_string_free (cmd, TRUE);						
+							g_string_free (cmd, TRUE);
 						g_debug ("%s: command list empty due to invalid annotation protocol",
 						         __func__);
-						return NULL;					
+						return NULL;
 					default:
 						/* FIXME better handling here */
-						g_assert_not_reached ();							
+						g_assert_not_reached ();
 					}
 					g_string_append (cmd, attrib_str);
 					g_free (attrib_str);
@@ -671,12 +680,12 @@ __KOLAB_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 						g_string_append (cmd, "\"");
 						g_string_append_len (cmd,
 								     (gchar *) ma->data[acc]->data,
-								     ma->data[acc]->len);
+								     (gssize) ma->data[acc]->len);
 						g_string_append (cmd, "\"");
 						break;
 					default:
 						/* FIXME better handling here */
-						g_assert_not_reached ();							
+						g_assert_not_reached ();
 					}
 				}
 			}
@@ -701,11 +710,11 @@ __KOLAB_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData *md)
 /*----------------------------------------------------------------------------*/
 
 CamelIMAPXMetaDataSpec*
-__KOLAB_imapx_meta_data_spec_new (CamelIMAPXMetaData *md,
-                                  const gchar *mailbox_name,
-                                  const gchar *entry_name,
-                                  const gchar *attrib_name,
-                                  GError **err)
+camel_imapx_meta_data_spec_new (CamelIMAPXMetaData *md,
+				const gchar *mailbox_name,
+				const gchar *entry_name,
+				const gchar *attrib_name,
+				GError **err)
 {
 	CamelIMAPXMetaDataSpec *spec;
 	imapx_meta_data_proto_t mp;
@@ -715,7 +724,7 @@ __KOLAB_imapx_meta_data_spec_new (CamelIMAPXMetaData *md,
 	/* attrib_name may be NULL, will then be replaced by "value" */
 	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
 
-	mp = __KOLAB_imapx_meta_data_get_proto (md);
+	mp = camel_imapx_meta_data_get_proto (md);
 
 	/* scan for invalid name tokens */
 	switch (mp) {
@@ -771,7 +780,7 @@ __KOLAB_imapx_meta_data_spec_new (CamelIMAPXMetaData *md,
 
 	spec = g_new0 (CamelIMAPXMetaDataSpec, 1);
 	spec->proto = mp;
-	
+
 	if (mailbox_name != NULL)
 		spec->mailbox_name = g_strdup (mailbox_name);
 	else
@@ -788,7 +797,7 @@ __KOLAB_imapx_meta_data_spec_new (CamelIMAPXMetaData *md,
 }
 
 gboolean
-__KOLAB_imapx_meta_data_spec_free (CamelIMAPXMetaDataSpec *spec)
+camel_imapx_meta_data_spec_free (CamelIMAPXMetaDataSpec *spec)
 {
 	if (spec == NULL)
 		return FALSE;
@@ -808,17 +817,17 @@ __KOLAB_imapx_meta_data_spec_free (CamelIMAPXMetaDataSpec *spec)
 /*----------------------------------------------------------------------------*/
 
 CamelIMAPXMetaAttrib*
-__KOLAB_imapx_meta_data_get_attrib_from_entry (CamelIMAPXMetaEntry *me,
-                                               CamelIMAPXMetaDataSpec *spec)
+camel_imapx_meta_data_get_attrib_from_entry (CamelIMAPXMetaEntry *me,
+					     CamelIMAPXMetaDataSpec *spec)
 {
 	CamelIMAPXMetaAttrib *ma;
 	gchar *attrib_name;
 
 	if ((me == NULL) || (spec == NULL))
 		return NULL;
-	
+
 	g_assert (me->attributes != NULL);
-	
+
 	/* spec->attrib_name can be NULL, subst "value" then */
 	if (spec->attrib_name == NULL)
 		attrib_name = g_strdup ("value");
@@ -826,7 +835,7 @@ __KOLAB_imapx_meta_data_get_attrib_from_entry (CamelIMAPXMetaEntry *me,
 		attrib_name = spec->attrib_name;
 
 	ma = g_hash_table_lookup (me->attributes, attrib_name);
-	
+
 	if (spec->attrib_name == NULL)
 		g_free (attrib_name);
 
@@ -834,8 +843,8 @@ __KOLAB_imapx_meta_data_get_attrib_from_entry (CamelIMAPXMetaEntry *me,
 }
 
 CamelIMAPXMetaAttrib*
-__KOLAB_imapx_meta_data_get_attrib_from_annotation (CamelIMAPXMetaAnnotation *man,
-                                                    CamelIMAPXMetaDataSpec *spec)
+camel_imapx_meta_data_get_attrib_from_annotation (CamelIMAPXMetaAnnotation *man,
+						  CamelIMAPXMetaDataSpec *spec)
 {
 	CamelIMAPXMetaEntry *me;
 	CamelIMAPXMetaAttrib *ma;
@@ -850,13 +859,13 @@ __KOLAB_imapx_meta_data_get_attrib_from_annotation (CamelIMAPXMetaAnnotation *ma
 	if (me == NULL)
 		return NULL;
 
-	ma = __KOLAB_imapx_meta_data_get_attrib_from_entry (me, spec);
+	ma = camel_imapx_meta_data_get_attrib_from_entry (me, spec);
 	return ma;
 }
 
 CamelIMAPXMetaAttrib*
-__KOLAB_imapx_meta_data_get_attrib_from_metadata (CamelIMAPXMetaData *md,
-                                                  CamelIMAPXMetaDataSpec *spec)
+camel_imapx_meta_data_get_attrib_from_metadata (CamelIMAPXMetaData *md,
+						CamelIMAPXMetaDataSpec *spec)
 {
 	CamelIMAPXMetaAnnotation *man;
 	CamelIMAPXMetaAttrib *ma;
@@ -871,6 +880,8 @@ __KOLAB_imapx_meta_data_get_attrib_from_metadata (CamelIMAPXMetaData *md,
 	if (man == NULL)
 		return NULL;
 
-	ma = __KOLAB_imapx_meta_data_get_attrib_from_annotation (man, spec);
+	ma = camel_imapx_meta_data_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 b29547b..0efa9ac 100644
--- a/src/camel/providers/imapx/camel-imapx-metadata.h
+++ b/src/camel/providers/imapx/camel-imapx-metadata.h
@@ -11,12 +11,12 @@
  * 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
@@ -50,7 +50,7 @@
  * are separate entries for shared and private annotations.
  *
  * Result:
- * 
+ *
  *
  * Since METADATA allows for binary values, we need to take care that we
  * can handle NUL data bytes, hence the choice of GByteArray for values (which
@@ -70,7 +70,7 @@ typedef enum {
 typedef enum {
 	CAMEL_IMAPX_METADATA_ACCESS_PRIVATE = 0,
 	CAMEL_IMAPX_METADATA_ACCESS_SHARED,
-	CAMEL_IMAPX_METADATA_LAST_ACCESS 
+	CAMEL_IMAPX_METADATA_LAST_ACCESS
 } imapx_meta_data_access_t;
 
 typedef enum {
@@ -116,28 +116,28 @@ typedef struct _CamelIMAPXMetaData {
 
 
 
-CamelIMAPXMetaAttrib *__KOLAB_imapx_meta_attrib_new (void);
-gboolean __KOLAB_imapx_meta_attrib_free (CamelIMAPXMetaAttrib*);
+CamelIMAPXMetaAttrib *camel_imapx_meta_attrib_new (void);
+gboolean camel_imapx_meta_attrib_free (CamelIMAPXMetaAttrib*);
 
-CamelIMAPXMetaEntry *__KOLAB_imapx_meta_entry_new (void);
-gboolean __KOLAB_imapx_meta_entry_free (CamelIMAPXMetaEntry*);
+CamelIMAPXMetaEntry *camel_imapx_meta_entry_new (void);
+gboolean camel_imapx_meta_entry_free (CamelIMAPXMetaEntry*);
 
-CamelIMAPXMetaAnnotation *__KOLAB_imapx_meta_annotation_new (void);
-gboolean __KOLAB_imapx_meta_annotation_free (CamelIMAPXMetaAnnotation*);
+CamelIMAPXMetaAnnotation *camel_imapx_meta_annotation_new (void);
+gboolean camel_imapx_meta_annotation_free (CamelIMAPXMetaAnnotation*);
 
-CamelIMAPXMetaData *__KOLAB_imapx_meta_data_new (imapx_meta_data_proto_t, gboolean);
-CamelIMAPXMetaData *__KOLAB_imapx_meta_data_resect (CamelIMAPXMetaData**);
-gboolean __KOLAB_imapx_meta_data_free (CamelIMAPXMetaData*);
-imapx_meta_data_proto_t __KOLAB_imapx_meta_data_get_proto (CamelIMAPXMetaData*);
-gboolean __KOLAB_imapx_meta_data_add_from_server_response (CamelIMAPXMetaData*, CamelIMAPXStream*, GError**);
-GSList *__KOLAB_imapx_meta_data_new_commandlist (const CamelIMAPXMetaData*);
+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 *__KOLAB_imapx_meta_data_spec_new (CamelIMAPXMetaData*, const gchar*, const gchar*, const gchar*, GError**);
-gboolean __KOLAB_imapx_meta_data_spec_free (CamelIMAPXMetaDataSpec*);
+CamelIMAPXMetaDataSpec *camel_imapx_meta_data_spec_new (CamelIMAPXMetaData*, const gchar*, const gchar*, const gchar*, GError**);
+gboolean camel_imapx_meta_data_spec_free (CamelIMAPXMetaDataSpec*);
 
-CamelIMAPXMetaAttrib *__KOLAB_imapx_meta_data_get_attrib_from_entry (CamelIMAPXMetaEntry*, CamelIMAPXMetaDataSpec*);
-CamelIMAPXMetaAttrib *__KOLAB_imapx_meta_data_get_attrib_from_annotation (CamelIMAPXMetaAnnotation*, CamelIMAPXMetaDataSpec*);
-CamelIMAPXMetaAttrib *__KOLAB_imapx_meta_data_get_attrib_from_metadata (CamelIMAPXMetaData*, 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*);
 
 /*----------------------------------------------------------------------------*/
 



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