[evolution-kolab/ek-wip-porting-imapx] IMAPX: conditionally include config.h in extension files
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting-imapx] IMAPX: conditionally include config.h in extension files
- Date: Mon, 5 Dec 2011 17:23:33 +0000 (UTC)
commit 2f1ee4d2b439a34c5a96fee9efccba6eb8dd0c3c
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Dec 5 18:22:24 2011 +0100
IMAPX: conditionally include config.h in extension files
* added conditional include of config.h to the
extension files where it was missing
* re-indented
.../providers/imapx/camel-imapx-extd-folder.c | 4 +
.../providers/imapx/camel-imapx-extd-server.c | 4 +
src/camel/providers/imapx/camel-imapx-metadata.c | 176 ++++++++++----------
3 files changed, 98 insertions(+), 86 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-extd-folder.c b/src/camel/providers/imapx/camel-imapx-extd-folder.c
index 72b997c..e1a4586 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-folder.c
+++ b/src/camel/providers/imapx/camel-imapx-extd-folder.c
@@ -25,6 +25,10 @@
/*----------------------------------------------------------------------------*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "camel-imapx-extd-folder.h"
/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-server.c b/src/camel/providers/imapx/camel-imapx-extd-server.c
index 3291d61..f21fce9 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-server.c
+++ b/src/camel/providers/imapx/camel-imapx-extd-server.c
@@ -25,6 +25,10 @@
/*----------------------------------------------------------------------------*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "camel-imapx-extd-server.h"
/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-metadata.c b/src/camel/providers/imapx/camel-imapx-metadata.c
index 4a84b3b..0986cf7 100644
--- a/src/camel/providers/imapx/camel-imapx-metadata.c
+++ b/src/camel/providers/imapx/camel-imapx-metadata.c
@@ -26,6 +26,10 @@
/*----------------------------------------------------------------------------*/
/* ANNOTATEMORE / METADATA (RFC 5464) */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <string.h>
/* Kolab error reporting */
@@ -344,7 +348,9 @@ camel_imapx_metadata_parse_annotation_response (CamelImapxMetadata *md,
gchar *attrib_name = NULL;
gchar *attrib_suffix[2] = {NULL, NULL};
guchar *attrib_value = NULL;
- camel_imapx_metadata_access_t acc;
+ camel_imapx_metadata_access_t acc = CAMEL_IMAPX_METADATA_ACCESS_PRIVATE;
+ gboolean valid_utf8 = FALSE;
+ guint len = 0;
tok = camel_imapx_stream_token (is, &token, &len, cancellable, &tmp_err);
if (tmp_err != NULL) {
@@ -356,8 +362,8 @@ camel_imapx_metadata_parse_annotation_response (CamelImapxMetadata *md,
camel_imapx_stream_ungettoken (is, tok, token, len);
/* we do not handle unsolicited responses here, so
- * do not ENABLE them on the server
- */
+ * do not ENABLE them on the server
+ */
/* attribute name */
tok = camel_imapx_stream_astring (is, &token, cancellable, &tmp_err);
if (tmp_err != NULL) {
@@ -400,15 +406,12 @@ camel_imapx_metadata_parse_annotation_response (CamelImapxMetadata *md,
}
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 */
- }
-
- { /* add value data to attribute structure */
- gboolean valid_utf8;
- guint len;
+ g_byte_array_free (ma->data[acc], TRUE);
+ g_byte_array_unref (ma->data[acc]);
+ /* refcount should now be 0 */
+ }
+ /* add value data to attribute structure */
len = strlen ((gchar*) attrib_value);
ma->data[acc] = g_byte_array_new ();
g_byte_array_append (ma->data[acc],
@@ -435,8 +438,9 @@ camel_imapx_metadata_parse_annotation_response (CamelImapxMetadata *md,
* NUL-terminated string with unknown encoding here
*/
ma->type[acc] = CAMEL_IMAPX_METADATA_ATTRIB_TYPE_BINARY;
- } /* add done */
-val_add_done:
+ /* add done */
+
+ val_add_done:
/* cleanup: restore attrib_name (undo NUL insertion), then free it */
if (attrib_suffix[0] != NULL)
@@ -485,31 +489,31 @@ camel_imapx_metadata_add_from_server_response (CamelImapxMetadata *md,
g_mutex_lock (md->md_lock);
switch (md->proto) {
- case CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE:
- parse_ok = camel_imapx_metadata_parse_annotation_response (md,
- is,
- cancellable,
- &tmp_err);
- break;
- case CAMEL_IMAPX_METADATA_PROTO_METADATA:
- parse_ok = camel_imapx_metadata_parse_metadata_response (md,
- is,
- cancellable,
- &tmp_err);
- break;
- case CAMEL_IMAPX_METADATA_PROTO_INVAL:
- /* (release md lock) */
- g_mutex_unlock (md->md_lock);
- g_set_error (err,
- KOLAB_CAMEL_ERROR,
- KOLAB_CAMEL_ERROR_GENERIC,
- "%s: invalid annotation protocol",
- __func__);
- return FALSE;
- default:
- /* can't happen... */
- g_error ("%s: have unknown metadata protocol type %i",
- __func__, md->proto);
+ case CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE:
+ parse_ok = camel_imapx_metadata_parse_annotation_response (md,
+ is,
+ cancellable,
+ &tmp_err);
+ break;
+ case CAMEL_IMAPX_METADATA_PROTO_METADATA:
+ parse_ok = camel_imapx_metadata_parse_metadata_response (md,
+ is,
+ cancellable,
+ &tmp_err);
+ break;
+ case CAMEL_IMAPX_METADATA_PROTO_INVAL:
+ /* (release md lock) */
+ g_mutex_unlock (md->md_lock);
+ g_set_error (err,
+ KOLAB_CAMEL_ERROR,
+ KOLAB_CAMEL_ERROR_GENERIC,
+ "%s: invalid annotation protocol",
+ __func__);
+ return FALSE;
+ default:
+ /* can't happen... */
+ g_error ("%s: have unknown metadata protocol type %i",
+ __func__, md->proto);
}
/* (release md lock) */
@@ -672,8 +676,8 @@ camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md)
g_assert (ma->data[acc]->data != NULL);
g_string_append (cmd, "\"");
g_string_append_len (cmd,
- (gchar *) ma->data[acc]->data,
- (gssize) ma->data[acc]->len);
+ (gchar *) ma->data[acc]->data,
+ (gssize) ma->data[acc]->len);
g_string_append (cmd, "\"");
break;
default:
@@ -720,54 +724,54 @@ camel_imapx_metadata_spec_new (camel_imapx_metadata_proto_t proto,
/* scan for invalid name tokens */
switch (proto) {
- case CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE: {
- gboolean parse_err = FALSE;
- /* TODO parse for unwanted tokens */
- if (parse_err) {
- g_set_error (err,
- KOLAB_CAMEL_ERROR,
- KOLAB_CAMEL_ERROR_GENERIC,
- "%s: invalid token in meta data spec",
- __func__);
- return NULL;
- }
- break;
+ case CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE: {
+ gboolean parse_err = FALSE;
+ /* TODO parse for unwanted tokens */
+ if (parse_err) {
+ g_set_error (err,
+ KOLAB_CAMEL_ERROR,
+ KOLAB_CAMEL_ERROR_GENERIC,
+ "%s: invalid token in meta data spec",
+ __func__);
+ return NULL;
}
- case CAMEL_IMAPX_METADATA_PROTO_METADATA: {
- gboolean parse_err = FALSE;
- /* parse for unwanted tokens */
- /* METADATA has no notion of attribute sets.
- * The only attribute is 'value' and thus is
- * not specifically referenced. We'll take ownership
- * here of the string nonetheless to be consistent
- */
- /* TODO improve (encodings, ...) */
- /* FIXME untested */
- if (mailbox_name != NULL) {
- parse_err = parse_err || (g_strrstr (mailbox_name, "%") != NULL);
- parse_err = parse_err || (g_strrstr (mailbox_name, "*") != NULL);
- }
- if (entry_name != NULL) {
- parse_err = parse_err || (g_strrstr (entry_name, "%") != NULL);
- parse_err = parse_err || (g_strrstr (entry_name, "*") != NULL);
- }
- /* attrib_name ignored */
- if (parse_err) {
- g_set_error (err,
- KOLAB_CAMEL_ERROR,
- KOLAB_CAMEL_ERROR_GENERIC,
- "%s: invalid token in meta data spec",
- __func__);
- return NULL;
- }
- break;
+ break;
+ }
+ case CAMEL_IMAPX_METADATA_PROTO_METADATA: {
+ gboolean parse_err = FALSE;
+ /* parse for unwanted tokens */
+ /* METADATA has no notion of attribute sets.
+ * The only attribute is 'value' and thus is
+ * not specifically referenced. We'll take ownership
+ * here of the string nonetheless to be consistent
+ */
+ /* TODO improve (encodings, ...) */
+ /* FIXME untested */
+ if (mailbox_name != NULL) {
+ parse_err = parse_err || (g_strrstr (mailbox_name, "%") != NULL);
+ parse_err = parse_err || (g_strrstr (mailbox_name, "*") != NULL);
}
- case CAMEL_IMAPX_METADATA_PROTO_INVAL:
- break;
- default:
- /* can't happen... */
- g_error ("%s: have unknown metadata protocol type %i",
- __func__, proto);
+ if (entry_name != NULL) {
+ parse_err = parse_err || (g_strrstr (entry_name, "%") != NULL);
+ parse_err = parse_err || (g_strrstr (entry_name, "*") != NULL);
+ }
+ /* attrib_name ignored */
+ if (parse_err) {
+ g_set_error (err,
+ KOLAB_CAMEL_ERROR,
+ KOLAB_CAMEL_ERROR_GENERIC,
+ "%s: invalid token in meta data spec",
+ __func__);
+ return NULL;
+ }
+ break;
+ }
+ case CAMEL_IMAPX_METADATA_PROTO_INVAL:
+ break;
+ default:
+ /* can't happen... */
+ g_error ("%s: have unknown metadata protocol type %i",
+ __func__, proto);
}
spec = g_new0 (CamelImapxMetadataSpec, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]