## CamelIMAPXNamespaceResponse CamelIMAPXNamespaceResponse — Stores an IMAP NAMESPACE response |

## Synopsis

    #include <camel/camel.h>

    struct              CamelIMAPXNamespaceResponse;
    CamelIMAPXNamespaceResponse * camel_imapx_namespace_response_new
                                                            (CamelIMAPXInputStream *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);

## Object Hierarchy

      GObject
       +----CamelIMAPXNamespaceResponse

## Description

CamelIMAPXNamespaceResponse encapsulates an IMAP NAMESPACE response, which consists of a set of CamelIMAPXNamespace objects grouped by CamelIMAPXNamespaceCategory.

## Details

### struct CamelIMAPXNamespaceResponse

    struct CamelIMAPXNamespaceResponse;

Contains only private data that should be read and manipulated using the functions below.

Since 3.12

### camel_imapx_namespace_response_new ()

    CamelIMAPXNamespaceResponse * camel_imapx_namespace_response_new
                                                            (CamelIMAPXInputStream *stream,
                                                             GCancellable *cancellable,
                                                             GError **error);

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`.

`stream` : | a CamelIMAPXInputStream
`cancellable` : | optional GCancellable object, or `NULL`
`error` : | return location for a GError, or `NULL`
Returns : | a CamelIMAPXNamespaceResponse, or `NULL`

Since 3.12

### camel_imapx_namespace_response_faux_new ()

    CamelIMAPXNamespaceResponse * camel_imapx_namespace_response_faux_new
                                                            (CamelIMAPXListResponse *list_response);

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.

`list_response` : | a CamelIMAPXListResponse
Returns : | a CamelIMAPXNamespaceResponse

Since 3.12

### camel_imapx_namespace_response_list ()

    GList *             camel_imapx_namespace_response_list (CamelIMAPXNamespaceResponse *response);

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:

    1
    g_list_free_full (list, g_object_unref);

`response` : | a CamelIMAPXNamespaceResponse
Returns : | a list of CamelIMAPXNamespace instances

Since 3.12

### camel_imapx_namespace_response_lookup ()

    CamelIMAPXNamespace * camel_imapx_namespace_response_lookup
                                                            (CamelIMAPXNamespaceResponse *response,
                                                             const gchar *mailbox_name,
                                                             gchar separator);

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.

`response` : | a CamelIMAPXNamespaceResponse
`mailbox_name` : | a mailbox name
`separator` : | a mailbox path separator character
Returns : | a CamelIMAPXNamespace, or `NULL`

Since 3.12

### camel_imapx_namespace_response_lookup_for_path ()

    CamelIMAPXNamespace * camel_imapx_namespace_response_lookup_for_path
                                                            (CamelIMAPXNamespaceResponse *response,
                                                             const gchar *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.

`response` : | a CamelIMAPXNamespaceResponse
`folder_path` : | a Camel folder path
Returns : | a CamelIMAPXNamespace, or `NULL`

Since 3.12