[evolution-data-server] Add CamelIMAPXStatusResponse.



commit ddf923e2262625a3022b25103e24a40ba494c85a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Aug 8 10:46:34 2013 +0200

    Add CamelIMAPXStatusResponse.
    
    Represents an IMAP STATUS response.
    
    Replaces the "state_info" struct and associated functions.
    
    New functions:
    
      camel_imapx_status_response_new()
      camel_imapx_status_response_get_mailbox()
      camel_imapx_status_response_get_messages()
      camel_imapx_status_response_get_recent()
      camel_imapx_status_response_get_uidnext()
      camel_imapx_status_response_get_uidvalidity()
      camel_imapx_status_response_get_unseen()
      camel_imapx_status_response_get_highestmodseq()
    
    Removed functions:
    
      imapx_parse_status_info()

 camel/Makefile.am                       |    2 +
 camel/camel-imapx-server.c              |   53 +++--
 camel/camel-imapx-status-response.c     |  337 +++++++++++++++++++++++++++++++
 camel/camel-imapx-status-response.h     |   96 +++++++++
 camel/camel-imapx-utils.c               |  118 -----------
 camel/camel-imapx-utils.h               |   18 --
 camel/camel.h                           |    1 +
 docs/reference/camel/camel-docs.sgml    |    3 +-
 docs/reference/camel/camel-sections.txt |   25 +++
 docs/reference/camel/camel.types        |    1 +
 10 files changed, 498 insertions(+), 156 deletions(-)
---
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 02f8c1e..4c3ec64 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -182,6 +182,7 @@ libcamel_1_2_la_SOURCES =                   \
        camel-imapx-search.c                    \
        camel-imapx-server.c                    \
        camel-imapx-settings.c                  \
+       camel-imapx-status-response.c           \
        camel-imapx-store-summary.c             \
        camel-imapx-store.c                     \
        camel-imapx-stream.c                    \
@@ -317,6 +318,7 @@ libcamelinclude_HEADERS =                   \
        camel-imapx-search.h                    \
        camel-imapx-server.h                    \
        camel-imapx-settings.h                  \
