CamelFilterDriver: Camel Reference Manual

## CamelFilterDriver CamelFilterDriver |

## Functions

CamelFolder * | (*CamelFilterGetFolderFunc) ()
CamelFilterDriver * | camel_filter_driver_new ()
void | camel_filter_driver_set_logfile ()
void | camel_filter_driver_set_status_func ()
void | camel_filter_driver_set_shell_func ()
void | camel_filter_driver_set_play_sound_func ()
void | camel_filter_driver_set_system_beep_func ()
void | camel_filter_driver_set_folder_func ()
void | camel_filter_driver_set_default_folder ()
void | camel_filter_driver_add_rule ()
gint | camel_filter_driver_remove_rule_by_name ()
void | camel_filter_driver_flush ()
gint | camel_filter_driver_filter_message ()
gint | camel_filter_driver_filter_mbox ()
gint | camel_filter_driver_filter_folder ()

## Types and Values

enum | camel_filter_status_t
struct | CamelFilterDriver

## Object Hierarchy

        GObject
        ╰── CamelFilterDriver

## Description

## Functions

### CamelFilterGetFolderFunc ()

    CamelFolder *
    (*CamelFilterGetFolderFunc) (CamelFilterDriver *driver,
                                 const gchar *uri,
                                 gpointer data,
                                 GError **error);

### camel_filter_driver_new ()

    CamelFilterDriver *
    camel_filter_driver_new (struct _CamelSession *Param1);

#### Returns

A new CamelFilterDriver object

### camel_filter_driver_set_logfile ()

    void
    camel_filter_driver_set_logfile (CamelFilterDriver *d,
                                     FILE *logfile);

### camel_filter_driver_set_status_func ()

    void
    camel_filter_driver_set_status_func (CamelFilterDriver *d,
                                         CamelFilterStatusFunc *func,
                                         gpointer data);

### camel_filter_driver_set_shell_func ()

    void
    camel_filter_driver_set_shell_func (CamelFilterDriver *d,
                                        CamelFilterShellFunc *func,
                                        gpointer data);

### camel_filter_driver_set_play_sound_func ()

    void
    camel_filter_driver_set_play_sound_func
                                   (CamelFilterDriver *d,
                                    CamelFilterPlaySoundFunc *func,
                                    gpointer data);

### camel_filter_driver_set_system_beep_func ()

    void
    camel_filter_driver_set_system_beep_func
                                   (CamelFilterDriver *d,
                                    CamelFilterSystemBeepFunc *func,
                                    gpointer data);

### camel_filter_driver_set_folder_func ()

    void
    camel_filter_driver_set_folder_func (CamelFilterDriver *d,
                                         CamelFilterGetFolderFunc fetcher,
                                         gpointer data);

### camel_filter_driver_set_default_folder ()

    void
    camel_filter_driver_set_default_folder
                                   (CamelFilterDriver *d,
                                    CamelFolder *def);

### camel_filter_driver_add_rule ()

    void
    camel_filter_driver_add_rule (CamelFilterDriver *d,
                                  const gchar *name,
                                  const gchar *match,
                                  const gchar *action);

### camel_filter_driver_remove_rule_by_name ()

    gint
    camel_filter_driver_remove_rule_by_name
                                   (CamelFilterDriver *d,
                                    const gchar *name);

### camel_filter_driver_flush ()

    void
    camel_filter_driver_flush (CamelFilterDriver *driver,
                               GError **error);

Flush all of the only-once filter actions.

#### Parameters

error | return location for a GError, or `NULL` |

### camel_filter_driver_filter_message ()

    gint
    camel_filter_driver_filter_message (CamelFilterDriver *driver,
                                        CamelMimeMessage *message,
                                        CamelMessageInfo *info,
                                        const gchar *uid,
                                        CamelFolder *source,
                                        const gchar *store_uid,
                                        const gchar *original_store_uid,
                                        GCancellable *cancellable,
                                        GError **error);

Filters a message based on rules defined in the FilterDriver object. If the source folder (`source` ) and the uid (`uid` ) are provided, the filter will operate on the CamelFolder (which in certain cases is more efficient than using the default `camel_folder_append_message()` function).

#### Parameters

driver | CamelFilterDriver |
message | message to filter or NULL |
info | message info or NULL |
uid | message uid or NULL |
source | source folder or NULL |
store_uid | UID of source store, or `NULL` |
original_store_uid | UID of source store (pre-movemail), or `NULL` |
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

-1 if errors were encountered during filtering, otherwise returns 0.

### camel_filter_driver_filter_mbox ()

    gint
    camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
                                     const gchar *mbox,
                                     const gchar *original_source_url,
                                     GCancellable *cancellable,
                                     GError **error);

Filters an mbox file based on rules defined in the FilterDriver object. Is more efficient as it doesn't need to open the folder through Camel directly.

#### Parameters

driver | CamelFilterDriver |
mbox | mbox filename to be filtered |
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

-1 if errors were encountered during filtering, otherwise returns 0.

### camel_filter_driver_filter_folder ()

    gint
    camel_filter_driver_filter_folder (CamelFilterDriver *driver,
                                       CamelFolder *folder,
                                       CamelUIDCache *cache,
                                       GPtrArray *uids,
                                       gboolean remove,
                                       GCancellable *cancellable,
                                       GError **error);

Filters a folder based on rules defined in the FilterDriver object.

#### Parameters

driver | CamelFilterDriver |
folder | CamelFolder to be filtered |
cache | UID cache (needed for POP folders) |
uids | message uids to be filtered or NULL (as a shortcut to filter all messages) |
remove | TRUE to mark filtered messages as deleted |
cancellable | optional GCancellable object, or `NULL` |
error | return location for a GError, or `NULL` |

#### Returns

-1 if errors were encountered during filtering, otherwise returns 0.

## Types and Values

### enum camel_filter_status_t

#### Members

CAMEL_FILTER_STATUS_NONE |  |
CAMEL_FILTER_STATUS_START |  |
CAMEL_FILTER_STATUS_ACTION |  |
CAMEL_FILTER_STATUS_PROGRESS |  |
CAMEL_FILTER_STATUS_END |  |

### struct CamelFilterDriver

    struct CamelFilterDriver;