## CamelFolderSearch

CamelFolderSearch

## Synopsis

    struct              CamelFolderSearch;
    CamelFolderSearch * camel_folder_search_new             (void);
    void                camel_folder_search_set_folder      (CamelFolderSearch *search,
                                                             CamelFolder *folder);
    void                camel_folder_search_set_summary     (CamelFolderSearch *search,
                                                             GPtrArray *summary);
    void                camel_folder_search_set_body_index  (CamelFolderSearch *search,
                                                             CamelIndex *body_index);
    GPtrArray *         camel_folder_search_search          (CamelFolderSearch *search,
                                                             const gchar *expr,
                                                             GPtrArray *uids,
                                                             GCancellable *cancellable,
                                                             GError **error);
    guint32             camel_folder_search_count           (CamelFolderSearch *search,
                                                             const gchar *expr,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                camel_folder_search_free_result     (CamelFolderSearch *search,
                                                             GPtrArray *Param2);
    time_t              camel_folder_search_util_add_months (time_t t,
                                                             gint months);
    void                camel_folder_search_construct       (CamelFolderSearch *search);

## Object Hierarchy

      GObject
       +----CamelObject
             +----CamelFolderSearch
                   +----CamelIMAPXSearch

## Description

## Details

### struct CamelFolderSearch

    struct CamelFolderSearch;

### camel_folder_search_new ()

    CamelFolderSearch * camel_folder_search_new             (void);

Create a new CamelFolderSearch object.

A CamelFolderSearch is a subclassable, extensible s-exp evaluator which enforces a particular set of s-expressions. Particular methods may be overriden by an implementation to implement a search for any sort of backend.

Returns : | A new CamelFolderSearch widget.

### camel_folder_search_set_folder ()

    void                camel_folder_search_set_folder      (CamelFolderSearch *search,
                                                             CamelFolder *folder);

Set the folder attribute of the search. This is currently unused, but could be used to perform a slow-search when indexes and so forth are not available. Or for use by subclasses.

`folder` : | A folder.

### camel_folder_search_set_summary ()

    void                camel_folder_search_set_summary     (CamelFolderSearch *search,
                                                             GPtrArray *summary);

Set the array of summary objects representing the span of the search.

If this is not set, then a subclass must provide the functions for searching headers and for the match-all operator.

`summary` : | An array of CamelMessageInfo pointers.

### camel_folder_search_set_body_index ()

    void                camel_folder_search_set_body_index  (CamelFolderSearch *search,
                                                             CamelIndex *body_index);

Set the index representing the contents of all messages in this folder. If this is not set, then the folder implementation should sub-class the CamelFolderSearch and provide its own body-contains function.

### camel_folder_search_search ()

    GPtrArray *         camel_folder_search_search          (CamelFolderSearch *search,
                                                             const gchar *expr,
                                                             GPtrArray *uids,
                                                             GCancellable *cancellable,
                                                             GError **error);

Run a search. Search must have had Folder already set on it, and it must implement summaries.

`uids` : | to search against, NULL for all uid's.
`cancellable` : | a GCancellable
`error` : | return location for a GError, or `NULL`

### camel_folder_search_count ()

    guint32             camel_folder_search_count           (CamelFolderSearch *search,
                                                             const gchar *expr,
                                                             GCancellable *cancellable,
                                                             GError **error);

Run a search. Search must have had Folder already set on it, and it must implement summaries.

`cancellable` : | a GCancellable
`error` : | return location for a GError, or `NULL`
Returns : | Number of messages that match the query.

Since 2.26

### camel_folder_search_free_result ()

    void                camel_folder_search_free_result     (CamelFolderSearch *search,
                                                             GPtrArray *Param2);

### camel_folder_search_util_add_months ()

    time_t              camel_folder_search_util_add_months (time_t t,
                                                             gint months);

Increases time `t` by the given number of months (or decreases, if `months` is negative).

`t` : | Initial time
`months` : | number of months to add or subtract
Returns : | a new time_t value

Since 3.2

### camel_folder_search_construct ()

    void                camel_folder_search_construct       (CamelFolderSearch *search);

### Warning

`camel_folder_search_construct` has been deprecated since version 3.8 and should not be used in newly-written code. The function no longer does anything.

This function used to register callbacks with `search`'s internal CamelSExp, but this now happens during instance initialization.

`search` : | a CamelFolderSearch