[evolution-data-server/imap-notify: 4/23] Add CamelIMAPXNamespaceResponse.



commit 824f109080ddef0c5c8ff21ebcdafbaac430cc24
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Aug 20 09:03:23 2013 -0400

    Add CamelIMAPXNamespaceResponse.
    
    Encapsulates an IMAP NAMESPACE response, which consists of a set of
    CamelIMAPXNamespace objects group by CamelIMAPXNamespaceCategory.
    
    This will replace CamelIMAPXNamespaceList and related functions.

 camel/Makefile.am                       |    2 +
 camel/camel-imapx-namespace-response.c  |  534 +++++++++++++++++++++++++++++++
 camel/camel-imapx-namespace-response.h  |   96 ++++++
 camel/camel.h                           |    1 +
 docs/reference/camel/camel-docs.sgml    |    1 +
 docs/reference/camel/camel-sections.txt |   22 ++
 docs/reference/camel/camel.types        |    1 +
 7 files changed, 657 insertions(+), 0 deletions(-)
---
diff --git a/camel/Makefile.am b/camel/Makefile.am
index d9d9579..403260d 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -179,6 +179,7 @@ libcamel_1_2_la_SOURCES =                   \
        camel-imapx-job.c                       \
        camel-imapx-list-response.c             \
        camel-imapx-namespace.c                 \
+       camel-imapx-namespace-response.c        \
        camel-imapx-search.c                    \
        camel-imapx-server.c                    \
        camel-imapx-settings.c                  \
@@ -315,6 +316,7 @@ libcamelinclude_HEADERS =                   \
        camel-imapx-job.h                       \
        camel-imapx-list-response.h             \
        camel-imapx-namespace.h                 \
+       camel-imapx-namespace-response.h        \
        camel-imapx-search.h                    \
        camel-imapx-server.h                    \
        camel-imapx-settings.h                  \
