## Mail Folder Utilities

Mail Folder Utilities

## Synopsis

    gboolean            e_mail_folder_append_message_sync   (CamelFolder *folder,
                                                             CamelMimeMessage *message,
                                                             CamelMessageInfo *info,
                                                             gchar **appended_uid,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_mail_folder_append_message        (CamelFolder *folder,
                                                             CamelMimeMessage *message,
                                                             CamelMessageInfo *info,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            e_mail_folder_append_message_finish (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             gchar **appended_uid,
                                                             GError **error);
    gboolean            e_mail_folder_expunge_sync          (CamelFolder *folder,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_mail_folder_expunge               (CamelFolder *folder,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            e_mail_folder_expunge_finish        (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);
    CamelMimePart *     e_mail_folder_build_attachment_sync (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gchar **fwd_subject,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_mail_folder_build_attachment      (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    CamelMimePart *     e_mail_folder_build_attachment_finish
                                                            (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             gchar **fwd_subject,
                                                             GError **error);
    GHashTable *        e_mail_folder_find_duplicate_messages_sync
                                                            (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_mail_folder_find_duplicate_messages
                                                            (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GHashTable *        e_mail_folder_find_duplicate_messages_finish
                                                            (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);
    GHashTable *        e_mail_folder_get_multiple_messages_sync
                                                            (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_mail_folder_get_multiple_messages (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GHashTable *        e_mail_folder_get_multiple_messages_finish
                                                            (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            e_mail_folder_remove_sync           (CamelFolder *folder,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_mail_folder_remove                (CamelFolder *folder,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            e_mail_folder_remove_finish         (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            e_mail_folder_remove_attachments_sync
                                                            (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_mail_folder_remove_attachments    (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            e_mail_folder_remove_attachments_finish
                                                            (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            e_mail_folder_save_messages_sync    (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GFile *destination,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_mail_folder_save_messages         (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GFile *destination,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            e_mail_folder_save_messages_finish  (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);
    gchar *             e_mail_folder_uri_build             (CamelStore *store,
                                                             const gchar *folder_name);
    gboolean            e_mail_folder_uri_parse             (CamelSession *session,
                                                             const gchar *folder_uri,
                                                             CamelStore **out_store,
                                                             gchar **out_folder_name,
                                                             GError **error);
    gboolean            e_mail_folder_uri_equal             (CamelSession *session,
                                                             const gchar *folder_uri_a,
                                                             const gchar *folder_uri_b);
    gchar *             e_mail_folder_uri_from_folder       (CamelFolder *folder);
    gchar *             e_mail_folder_uri_to_markup         (CamelSession *session,
                                                             const gchar *folder_uri,
                                                             GError **error);

## Description

## Details

### e_mail_folder_append_message_sync ()

    gboolean            e_mail_folder_append_message_sync   (CamelFolder *folder,
                                                             CamelMimeMessage *message,
                                                             CamelMessageInfo *info,
                                                             gchar **appended_uid,
                                                             GCancellable *cancellable,
                                                             GError **error);

### e_mail_folder_append_message ()

    void                e_mail_folder_append_message        (CamelFolder *folder,
                                                             CamelMimeMessage *message,
                                                             CamelMessageInfo *info,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_mail_folder_append_message_finish ()

    gboolean            e_mail_folder_append_message_finish (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             gchar **appended_uid,
                                                             GError **error);

### e_mail_folder_expunge_sync ()

    gboolean            e_mail_folder_expunge_sync          (CamelFolder *folder,
                                                             GCancellable *cancellable,
                                                             GError **error);

### e_mail_folder_expunge ()

    void                e_mail_folder_expunge               (CamelFolder *folder,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_mail_folder_expunge_finish ()

    gboolean            e_mail_folder_expunge_finish        (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_mail_folder_build_attachment_sync ()

    CamelMimePart *     e_mail_folder_build_attachment_sync (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gchar **fwd_subject,
                                                             GCancellable *cancellable,
                                                             GError **error);

### e_mail_folder_build_attachment ()

    void                e_mail_folder_build_attachment      (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_mail_folder_build_attachment_finish ()

    CamelMimePart *     e_mail_folder_build_attachment_finish
                                                            (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             gchar **fwd_subject,
                                                             GError **error);

### e_mail_folder_find_duplicate_messages_sync ()

    GHashTable *        e_mail_folder_find_duplicate_messages_sync
                                                            (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GCancellable *cancellable,
                                                             GError **error);

### e_mail_folder_find_duplicate_messages ()

    void                e_mail_folder_find_duplicate_messages
                                                            (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_mail_folder_find_duplicate_messages_finish ()

    GHashTable *        e_mail_folder_find_duplicate_messages_finish
                                                            (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_mail_folder_get_multiple_messages_sync ()

    GHashTable *        e_mail_folder_get_multiple_messages_sync
                                                            (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GCancellable *cancellable,
                                                             GError **error);

### e_mail_folder_get_multiple_messages ()

    void                e_mail_folder_get_multiple_messages (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_mail_folder_get_multiple_messages_finish ()

    GHashTable *        e_mail_folder_get_multiple_messages_finish
                                                            (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_mail_folder_remove_sync ()

    gboolean            e_mail_folder_remove_sync           (CamelFolder *folder,
                                                             GCancellable *cancellable,
                                                             GError **error);

### e_mail_folder_remove ()

    void                e_mail_folder_remove                (CamelFolder *folder,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_mail_folder_remove_finish ()

    gboolean            e_mail_folder_remove_finish         (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_mail_folder_remove_attachments_sync ()

    gboolean            e_mail_folder_remove_attachments_sync
                                                            (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GCancellable *cancellable,
                                                             GError **error);

### e_mail_folder_remove_attachments ()

    void                e_mail_folder_remove_attachments    (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_mail_folder_remove_attachments_finish ()

    gboolean            e_mail_folder_remove_attachments_finish
                                                            (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_mail_folder_save_messages_sync ()

    gboolean            e_mail_folder_save_messages_sync    (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GFile *destination,
                                                             GCancellable *cancellable,
                                                             GError **error);

### e_mail_folder_save_messages ()

    void                e_mail_folder_save_messages         (CamelFolder *folder,
                                                             GPtrArray *message_uids,
                                                             GFile *destination,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### e_mail_folder_save_messages_finish ()

    gboolean            e_mail_folder_save_messages_finish  (CamelFolder *folder,
                                                             GAsyncResult *result,
                                                             GError **error);

### e_mail_folder_uri_build ()

    gchar *             e_mail_folder_uri_build             (CamelStore *store,
                                                             const gchar *folder_name);

Builds a folder URI string from `store` and `folder_name`.

`store` : | a CamelStore
`folder_name` : | a folder name
Returns : | a newly-allocated folder URI string

### e_mail_folder_uri_parse ()

    gboolean            e_mail_folder_uri_parse             (CamelSession *session,
                                                             const gchar *folder_uri,
                                                             CamelStore **out_store,
                                                             gchar **out_folder_name,
                                                             GError **error);

Parses a folder URI generated by `e_mail_folder_uri_build()` and returns `FALSE`.

If the function is able to parse the URI, the CamelStore instance set in `out_store` should be unreferenced with `g_object_unref()` when done with it, and the folder name string set in `out_folder_name` should be freed with `g_free()`.

The function also handles older style URIs, such as ones where the CamelStore's "uri" string was embedded directly in the folder URI, and account-based URIs that used an "email://" prefix.

`session` : | a CamelSession
`folder_uri` : | a folder URI
`out_store` : | return location for a CamelStore, or `NULL`
`out_folder_name` : | return location for a folder name, or `NULL`
`error` : | return location for a GError, or `NULL`
Returns : | `TRUE` if `folder_uri` could be parsed, `FALSE` otherwise

### e_mail_folder_uri_equal ()

    gboolean            e_mail_folder_uri_equal             (CamelSession *session,
                                                             const gchar *folder_uri_a,
                                                             const gchar *folder_uri_b);

Compares two folder URIs for equality. If either URI is invalid, the function returns `FALSE`.

`session` : | a CamelSession
`folder_uri_a` : | a folder URI
`folder_uri_b` : | another folder URI
Returns : | `TRUE` if the URIs are equal, `FALSE` if not

### e_mail_folder_uri_from_folder ()

    gchar *             e_mail_folder_uri_from_folder       (CamelFolder *folder);

Convenience function for building a folder URI from a CamelFolder. Free the returned URI string with `g_free()`.

`folder` : | a CamelFolder
Returns : | a newly-allocated folder URI string

### e_mail_folder_uri_to_markup ()

    gchar *             e_mail_folder_uri_to_markup         (CamelSession *session,
                                                             const gchar *folder_uri,
                                                             GError **error);

Converts `folder_uri` to a markup string suitable for displaying to users. The string consists of the CamelStore display name (in bold), followed by the folder path. If the URI is malformed or no corresponding store exists, the function sets `error` and returns `NULL`. Free the returned string with `g_free()`.

`session` : | a CamelSession
`folder_uri` : | a folder URI
`error` : | return location for a GError, or `NULL`
Returns : | a newly-allocated markup string, or `NULL`