[evolution-data-server/imap-notify: 21/40] CamelIMAPXServer: Support the SPECIAL-USE capability.



commit da8a772363afb9a1bbcdcaf038a376fcf399b303
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Sep 3 21:35:01 2013 -0400

    CamelIMAPXServer: Support the SPECIAL-USE capability.
    
    http://tools.ietf.org/html/rfc6154
    
    Camel does not yet provide an API for applications to utilize this
    information, but we can still capture it in a CamelIMAPXMailbox.
    
    I'm still pondering a suitable application-facing API for this.  I'd
    prefer to avoid stuffing this into CamelFolderInfoFlags if I can, as
    Camel already overuses / abuses flag values as it is.

 camel/camel-imapx-list-response.c       |   72 ++++++++++++++++++++++++++++++-
 camel/camel-imapx-list-response.h       |    9 ++++
 camel/camel-imapx-server.c              |    2 +
 camel/camel-imapx-utils.c               |    3 +-
 camel/camel-imapx-utils.h               |    3 +-
 docs/reference/camel/camel-sections.txt |    7 +++
 6 files changed, 93 insertions(+), 3 deletions(-)
---
diff --git a/camel/camel-imapx-list-response.c b/camel/camel-imapx-list-response.c
index cb718e0..b4e4a6c 100644
--- a/camel/camel-imapx-list-response.c
+++ b/camel/camel-imapx-list-response.c
@@ -62,7 +62,14 @@ static const gchar *known_attributes[] = {
        CAMEL_IMAPX_LIST_ATTR_HASNOCHILDREN,
        CAMEL_IMAPX_LIST_ATTR_NONEXISTENT,
        CAMEL_IMAPX_LIST_ATTR_REMOTE,
-       CAMEL_IMAPX_LIST_ATTR_SUBSCRIBED
+       CAMEL_IMAPX_LIST_ATTR_SUBSCRIBED,
+       CAMEL_IMAPX_LIST_ATTR_ALL,
+       CAMEL_IMAPX_LIST_ATTR_ARCHIVE,
+       CAMEL_IMAPX_LIST_ATTR_DRAFTS,
+       CAMEL_IMAPX_LIST_ATTR_FLAGGED,
+       CAMEL_IMAPX_LIST_ATTR_JUNK,
+       CAMEL_IMAPX_LIST_ATTR_SENT,
+       CAMEL_IMAPX_LIST_ATTR_TRASH
 };
 
 static void
@@ -609,6 +616,69 @@ camel_imapx_list_response_get_separator (CamelIMAPXListResponse *response)
  **/
 
 /**
+ * CAMEL_IMAPX_LIST_ATTR_ALL:
+ *
+ * Refer to <ulink url="http://tools.ietf.org/html/rfc6154#section-2";>
+ * RFC 6154 section 2</ulink>.
+ *
+ * Since: 3.12
+ **/
+
+/**
+ * CAMEL_IMAPX_LIST_ATTR_ARCHIVE:
+ *
+ * Refer to <ulink url="http://tools.ietf.org/html/rfc6154#section-2";>
+ * RFC 6154 section 2</ulink>.
+ *
+ * Since: 3.12
+ **/
+
+/**
+ * CAMEL_IMAPX_LIST_ATTR_DRAFTS:
+ *
+ * Refer to <ulink url="http://tools.ietf.org/html/rfc6154#section-2";>
+ * RFC 6154 section 2</ulink>.
+ *
+ * Since: 3.12
+ **/
+
+/**
+ * CAMEL_IMAPX_LIST_ATTR_FLAGGED:
+ *
+ * Refer to <ulink url="http://tools.ietf.org/html/rfc6154#section-2";>
+ * RFC 6154 section 2</ulink>.
+ *
+ * Since: 3.12
+ **/
+
+/**
+ * CAMEL_IMAPX_LIST_ATTR_JUNK:
+ *
+ * Refer to <ulink url="http://tools.ietf.org/html/rfc6154#section-2";>
+ * RFC 6154 section 2</ulink>.
+ *
+ * Since: 3.12
+ **/
+
+/**
+ * CAMEL_IMAPX_LIST_ATTR_SENT:
+ *
+ * Refer to <ulink url="http://tools.ietf.org/html/rfc6154#section-2";>
+ * RFC 6154 section 2</ulink>.
+ *
+ * Since: 3.12
+ **/
+
+/**
+ * CAMEL_IMAPX_LIST_ATTR_TRASH:
+ *
+ * Refer to <ulink url="http://tools.ietf.org/html/rfc6154#section-2";>
+ * RFC 6154 section 2</ulink>.
+ *
+ * Since: 3.12
+ **/
+
+/**
  * camel_imapx_list_response_add_attribute:
  * @response: a #CamelIMAPXListResponse
  * @attribute: a mailbox attribute
diff --git a/camel/camel-imapx-list-response.h b/camel/camel-imapx-list-response.h
index aef81f3..bdb00dd 100644
--- a/camel/camel-imapx-list-response.h
+++ b/camel/camel-imapx-list-response.h
@@ -59,6 +59,15 @@
 #define CAMEL_IMAPX_LIST_ATTR_REMOTE           "\\Remote"
 #define CAMEL_IMAPX_LIST_ATTR_SUBSCRIBED       "\\Subscribed"
 
+/* RFC 6154 "SPECIAL-USE" Flags */
+#define CAMEL_IMAPX_LIST_ATTR_ALL              "\\All"
+#define CAMEL_IMAPX_LIST_ATTR_ARCHIVE          "\\Archive"
+#define CAMEL_IMAPX_LIST_ATTR_DRAFTS           "\\Drafts"
+#define CAMEL_IMAPX_LIST_ATTR_FLAGGED          "\\Flagged"
+#define CAMEL_IMAPX_LIST_ATTR_JUNK             "\\Junk"
+#define CAMEL_IMAPX_LIST_ATTR_SENT             "\\Sent"
+#define CAMEL_IMAPX_LIST_ATTR_TRASH            "\\Trash"
+
 G_BEGIN_DECLS
 
 typedef struct _CamelIMAPXListResponse CamelIMAPXListResponse;
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 20cfb37..668adc3 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -832,6 +832,8 @@ imapx_server_stash_command_arguments (CamelIMAPXServer *is)
                        g_string_append_printf (
                                buffer, " STATUS (%s)",
                                is->priv->status_data_items);