+       camel-imapx-status-response.h           \
        camel-imapx-store-summary.h             \
        camel-imapx-store.h                     \
        camel-imapx-stream.h                    \
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index e3398ee..e27d9b3 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -2238,29 +2238,45 @@ imapx_untagged_status (CamelIMAPXServer *is,
                        GCancellable *cancellable,
                        GError **error)
 {
+       CamelIMAPXStatusResponse *response;
        CamelIMAPXStoreNamespace *ns;
        CamelIMAPXStore *store;
        CamelFolder *folder = NULL;
-       struct _state_info *sinfo = NULL;
+       const gchar *mailbox;
+       guint32 messages;
+       guint32 uidnext;
+       guint32 uidvalidity;
+       guint32 unseen;
+       guint64 highestmodseq;
        GError *local_error = NULL;
 
        g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
 
-       sinfo = imapx_parse_status_info (stream, cancellable, error);
-       if (sinfo == NULL)
+       response = camel_imapx_status_response_new (
+               stream, cancellable, error);
+       if (response == NULL)
                return FALSE;
 
+       mailbox = camel_imapx_status_response_get_mailbox (response);
+       messages = camel_imapx_status_response_get_messages (response);
+       uidnext = camel_imapx_status_response_get_uidnext (response);
+       uidvalidity = camel_imapx_status_response_get_uidvalidity (response);
+       unseen = camel_imapx_status_response_get_unseen (response);
+       highestmodseq = camel_imapx_status_response_get_highestmodseq (response);
+
        store = camel_imapx_server_ref_store (is);
 
        ns = camel_imapx_store_summary_namespace_find_full (
-               store->summary, sinfo->name);
+               store->summary, mailbox);
 
        if (ns != NULL) {
                gchar *path_name;
 
                path_name = camel_imapx_store_summary_full_to_path (
-                       store->summary, sinfo->name, ns->sep);
-               c (is->tagprefix, "Got folder path '%s' for full '%s'\n", path_name, sinfo->name);
+                       store->summary, mailbox, ns->sep);
+               c (is->tagprefix,
+                       "Got folder path '%s' for full '%s'\n",
+                       path_name, mailbox);
                if (path_name != NULL) {
                        folder = camel_store_get_folder_sync (
                                CAMEL_STORE (store), path_name,
@@ -2278,22 +2294,21 @@ imapx_untagged_status (CamelIMAPXServer *is,
                imapx_summary = CAMEL_IMAPX_SUMMARY (folder->summary);
 
                imapx_folder = CAMEL_IMAPX_FOLDER (folder);
-               imapx_folder->unread_on_server = sinfo->unseen;
-               imapx_folder->exists_on_server = sinfo->messages;
-               imapx_folder->modseq_on_server = sinfo->highestmodseq;
-               imapx_folder->uidnext_on_server = sinfo->uidnext;
-               imapx_folder->uidvalidity_on_server = sinfo->uidvalidity;
-               if (sinfo->uidvalidity != 0 &&
-                   sinfo->uidvalidity != imapx_summary->validity) {
-                       invalidate_local_cache (
-                               imapx_folder, sinfo->uidvalidity);
-               }
+               imapx_folder->exists_on_server = messages;
+               imapx_folder->unread_on_server = unseen;
+               imapx_folder->modseq_on_server = highestmodseq;
+               imapx_folder->uidvalidity_on_server = uidvalidity;
+               imapx_folder->uidnext_on_server = uidnext;
+
+               if (uidvalidity > 0 && uidvalidity != imapx_summary->validity)
+                       invalidate_local_cache (imapx_folder, uidvalidity);
        } else {
-               c (is->tagprefix, "Received STATUS for unknown folder '%s'\n", sinfo->name);
+               c (is->tagprefix,
+                       "Received STATUS for unknown folder '%s'\n",
+                       mailbox);
        }
 
-       g_free (sinfo->name);
-       g_free (sinfo);
+       g_object_unref (response);
 
        if (local_error != NULL) {
                g_propagate_error (error, local_error);
diff --git a/camel/camel-imapx-status-response.c b/camel/camel-imapx-status-response.c
new file mode 100644
index 0000000..86d15ad
--- /dev/null
+++ b/camel/camel-imapx-status-response.c
@@ -0,0 +1,337 @@
+/*
+ * camel-imapx-status-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-status-response
+ * @include: camel/camel.h
+ * @short_description: Stores an IMAP STATUS respose
+ *
+ * #CamelIMAPXStatusResponse encapsulates an IMAP STATUS response, which
+ * describes the current status of a mailbox in terms of various message
+ * counts and change tracking indicators.
+ **/
+
+#include "camel-imapx-status-response.h"
+
+#include <camel/camel-imapx-utils.h>
+
+#define CAMEL_IMAPX_STATUS_RESPONSE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_IMAPX_STATUS_RESPONSE, CamelIMAPXStatusResponsePrivate))
+
+struct _CamelIMAPXStatusResponsePrivate {
+       gchar *mailbox;
+       guint32 messages;
+       guint32 recent;
+       guint32 unseen;
+       guint32 uidnext;
+       guint32 uidvalidity;
+       guint64 highestmodseq;
+};
+
+G_DEFINE_TYPE (
+       CamelIMAPXStatusResponse,
+       camel_imapx_status_response,
+       G_TYPE_OBJECT)
+
+static void
+imapx_status_response_finalize (GObject *object)
+{
+       CamelIMAPXStatusResponsePrivate *priv;
+
+       priv = CAMEL_IMAPX_STATUS_RESPONSE_GET_PRIVATE (object);
+
+       g_free (priv->mailbox);
+
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (camel_imapx_status_response_parent_class)->
+               finalize (object);
+}
+
+static void
+camel_imapx_status_response_class_init (CamelIMAPXStatusResponseClass *class)
+{
+       GObjectClass *object_class;
+
+       g_type_class_add_private (
+               class, sizeof (CamelIMAPXStatusResponsePrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = imapx_status_response_finalize;
+}
+
+static void
+camel_imapx_status_response_init (CamelIMAPXStatusResponse *response)
+{
+       response->priv = CAMEL_IMAPX_STATUS_RESPONSE_GET_PRIVATE (response);
+}
+
+/**
+ * camel_imapx_status_response_new:
+ * @stream: a #CamelIMAPXStream
+ * @cancellable: a #GCancellable
+ * @error: return location for a #GError, or %NULL
+ *
+ * Attempts to parse an IMAP STATUS response from @stream and, if successful,
+ * stores the response data in a new #CamelIMAPXStatusResponse.  If an error
+ * occurs, the function sets @error and returns %NULL.
+ *
+ * Returns: a #CamelIMAPXStatusResponse, or %NULL
+ *
+ * Since: 3.10
+ **/
+CamelIMAPXStatusResponse *
+camel_imapx_status_response_new (CamelIMAPXStream *stream,
+                                 GCancellable *cancellable,
+                                 GError **error)
+{
+       CamelIMAPXStatusResponse *response;
+       camel_imapx_token_t tok;
+       guchar *token;
+       guint len;
+
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STREAM (stream), NULL);
+
+       response = g_object_new (CAMEL_TYPE_IMAPX_STATUS_RESPONSE, NULL);
+
+       /* Parse mailbox. */
+
+       response->priv->mailbox =
+               camel_imapx_parse_mailbox (stream, cancellable, error);
+       if (response->priv->mailbox == NULL)
+               goto fail;
+
+       /* Parse status attributes. */
+
+       tok = camel_imapx_stream_token (
+               stream, &token, &len, cancellable, error);
+       if (tok == IMAPX_TOK_ERROR)
+               goto fail;
+       if (tok != '(') {
+               g_set_error (
+                       error, CAMEL_IMAPX_ERROR, 1,
+                       "status: expecting '('");
+               goto fail;
+       }
+
+       tok = camel_imapx_stream_token (
+               stream, &token, &len, cancellable, error);
+
+       while (tok == IMAPX_TOK_TOKEN) {
+               guint64 number;
+               gboolean success;
+
+               switch (imapx_tokenise ((gchar *) token, len)) {
+                       case IMAPX_MESSAGES:
+                               success = camel_imapx_stream_number (
+                                       stream, &number, cancellable, error);
+                               response->priv->messages = (guint32) number;
+                               break;
+
+                       case IMAPX_RECENT:
+                               success = camel_imapx_stream_number (
+                                       stream, &number, cancellable, error);
+                               response->priv->recent = (guint32) number;
+                               break;
+
+                       case IMAPX_UNSEEN:
+                               success = camel_imapx_stream_number (
+                                       stream, &number, cancellable, error);
+                               response->priv->unseen = (guint32) number;
+                               break;
+
+                       case IMAPX_UIDNEXT:
+                               success = camel_imapx_stream_number (
+                                       stream, &number, cancellable, error);
+                               response->priv->uidnext = (guint32) number;
+                               break;
+
+                       case IMAPX_UIDVALIDITY:
+                               success = camel_imapx_stream_number (
+                                       stream, &number, cancellable, error);
+                               response->priv->unseen = (guint32) number;
+                               break;
+
+                       /* See RFC 4551 section 3.6 */
+                       case IMAPX_HIGHESTMODSEQ:
+                               success = camel_imapx_stream_number (
+                                       stream, &number, cancellable, error);
+                               response->priv->highestmodseq = number;
+                               break;
+
+                       default:
+                               g_set_error (
+                                       error, CAMEL_IMAPX_ERROR, 1,
+                                       "unknown status attribute");
+                               success = FALSE;
+                               break;
+               }
+
+               if (!success)
+                       goto fail;
+
+               tok = camel_imapx_stream_token (
+                       stream, &token, &len, cancellable, error);
+       }
+
+       if (tok == IMAPX_TOK_ERROR)
+               goto fail;
+
+       if (tok != ')') {
+               g_set_error (
+                       error, CAMEL_IMAPX_ERROR, 1,
+                       "status: expecting ')' or attribute");
+               goto fail;
+       }
+
+       return response;
+
+fail:
+       g_clear_object (&response);
+
+       return NULL;
+}
+
+/**
+ * camel_imapx_status_response_get_mailbox:
+ * @response: a #CamelIMAPXStatusResponse
+ *
+ * Returns the mailbox name for @response.
+ *
+ * Returns: the mailbox name
+ *
+ * Since: 3.10
+ **/
+const gchar *
+camel_imapx_status_response_get_mailbox (CamelIMAPXStatusResponse *response)
+{
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STATUS_RESPONSE (response), NULL);
+
+       return response->priv->mailbox;
+}
+
+/**
+ * camel_imapx_status_response_get_messages:
+ * @response: a #CamelIMAPXStatusResponse
+ *
+ * Returns the number of messages in the mailbox.
+ *
+ * Returns: the "MESSAGES" status value
+ *
+ * Since: 3.10
+ **/
+guint32
+camel_imapx_status_response_get_messages (CamelIMAPXStatusResponse *response)
+{
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STATUS_RESPONSE (response), 0);
+
+       return response->priv->messages;
+}
+
+/**
+ * camel_imapx_status_response_get_recent:
+ * @response: a #CamelIMAPXStatusResponse
+ *
+ * Returns the number of messages with the \Recent flag set.
+ *
+ * Returns: the "RECENT" status valud
+ *
+ * Since: 3.10
+ **/
+guint32
+camel_imapx_status_response_get_recent (CamelIMAPXStatusResponse *response)
+{
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STATUS_RESPONSE (response), 0);
+
+       return response->priv->recent;
+}
+
+/**
+ * camel_imapx_status_response_get_unseen:
+ * @response: a #CamelIMAPXStatusResponse
+ *
+ * Returns the number of messages which do no have the \Seen flag set.
+ *
+ * Returns: the "UNSEEN" status value
+ *
+ * Since: 3.10
+ **/
+guint32
+camel_imapx_status_response_get_unseen (CamelIMAPXStatusResponse *response)
+{
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STATUS_RESPONSE (response), 0);
+
+       return response->priv->unseen;
+}
+
+/**
+ * camel_imapx_status_response_get_uidnext:
+ * @response: a #CamelIMAPXStatusResponse
+ *
+ * Return the next unique identifier value of the mailbox.
+ *
+ * Returns: the "UIDNEXT" status value
+ *
+ * Since: 3.10
+ **/
+guint32
+camel_imapx_status_response_get_uidnext (CamelIMAPXStatusResponse *response)
+{
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STATUS_RESPONSE (response), 0);
+
+       return response->priv->uidnext;
+}
+
+/**
+ * camel_imapx_status_response_get_uidvalidity:
+ * @response: a #CamelIMAPXStatusResponse
+ *
+ * Returns the unique identifier validity value of the mailbox.
+ *
+ * Returns: the "UIDVALIDITY" status value
+ *
+ * Since: 3.10
+ **/
+guint32
+camel_imapx_status_response_get_uidvalidity (CamelIMAPXStatusResponse *response)
+{
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STATUS_RESPONSE (response), 0);
+
+       return response->priv->uidvalidity;
+}
+
+/**
+ * camel_imapx_status_response_get_highestmodseq:
+ * @response: a #CamelIMAPXStatusResponse
+ *
+ * Returns the highest mod-sequence value of all messages in the mailbox, or
+ * zero if the server does not support the persistent storage of mod-sequences
+ * for the mailbox.
+ *
+ * Returns: the "HIGHESTMODSEQ" status value
+ *
+ * Since: 3.10
+ **/
+guint64
+camel_imapx_status_response_get_highestmodseq (CamelIMAPXStatusResponse *response)
+{
+       g_return_val_if_fail (CAMEL_IS_IMAPX_STATUS_RESPONSE (response), 0);
+
+       return response->priv->highestmodseq;
+}
+
diff --git a/camel/camel-imapx-status-response.h b/camel/camel-imapx-status-response.h
new file mode 100644
index 0000000..223fc79
--- /dev/null
+++ b/camel/camel-imapx-status-response.h
@@ -0,0 +1,96 @@
+/*
+ * camel-imapx-status-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_STATUS_RESPONSE_H
+#define CAMEL_IMAPX_STATUS_RESPONSE_H
+
+#include <gio/gio.h>
+#include <camel/camel-imapx-stream.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_IMAPX_STATUS_RESPONSE \
+       (camel_imapx_status_response_get_type ())
+#define CAMEL_IMAPX_STATUS_RESPONSE(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), CAMEL_TYPE_IMAPX_STATUS_RESPONSE, CamelIMAPXStatusResponse))
+#define CAMEL_IMAPX_STATUS_RESPONSE_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), CAMEL_TYPE_IMAPX_STATUS_RESPONSE, CamelIMAPXStatusResponseClass))
+#define CAMEL_IS_IMAPX_STATUS_RESPONSE(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), CAMEL_TYPE_IMAPX_STATUS_RESPONSE))
+#define CAMEL_IS_IMAPX_STATUS_RESPONSE_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), CAMEL_TYPE_IMAPX_STATUS_RESPONSE))
+#define CAMEL_IMAPX_STATUS_RESPONSE_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), CAMEL_TYPE_IMAPX_STATUS_RESPONSE, CamelIMAPXStatusResponseClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelIMAPXStatusResponse CamelIMAPXStatusResponse;
+typedef struct _CamelIMAPXStatusResponseClass CamelIMAPXStatusResponseClass;
+typedef struct _CamelIMAPXStatusResponsePrivate CamelIMAPXStatusResponsePrivate;
+
+/**
+ * CamelIMAPXStatusResponse:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ *
+ * Since: 3.10
+ **/
+struct _CamelIMAPXStatusResponse {
+       GObject parent;
+       CamelIMAPXStatusResponsePrivate *priv;
+};
+
+struct _CamelIMAPXStatusResponseClass {
+       GObjectClass parent_class;
+};
+
+GType          camel_imapx_status_response_get_type
+                                       (void) G_GNUC_CONST;
+CamelIMAPXStatusResponse *
+               camel_imapx_status_response_new
+                                       (CamelIMAPXStream *stream,
+                                        GCancellable *cancellable,
+                                        GError **error);
+const gchar *  camel_imapx_status_response_get_mailbox
+                                       (CamelIMAPXStatusResponse *response);
+guint32                camel_imapx_status_response_get_messages
+                                       (CamelIMAPXStatusResponse *response);
+guint32                camel_imapx_status_response_get_recent
+                                       (CamelIMAPXStatusResponse *response);
+guint32                camel_imapx_status_response_get_unseen
+                                       (CamelIMAPXStatusResponse *response);
+guint32                camel_imapx_status_response_get_uidnext
+                                       (CamelIMAPXStatusResponse *response);
+guint32                camel_imapx_status_response_get_uidvalidity
+                                       (CamelIMAPXStatusResponse *response);
+guint64                camel_imapx_status_response_get_highestmodseq
+                                       (CamelIMAPXStatusResponse *response);
+
+G_END_DECLS
+
+#endif /* CAMEL_IMAPX_STATUS_RESPONSE_H */
+
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index 20b898a..f096c31 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -1957,124 +1957,6 @@ exit:
        return finfo;
 }
 