diff --git a/camel/camel-imapx-namespace-response.c b/camel/camel-imapx-namespace-response.c
new file mode 100644
index 0000000..2a750e1
--- /dev/null
+++ b/camel/camel-imapx-namespace-response.c
@@ -0,0 +1,534 @@
+/*
+ * camel-imapx-namespace-response.c
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+/**
+ * SECTION: camel-imapx-namespace-response
+ * @include: camel/camel.h
+ * @short_description: Stores an IMAP NAMESPACE response
+ *
+ * #CamelIMAPXNamespaceResponse encapsulates an IMAP NAMESPACE response,
+ * which consists of a set of #CamelIMAPXNamespace objects grouped by
+ * #CamelIMAPXNamespaceCategory.
+ **/
+
+#include "camel-imapx-namespace-response.h"
+
+#include <string.h>
+
+#include <camel/camel-imapx-utils.h>
+
+#define CAMEL_IMAPX_NAMESPACE_RESPONSE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE, CamelIMAPXNamespaceResponsePrivate))
+
+struct _CamelIMAPXNamespaceResponsePrivate {
+       GQueue namespaces;
+};
+
+G_DEFINE_TYPE (
+       CamelIMAPXNamespaceResponse,
+       camel_imapx_namespace_response,
+       G_TYPE_OBJECT)
+
+static void
+imapx_namespace_response_add (CamelIMAPXNamespaceResponse *response,
+                              CamelIMAPXNamespaceCategory category,
+                              const gchar *prefix,
+                              gchar separator)
+{
+       CamelIMAPXNamespace *namespace;
+
+       namespace = camel_imapx_namespace_new (category, prefix, separator);
+       g_queue_push_tail (&response->priv->namespaces, namespace);
+}
+
+static void
+imapx_namespace_response_dispose (GObject *object)
+{
+       CamelIMAPXNamespaceResponsePrivate *priv;
+
+       priv = CAMEL_IMAPX_NAMESPACE_RESPONSE_GET_PRIVATE (object);
+
+       while (!g_queue_is_empty (&priv->namespaces))
+               g_object_unref (g_queue_pop_head (&priv->namespaces));
+
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (camel_imapx_namespace_response_parent_class)->
+               dispose (object);
+}
+
+static void
+camel_imapx_namespace_response_class_init (CamelIMAPXNamespaceResponseClass *class)
+{
+       GObjectClass *object_class;
+
+       g_type_class_add_private (
+               class, sizeof (CamelIMAPXNamespaceResponsePrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->dispose = imapx_namespace_response_dispose;
+}
+
+static void
+camel_imapx_namespace_response_init (CamelIMAPXNamespaceResponse *response)
+{
+       response->priv =
+               CAMEL_IMAPX_NAMESPACE_RESPONSE_GET_PRIVATE (response);
+}
+
+static gboolean
+imapx_namespace_response_parse_namespace (CamelIMAPXStream *stream,
+                                          CamelIMAPXNamespaceResponse *response,
+                                          CamelIMAPXNamespaceCategory category,
+                                          GCancellable *cancellable,
+                                          GError **error)
+{
+       camel_imapx_token_t tok;
+       guchar *token;
+       guint len;
+       gchar *prefix;
+       gchar separator;
+
+       tok = camel_imapx_stream_token (
+               stream, &token, &len, cancellable, error);
+       if (tok == IMAPX_TOK_ERROR)
+               return FALSE;
+       if (tok == IMAPX_TOK_TOKEN) {
+               if (g_ascii_toupper (token[0]) == 'N' &&
+                   g_ascii_toupper (token[1]) == 'I' &&
+                   g_ascii_toupper (token[2]) == 'L' &&
+                   token[3] == 0)
+                       return TRUE;
+       }
+       if (tok != '(') {
+               g_set_error (
+                       error, CAMEL_IMAPX_ERROR, 1,
+                       "namespace: expecting NIL or '('");
+               return FALSE;
+       }
+
+repeat:
+       tok = camel_imapx_stream_token (
+               stream, &token, &len, cancellable, error);
+       if (tok == IMAPX_TOK_ERROR)
+               return FALSE;
+       if (tok != '(') {
+               g_set_error (
+                       error, CAMEL_IMAPX_ERROR, 1,
+                       "namespace: expecting '('");
+               return FALSE;
+       }
+
+       tok = camel_imapx_stream_token (
+               stream, &token, &len, cancellable, error);
+       if (tok == IMAPX_TOK_ERROR)
+               return FALSE;
+       if (tok != IMAPX_TOK_STRING) {
+               g_set_error (
+                       error, CAMEL_IMAPX_ERROR, 1,
+                       "namespace: expecting string");
+               return FALSE;
+       }
+
+       prefix = g_strdup ((gchar *) token);
+
+       if (!camel_imapx_stream_nstring (stream, &token, cancellable, error)) {
+               g_free (prefix);
+               return FALSE;
+       }
+
+       separator = (token != NULL) ? (gchar) *token : '\0';
+
+       imapx_namespace_response_add (response, category, prefix, separator);
+
+       g_free (prefix);
+
+       /* FIXME Parse any namespace response extensions. */
+
+       tok = camel_imapx_stream_token (
+               stream, &token, &len, cancellable, error);
+       if (tok == IMAPX_TOK_ERROR)
+               return FALSE;
+       if (tok != ')') {
+               g_set_error (
+                       error, CAMEL_IMAPX_ERROR, 1,
+                       "namespace: expecting ')'");
+               return FALSE;
+       }
+
+       tok = camel_imapx_stream_token (
+               stream, &token, &len, cancellable, error);
+       if (tok == IMAPX_TOK_ERROR)
+               return FALSE;
+       if (tok == '(') {
+               camel_imapx_stream_ungettoken (stream, tok, token, len);
+               goto repeat;
+       }
+       if (tok != ')') {
+               g_set_error (
+                       error, CAMEL_IMAPX_ERROR, 1,
+                       "namespace: expecting '(' or ')'");
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+/**
+ * camel_imapx_namespace_response_new:
+ * @stream: a #CamelIMAPXStream
+ * @cancellable: optional #GCancellable object, or %NULL
+ * @error: return location for a #GError, or %NULL
+ *
+ * Attempts to parse an IMAP NAMESPACE response from @stream and, if
+ * successful, stores the response data in a new #CamelIMAPXNamespaceResponse.
+ * If an error occurs, the function sets @error and returns %NULL.
+ *
+ * Returns: a #CamelIMAPXNamespaceResponse, or %NULL
+ *
+ * Since: 3.12
+ **/
+CamelIMAPXNamespaceResponse *
+camel_imapx_namespace_response_new (CamelIMAPXStream *stream,
+                                    GCancellable *cancellable,
+                                    GError **error)
+{
+       CamelIMAPXNamespaceResponse *response;
+       gint ii;
+
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STREAM (stream), NULL);
+
+       response = g_object_new (CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE, NULL);
+
+       for (ii = 0; ii < 3; ii++) {
+               CamelIMAPXNamespaceCategory category;
+               gboolean success;
+
+               /* Don't rely on the enum values being defined
+                * in the same order as the NAMESPACE response. */
+               switch (ii) {
+                       case 0:
+                               category = CAMEL_IMAPX_NAMESPACE_PERSONAL;
+                               break;
+                       case 1:
+                               category = CAMEL_IMAPX_NAMESPACE_OTHER_USERS;
+                               break;
+                       case 2:
+                               category = CAMEL_IMAPX_NAMESPACE_SHARED;
+                               break;
+                       default:
+                               g_warn_if_reached ();
+                               goto fail;
+               }
+
+               success = imapx_namespace_response_parse_namespace (
+                       stream, response, category, cancellable, error);
+               if (!success)
+                       goto fail;
+       }
+
+       /* Eat the newline. */
+       if (!camel_imapx_stream_skip (stream, cancellable, error))
+               goto fail;
+
+       return response;
+
+fail:
+       g_clear_object (&response);
+
+       return NULL;
+}
+
+/**
+ * camel_imapx_namespace_response_faux_new:
+ * @list_response: a #CamelIMAPXListResponse
+ *
+ * Fabricates a new #CamelIMAPXNamespaceResponse from @list_response.
+ * The returned #CamelIMAPXNamespaceResponse will consist of a single
+ * personal #CamelIMAPXNamespace with an empty mailbox prefix string,
+ * and a mailbox separator character taken from @list_response.
+ *
+ * Use this function when the IMAP server does not list the "NAMESPACE"
+ * keyword in its CAPABILITY response.
+ *
+ * Returns: a #CamelIMAPXNamespaceResponse
+ *
+ * Since: 3.12
+ **/
+CamelIMAPXNamespaceResponse *
+camel_imapx_namespace_response_faux_new (CamelIMAPXListResponse *list_response)
+{
+       CamelIMAPXNamespaceResponse *response;
+       CamelIMAPXNamespaceCategory category;
+       gchar separator;
+
+       g_return_val_if_fail (
+               CAMEL_IS_IMAPX_LIST_RESPONSE (list_response), NULL);
+
+       response = g_object_new (CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE, NULL);
+
+       category = CAMEL_IMAPX_NAMESPACE_PERSONAL;
+       separator = camel_imapx_list_response_get_separator (list_response);
+       imapx_namespace_response_add (response, category, "", separator);
+
+       return response;
+}
+
+/**
+ * camel_imapx_namespace_response_list:
+ * @response: a #CamelIMAPXNamespaceResponse
+ *
+ * Returns a list of IMAP namespaces in the order received from the IMAP
+ * server, which means they are grouped by #CamelIMAPXNamespaceCategory.
+ *
+ * The namespaces returned in the list are referenced for thread-safety.
+ * They must each be unreferenced with g_object_unref() when finished with
+ * them.  Free the returned list itself with g_list_free().
+ *
+ * An easy way to free the list properly in one step is as follows:
+ *
+ * |[
+ *   g_list_free_full (list, g_object_unref);
+ * ]|
+ *
+ * Returns: a list of #CamelIMAPXNamespace instances
+ *
+ * Since: 3.12
+ **/
+GList *
+camel_imapx_namespace_response_list (CamelIMAPXNamespaceResponse *response)
+{
+       GList *head;
+
+       g_return_val_if_fail (
+               CAMEL_IS_IMAPX_NAMESPACE_RESPONSE (response), NULL);
+
+       head = g_queue_peek_head_link (&response->priv->namespaces);
+
+       return g_list_copy_deep (head, (GCopyFunc) g_object_ref, NULL);
+}
+
+/**
+ * camel_imapx_namespace_response_lookup:
+ * @response: a #CamelIMAPXNamespaceResponse
+ * @mailbox_name: a mailbox name
+ * @separator: a mailbox path separator character
+ *
+ * Attempts to match @mailbox_name and @separator to a known IMAP namespace
+ * and returns a #CamelIMAPXNamespace, or %NULL if no match was found.
+ *
+ * The returned #CamelIMAPXNamespace is referenced for thread-safety and
+ * should be unreferenced with g_object_unref() when finished with it.
+ *
+ * Returns: a #CamelIMAPXNamespace, or %NULL
+ *
+ * Since: 3.12
+ **/
+CamelIMAPXNamespace *
+camel_imapx_namespace_response_lookup (CamelIMAPXNamespaceResponse *response,
+                                       const gchar *mailbox_name,
+                                       gchar separator)
+{
+       CamelIMAPXNamespace *match = NULL;
+       GQueue candidates = G_QUEUE_INIT;
+       GList *head, *link;
+       guint ii, length;
+
+       g_return_val_if_fail (
+               CAMEL_IS_IMAPX_NAMESPACE_RESPONSE (response), NULL);
+       g_return_val_if_fail (mailbox_name != NULL, NULL);
+
+       /* Collect all namespaces with matching separators. */
+
+       head = g_queue_peek_head_link (&response->priv->namespaces);
+
+       for (link = head; link != NULL; link = g_list_next (link)) {
+               CamelIMAPXNamespace *namespace;
+               gchar ns_separator;
+
+               namespace = CAMEL_IMAPX_NAMESPACE (link->data);
+               ns_separator = camel_imapx_namespace_get_separator (namespace);
+
+               if (separator == ns_separator)
+                       g_queue_push_tail (&candidates, namespace);
+       }
+
+       /* Check namespaces with non-empty prefix strings.
+        * Discard those that don't match the mailbox name. */
+
+       length = g_queue_get_length (&candidates);
+
+       for (ii = 0; ii < length; ii++) {
+               CamelIMAPXNamespace *namespace;
+               const gchar *ns_prefix;
+
+               namespace = g_queue_pop_head (&candidates);
+               ns_prefix = camel_imapx_namespace_get_prefix (namespace);
+               g_return_val_if_fail (ns_prefix != NULL, NULL);
+
+               /* Put namespaces with empty prefix strings
+                * back on the tail of the candidates queue. */
+               if (*ns_prefix == '\0') {
+                       g_queue_push_tail (&candidates, namespace);
+                       continue;
+               }
+
+               /* Stop processing if we find a match. */
+               if (g_str_has_prefix (mailbox_name, ns_prefix)) {
+                       match = namespace;
+                       break;
+               }
+       }
+
+       /* Remaining namespaces have empty prefix strings.
+        * Return the first one as the matching namespace. */
+
+       if (match == NULL)
+               match = g_queue_pop_head (&candidates);
+
+       g_queue_clear (&candidates);
+
+       if (match != NULL)
+               g_object_ref (match);
+
+       return match;
+}
+
+/* Helper for camel_imapx_namespace_response_lookup_for_path() */
+static gint
+imapx_namespace_response_rank_candidates (gconstpointer a,
+                                          gconstpointer b,
+                                          gpointer user_data)
+{
+       CamelIMAPXNamespace *namespace_a;
+       CamelIMAPXNamespace *namespace_b;
+       const gchar *prefix_a;
+       const gchar *prefix_b;
+       gsize prefix_len_a;
+       gsize prefix_len_b;
+
+       namespace_a = CAMEL_IMAPX_NAMESPACE (a);
+       namespace_b = CAMEL_IMAPX_NAMESPACE (b);
+
+       prefix_a = camel_imapx_namespace_get_prefix (namespace_a);
+       prefix_b = camel_imapx_namespace_get_prefix (namespace_b);
+
+       prefix_len_a = strlen (prefix_a);
+       prefix_len_b = strlen (prefix_b);
+
+       /* Rank namespaces by longest prefix string. */
+
+       if (prefix_len_a > prefix_len_b)
+               return -1;
+
+       if (prefix_len_a < prefix_len_b)
+               return 1;
+
+       /* For namespaces with equal length prefixes, compare the prefix
+        * strings themselves.  Kind of arbitrary, but we have no better
+        * criteria.  Should rarely come up for a sanely configured IMAP
+        * server anyway. */
+       return strcmp (prefix_a, prefix_b);
+}
+
+/**
+ * camel_imapx_namespace_response_lookup_for_path:
+ * @response: a #CamelIMAPXNamespaceResponse
+ * @folder_path: a Camel folder path
+ *
+ * Attempts to match @folder_path to a known IMAP namespace and returns a
+ * #CamelIMAPXNamespace, or %NULL if no match was found.
+ *
+ * If the result is ambiguous, meaning @folder_path could belong to one of
+ * several IMAP namespaces, the namespace with the longest matching prefix
+ * string is preferred.  This has the effect of giving a namespace with an
+ * empty prefix the lowest priority.
+ *
+ * The returned #CamelIMAPXNamespace is referenced for thread-safety and
+ * should be unreferenced with g_object_unref() when finished with it.
+ *
+ * Returns: a #CamelIMAPXNamespace, or %NULL
+ *
+ * Since: 3.12
+ **/
+CamelIMAPXNamespace *
+camel_imapx_namespace_response_lookup_for_path (CamelIMAPXNamespaceResponse *response,
+                                                const gchar *folder_path)
+{
+       CamelIMAPXNamespace *match = NULL;
+       GQueue candidates = G_QUEUE_INIT;
+       GList *head, *link;
+       gboolean find_empty_prefix;
+
+       g_return_val_if_fail (
+               CAMEL_IS_IMAPX_NAMESPACE_RESPONSE (response), NULL);
+       g_return_val_if_fail (folder_path != NULL, NULL);
+
+       /* Special cases:
+        * If the folder path is empty or names the INBOX, then
+        * find the first namespace with an empty prefix string. */
+       find_empty_prefix =
+               (*folder_path == '\0') ||
+               (g_ascii_strcasecmp (folder_path, "INBOX") == 0);
+
+       head = g_queue_peek_head_link (&response->priv->namespaces);
+
+       for (link = head; link != NULL; link = g_list_next (link)) {
+               CamelIMAPXNamespace *namespace;
+               const gchar *prefix;
+               gchar *path_prefix;
+               gchar separator;
+
+               namespace = CAMEL_IMAPX_NAMESPACE (link->data);
+               prefix = camel_imapx_namespace_get_prefix (namespace);
+               separator = camel_imapx_namespace_get_separator (namespace);
+
+               /* Special handling when searching for an empty prefix. */
+               if (find_empty_prefix) {
+                       if (*prefix == '\0') {
+                               g_queue_push_tail (&candidates, namespace);
+                               break;
+                       }
+                       continue;
+               }
+
+               /* Convert the prefix to a folder path segment. */
+               path_prefix = camel_imapx_mailbox_to_folder_path (
+                       prefix, separator);
+
+               if (g_str_has_prefix (folder_path, path_prefix)) {
+                       g_queue_insert_sorted (
+                               &candidates, namespace,
+                               imapx_namespace_response_rank_candidates,
+                               NULL);
+               }
+
+               g_free (path_prefix);
+       }
+
+       /* First candidate is the preferred namespace. */
+       match = g_queue_pop_head (&candidates);
+       if (match != NULL)
+               g_object_ref (match);
+
+       /* Discard any unselected candidates. */
+       g_queue_clear (&candidates);
+
+       return match;
+}
+
diff --git a/camel/camel-imapx-namespace-response.h b/camel/camel-imapx-namespace-response.h
new file mode 100644
index 0000000..a2eee89
--- /dev/null
+++ b/camel/camel-imapx-namespace-response.h
@@ -0,0 +1,96 @@
+/*
+ * camel-imapx-namespace-response.h
+ *
+ * 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 of the License, or (at your option) version 3.
+ *
+ * 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
+#error "Only <camel/camel.h> can be included directly."
+#endif
+
+#ifndef CAMEL_IMAPX_NAMESPACE_RESPONSE_H
+#define CAMEL_IMAPX_NAMESPACE_RESPONSE_H
+
+#include <camel/camel-imapx-namespace.h>
+#include <camel/camel-imapx-list-response.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE \
+       (camel_imapx_namespace_response_get_type ())
+#define CAMEL_IMAPX_NAMESPACE_RESPONSE(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE, CamelIMAPXNamespaceResponse))
+#define CAMEL_IMAPX_NAMESPACE_RESPONSE_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE, CamelIMAPXNamespaceResponseClass))
+#define CAMEL_IS_IMAPX_NAMESPACE_RESPONSE(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE))
+#define CAMEL_IS_IMAPX_NAMESPACE_RESPONSE_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE))
+#define CAMEL_IMAPX_NAMESPACE_RESPONSE_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE, CamelIMAPXNamespaceResponseClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelIMAPXNamespaceResponse CamelIMAPXNamespaceResponse;
+typedef struct _CamelIMAPXNamespaceResponseClass CamelIMAPXNamespaceResponseClass;
+typedef struct _CamelIMAPXNamespaceResponsePrivate CamelIMAPXNamespaceResponsePrivate;
+
+/**
+ * CamelIMAPXNamespaceResponse:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ *
+ * Since: 3.12
+ **/
+struct _CamelIMAPXNamespaceResponse {
+       GObject parent;
+       CamelIMAPXNamespaceResponsePrivate *priv;
+};
+
+struct _CamelIMAPXNamespaceResponseClass {
+       GObjectClass parent_class;
+};
+
+GType          camel_imapx_namespace_response_get_type
+                                       (void) G_GNUC_CONST;
+CamelIMAPXNamespaceResponse *
+               camel_imapx_namespace_response_new
+                                       (CamelIMAPXStream *stream,
+                                        GCancellable *cancellable,
+                                        GError **error);
+CamelIMAPXNamespaceResponse *
+               camel_imapx_namespace_response_faux_new
+                                       (CamelIMAPXListResponse *list_response);
+GList *                camel_imapx_namespace_response_list
+                                       (CamelIMAPXNamespaceResponse *response);
+CamelIMAPXNamespace *
+               camel_imapx_namespace_response_lookup
+                                       (CamelIMAPXNamespaceResponse *response,
+                                        const gchar *mailbox_name,
+                                        gchar separator);
+CamelIMAPXNamespace *
+               camel_imapx_namespace_response_lookup_for_path
+                                       (CamelIMAPXNamespaceResponse *response,
+                                        const gchar *folder_path);
+
+G_END_DECLS
+
+#endif /* CAMEL_IMAPX_NAMESPACE_RESPONSE_H */
+
diff --git a/camel/camel.h b/camel/camel.h
index 3b12469..5d3a7de 100644
--- a/camel/camel.h
+++ b/camel/camel.h
@@ -146,6 +146,7 @@
 #include <camel/camel-imapx-folder.h>
 #include <camel/camel-imapx-list-response.h>
 #include <camel/camel-imapx-namespace.h>
+#include <camel/camel-imapx-namespace-response.h>
 #include <camel/camel-imapx-search.h>
 #include <camel/camel-imapx-server.h>
 #include <camel/camel-imapx-status-response.h>
diff --git a/docs/reference/camel/camel-docs.sgml b/docs/reference/camel/camel-docs.sgml
index 141a682..364523d 100644
--- a/docs/reference/camel/camel-docs.sgml
+++ b/docs/reference/camel/camel-docs.sgml
@@ -204,6 +204,7 @@
       <xi:include href="xml/camel-imapx-folder.xml"/>
       <xi:include href="xml/camel-imapx-job.xml"/>
       <xi:include href="xml/camel-imapx-namespace.xml"/>
+      <xi:include href="xml/camel-imapx-namespace-response.xml"/>
       <xi:include href="xml/camel-imapx-search.xml"/>
       <xi:include href="xml/camel-imapx-server.xml"/>
       <xi:include href="xml/camel-imapx-settings.xml"/>
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index b3b5e87..b093190 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -882,6 +882,28 @@ CamelIMAPXNamespacePrivate
 </SECTION>
 
 <SECTION>
+<FILE>camel-imapx-namespace-response</FILE>
+<TITLE>CamelIMAPXNamespaceResponse</TITLE>
+CamelIMAPXNamespaceResponse
+camel_imapx_namespace_response_new
+camel_imapx_namespace_response_faux_new
+camel_imapx_namespace_response_list
+camel_imapx_namespace_response_lookup
+camel_imapx_namespace_response_lookup_for_path
+<SUBSECTION Standard>
+CAMEL_IMAPX_NAMESPACE_RESPONSE
+CAMEL_IS_IMAPX_NAMESPACE_RESPONSE
+CAMEL_TYPE_IMAPX_NAMESPACE_RESPONSE
+CAMEL_IMAPX_NAMESPACE_RESPONSE_CLASS
+CAMEL_IS_IMAPX_NAMESPACE_RESPONSE_CLASS
+CAMEL_IMAPX_NAMESPACE_RESPONSE_GET_CLASS
+CamelIMAPXNamespaceResponseClass
+camel_imapx_namespace_response_get_type
+<SUBSECTION Private>
+CamelIMAPXNamespaceResponsePrivate
+</SECTION>
+
+<SECTION>
 <FILE>camel-imapx-search</FILE>
 <TITLE>CamelIMAPXSearch</TITLE>
 CamelIMAPXSearch
diff --git a/docs/reference/camel/camel.types b/docs/reference/camel/camel.types
index 5cfa156..1f15c8f 100644
--- a/docs/reference/camel/camel.types
+++ b/docs/reference/camel/camel.types
@@ -19,6 +19,7 @@ camel_html_parser_get_type
 camel_imapx_folder_get_type
 camel_imapx_list_response_get_type
 camel_imapx_namespace_get_type
+camel_imapx_namespace_response_get_type
 camel_imapx_search_get_type
 camel_imapx_server_get_type
 camel_imapx_settings_get_type


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