## CamelIMAPXNamespaceResponse

CamelIMAPXNamespaceResponse — Stores an IMAP NAMESPACE response

## Functions

CamelIMAPXNamespaceResponse * | camel_imapx_namespace_response_new ()
CamelIMAPXNamespaceResponse * | camel_imapx_namespace_response_faux_new ()
GList * | camel_imapx_namespace_response_list ()
void | camel_imapx_namespace_response_add ()
void | camel_imapx_namespace_response_remove ()
CamelIMAPXNamespace * | camel_imapx_namespace_response_lookup ()
CamelIMAPXNamespace * | camel_imapx_namespace_response_lookup_for_path ()

## Types and Values

struct | CamelIMAPXNamespaceResponse

## Object Hierarchy

        GObject
        ╰── CamelIMAPXNamespaceResponse

## Includes

    #include <camel/camel.h>

## Description

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

## Functions

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

#### Parameters

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

#### Returns

a CamelIMAPXNamespaceResponse, or `NULL` on error

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.

#### Parameters

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);

#### Parameters

response | a CamelIMAPXNamespaceResponse |

#### Returns

a list of CamelIMAPXNamespace instances

Since: 3.12

### camel_imapx_namespace_response_add ()

    void
    camel_imapx_namespace_response_add (CamelIMAPXNamespaceResponse *response,
                                        CamelIMAPXNamespace *namespace);

### camel_imapx_namespace_response_remove ()

    void
    camel_imapx_namespace_response_remove (CamelIMAPXNamespaceResponse *response,
                                           CamelIMAPXNamespace *namespace);

Removes `namespace` from the list of namespaces in the `response` . If no such namespace exists then does nothing.

#### Parameters

response | a CamelIMAPXNamespaceResponse |
namespace | a CamelIMAPXNamespace to remove |

Since: 3.16

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

#### Parameters

response | a CamelIMAPXNamespaceResponse |
mailbox_name | a mailbox name |
separator | a mailbox path separator character |

#### Returns

a CamelIMAPXNamespace, or `NULL`.

[nullable]

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.

#### Parameters

response | a CamelIMAPXNamespaceResponse |
folder_path | a Camel folder path |

#### Returns

a CamelIMAPXNamespace, or `NULL`.

[nullable]

Since: 3.12

## Types and Values

### struct CamelIMAPXNamespaceResponse

    struct CamelIMAPXNamespaceResponse;

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

Since: 3.12