-struct _state_info *
-imapx_parse_status_info (CamelIMAPXStream *is,
-                         GCancellable *cancellable,
-                         GError **error)
-{
-       struct _state_info *sinfo;
-       gint tok;
-       guint len;
-       guchar *token;
-
-       /* skip the folder name */
-       if (!camel_imapx_stream_astring (is, &token, cancellable, error))
-               return NULL;
-
-       sinfo = g_malloc0 (sizeof (*sinfo));
-       sinfo->name = camel_utf7_utf8 ((gchar *) token);
-
-       tok = camel_imapx_stream_token (is, &token, &len, cancellable, error);
-
-       if (tok == IMAPX_TOK_ERROR)
-               goto fail;
-
-       if (tok != '(') {
-               g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
-                       "parse status info: expecting '('");
-               goto fail;
-       }
-
-       tok = camel_imapx_stream_token (is, &token, &len, cancellable, error);
-
-       while (tok == IMAPX_TOK_TOKEN) {
-               guint64 number;
-               gboolean success;
-
-               switch (imapx_tokenise ((gchar *) token, len)) {
-                       case IMAPX_MESSAGES:
-                               success = camel_imapx_stream_number (
-                                       is, &number, cancellable, error);
-                               if (success)
-                                       sinfo->messages = (guint32) number;
-                               break;
-
-                       case IMAPX_RECENT:
-                               success = camel_imapx_stream_number (
-                                       is, &number, cancellable, error);
-                               if (success)
-                                       sinfo->recent = (guint32) number;
-                               break;
-
-                       case IMAPX_UIDNEXT:
-                               success = camel_imapx_stream_number (
-                                       is, &number, cancellable, error);
-                               if (success)
-                                       sinfo->uidnext = (guint32) number;
-                               break;
-
-                       case IMAPX_UNSEEN:
-                               success = camel_imapx_stream_number (
-                                       is, &number, cancellable, error);
-                               if (success)
-                                       sinfo->unseen = (guint32) number;
-                               break;
-
-                       case IMAPX_UIDVALIDITY:
-                               success = camel_imapx_stream_number (
-                                       is, &number, cancellable, error);
-                               if (success)
-                                       sinfo->uidvalidity = number;
-                               break;
-
-                       case IMAPX_HIGHESTMODSEQ:
-                               success = camel_imapx_stream_number (
-                                       is, &number, cancellable, error);
-                               if (success)
-                                       sinfo->highestmodseq = number;
-                               break;
-
-                       case IMAPX_NOMODSEQ:
-                               success = TRUE;  /* nothing to parse */
-                               break;
-
-                       default:
-                               g_set_error (
-                                       error, CAMEL_IMAPX_ERROR, 1,
-                                       "unknown status response");
-                               success = FALSE;
-                               break;
-               }
-
-               if (!success)
-                       goto fail;
-
-               tok = camel_imapx_stream_token (
-                       is, &token, &len, cancellable, error);
-       }
-
-       if (tok == IMAPX_TOK_ERROR)
-               goto fail;
-
-       if (tok != ')') {
-               g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
-                       "missing closing ')' on status response");
-               goto fail;
-       }
-
-       goto exit;
-
-fail:
-       g_free (sinfo->name);
-       g_free (sinfo);
-       sinfo = NULL;
-
-exit:
-       return sinfo;
-}
-
 static void
 generate_uids_from_sequence (GPtrArray *uids,
                              guint32 begin_uid,
diff --git a/camel/camel-imapx-utils.h b/camel/camel-imapx-utils.h
index 5a18a59..1999e1c 100644
--- a/camel/camel-imapx-utils.h
+++ b/camel/camel-imapx-utils.h
@@ -311,24 +311,6 @@ struct _status_info *
 void           imapx_free_status               (struct _status_info *sinfo);
 
 /* ********************************************************************** */
-/* parses the response from the status command */
-struct _state_info {
-       gchar *name;
-       guint32 messages;
-       guint32 recent;
-       guint32 uidnext;
-       guint32 unseen;
-       guint64 uidvalidity;
-       guint64 highestmodseq;
-};
-
-/* use g_free to free the return value */
-struct _state_info *
-               imapx_parse_status_info         (struct _CamelIMAPXStream *is,
-                                                GCancellable *cancellable,
-                                                GError **error);
-
-/* ********************************************************************** */
 
 gboolean       camel_imapx_command_add_qresync_parameter
                                                (struct _CamelIMAPXCommand *ic,
diff --git a/camel/camel.h b/camel/camel.h
index 1684185..220a743 100644
--- a/camel/camel.h
+++ b/camel/camel.h
@@ -148,6 +148,7 @@
 #include <camel/camel-imapx-list-response.h>
 #include <camel/camel-imapx-search.h>
 #include <camel/camel-imapx-server.h>
+#include <camel/camel-imapx-status-response.h>
 #include <camel/camel-imapx-store-summary.h>
 #include <camel/camel-imapx-store.h>
 #include <camel/camel-imapx-stream.h>
diff --git a/docs/reference/camel/camel-docs.sgml b/docs/reference/camel/camel-docs.sgml
index c7047db..d9ef3fb 100644
--- a/docs/reference/camel/camel-docs.sgml
+++ b/docs/reference/camel/camel-docs.sgml
@@ -204,7 +204,6 @@
       <xi:include href="xml/camel-imapx-command.xml"/>
       <xi:include href="xml/camel-imapx-folder.xml"/>
       <xi:include href="xml/camel-imapx-job.xml"/>
-      <xi:include href="xml/camel-imapx-list-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"/>
@@ -212,6 +211,8 @@
       <xi:include href="xml/camel-imapx-store-summary.xml"/>
       <xi:include href="xml/camel-imapx-stream.xml"/>
       <xi:include href="xml/camel-imapx-summary.xml"/>
+      <xi:include href="xml/camel-imapx-list-response.xml"/>
+      <xi:include href="xml/camel-imapx-status-response.xml"/>
     </chapter>
 
     <chapter id="Deprecated">
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 96662b6..50e3516 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -978,6 +978,31 @@ CamelIMAPXSettingsPrivate
 </SECTION>
 
 <SECTION>
+<FILE>camel-imapx-status-response</FILE>
+<TITLE>CamelIMAPXStatusResponse</TITLE>
+CamelIMAPXStatusResponse
+camel_imapx_status_response_new
+camel_imapx_status_response_get_mailbox
+camel_imapx_status_response_get_messages
+camel_imapx_status_response_get_recent
+camel_imapx_status_response_get_unseen
+camel_imapx_status_response_get_uidnext
+camel_imapx_status_response_get_uidvalidity
+camel_imapx_status_response_get_highestmodseq
+<SUBSECTION Standard>
+CAMEL_IMAPX_STATUS_RESPONSE
+CAMEL_IS_IMAPX_STATUS_RESPONSE
+CAMEL_TYPE_IMAPX_STATUS_RESPONSE
+CAMEL_IMAPX_STATUS_RESPONSE_CLASS
+CAMEL_IS_IMAPX_STATUS_RESPONSE_CLASS
+CAMEL_IMAPX_STATUS_RESPONSE_GET_CLASS
+CamelIMAPXStatusResponseClass
+camel_imapx_status_response_get_type
+<SUBSECTION Private>
+CamelIMAPXStatusResponsePrivate
+</SECTION>
+
+<SECTION>
 <FILE>camel-imapx-store</FILE>
 <TITLE>CamelIMAPXStore</TITLE>
 CamelIMAPXStore
diff --git a/docs/reference/camel/camel.types b/docs/reference/camel/camel.types
index 424905e..fae68fa 100644
--- a/docs/reference/camel/camel.types
+++ b/docs/reference/camel/camel.types
@@ -21,6 +21,7 @@ camel_imapx_list_response_get_type
 camel_imapx_search_get_type
 camel_imapx_server_get_type
 camel_imapx_settings_get_type
+camel_imapx_status_response_get_type
 camel_imapx_store_get_type
 camel_imapx_store_summary_get_type
 camel_imapx_stream_get_type


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