+               if (CAMEL_IMAPX_HAVE_CAPABILITY (is->cinfo, SPECIAL_USE))
+                       g_string_append_printf (buffer, " SPECIAL-USE");
                is->priv->list_return_opts = g_string_free (buffer, FALSE);
        } else {
                is->priv->list_return_opts = NULL;
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index c49cafb..6ba770f 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -423,7 +423,8 @@ struct {
        { "LIST-STATUS", IMAPX_CAPABILITY_LIST_STATUS },
        { "QUOTA", IMAPX_CAPABILITY_QUOTA },
        { "MOVE", IMAPX_CAPABILITY_MOVE },
-       { "NOTIFY", IMAPX_CAPABILITY_NOTIFY }
+       { "NOTIFY", IMAPX_CAPABILITY_NOTIFY },
+       { "SPECIAL-USE", IMAPX_CAPABILITY_SPECIAL_USE }
 };
 
 static GMutex capa_htable_lock;         /* capabilities lookup table lock */
diff --git a/camel/camel-imapx-utils.h b/camel/camel-imapx-utils.h
index 15b53d7..a5fbe6b 100644
--- a/camel/camel-imapx-utils.h
+++ b/camel/camel-imapx-utils.h
@@ -188,7 +188,8 @@ enum {
        IMAPX_CAPABILITY_LIST_EXTENDED          = (1 << 11),
        IMAPX_CAPABILITY_QUOTA                  = (1 << 12),
        IMAPX_CAPABILITY_MOVE                   = (1 << 13),
-       IMAPX_CAPABILITY_NOTIFY                 = (1 << 14)
+       IMAPX_CAPABILITY_NOTIFY                 = (1 << 14),
+       IMAPX_CAPABILITY_SPECIAL_USE            = (1 << 15)
 };
 
 struct _capability_info {
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index e502e50..b927bb2 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -843,6 +843,13 @@ CAMEL_IMAPX_LIST_ATTR_SUBSCRIBED
 CAMEL_IMAPX_LIST_ATTR_REMOTE
 CAMEL_IMAPX_LIST_ATTR_HASCHILDREN
 CAMEL_IMAPX_LIST_ATTR_HASNOCHILDREN
+CAMEL_IMAPX_LIST_ATTR_ALL
+CAMEL_IMAPX_LIST_ATTR_ARCHIVE
+CAMEL_IMAPX_LIST_ATTR_DRAFTS
+CAMEL_IMAPX_LIST_ATTR_FLAGGED
+CAMEL_IMAPX_LIST_ATTR_JUNK
+CAMEL_IMAPX_LIST_ATTR_SENT
+CAMEL_IMAPX_LIST_ATTR_TRASH
 camel_imapx_list_response_add_attribute
 camel_imapx_list_response_has_attribute
 camel_imapx_list_response_dup_attributes


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