CamelFilterDriver
3
CAMEL Library

# CamelFilterDriver

## Synopsis

    struct              CamelFilterDriver;
    CamelFolder*        (*CamelFilterGetFolderFunc)         (CamelFilterDriver *driver,
                                                             const char *uri,
                                                             void *data,
                                                             CamelException *ex);
    CamelFilterDriver*  camel_filter_driver_new             (CamelSession *);
    void                camel_filter_driver_set_logfile     (CamelFilterDriver *d,
                                                             FILE *logfile);
    void                camel_filter_driver_set_status_func (CamelFilterDriver *d,
                                                             CamelFilterStatusFunc *func,
                                                             void *data);
    void                camel_filter_driver_set_shell_func  (CamelFilterDriver *d,
                                                             CamelFilterShellFunc *func,
                                                             void *data);
    void                camel_filter_driver_set_play_sound_func
                                                            (CamelFilterDriver *d,
                                                             CamelFilterPlaySoundFunc *func,
                                                             void *data);
    void                camel_filter_driver_set_system_beep_func
                                                            (CamelFilterDriver *d,
                                                             CamelFilterSystemBeepFunc *func,
                                                             void *data);
    void                camel_filter_driver_set_folder_func (CamelFilterDriver *d,
                                                             CamelFilterGetFolderFunc fetcher,
                                                             void *data);
    void                camel_filter_driver_set_default_folder
                                                            (CamelFilterDriver *d,
                                                             CamelFolder *def);
    void                camel_filter_driver_add_rule        (CamelFilterDriver *d,
                                                             const char *name,
                                                             const char *match,
                                                             const char *action);
    int                 camel_filter_driver_remove_rule_by_name
                                                            (CamelFilterDriver *d,
                                                             const char *name);
    void                camel_filter_driver_flush           (CamelFilterDriver *driver,
                                                             CamelException *ex);
    int                 camel_filter_driver_filter_message  (CamelFilterDriver *driver,
                                                             CamelMimeMessage *message,
                                                             CamelMessageInfo *info,
                                                             const char *uri,
                                                             CamelFolder *source,
                                                             const char *source_url,
                                                             const char *original_source_url,
                                                             CamelException *ex);
    int                 camel_filter_driver_filter_mbox     (CamelFilterDriver *driver,
                                                             const char *mbox,
                                                             const char *original_source_url,
                                                             CamelException *ex);
    int                 camel_filter_driver_filter_folder   (CamelFilterDriver *driver,
                                                             CamelFolder *folder,
                                                             CamelUIDCache *cache,
                                                             GPtrArray *uids,
                                                             gboolean remove,
                                                             CamelException *ex);
    void                camel_filter_driver_expand_option   (CamelFilterDriver *d,
                                                             GString *s,
                                                             GString *action,
                                                             struct filter_option *op);
    int                 camel_filter_driver_rule_count      (CamelFilterDriver *d);
    struct filter_option* camel_filter_driver_rule_get      (CamelFilterDriver *d,
                                                             int n);

## Description

## Details

### struct CamelFilterDriver

    struct CamelFilterDriver {
    	CamelObject parent;

    	struct _CamelFilterDriverPrivate *priv;
    };

### CamelFilterGetFolderFunc ()

    CamelFolder*        (*CamelFilterGetFolderFunc)         (CamelFilterDriver *driver,
                                                             const char *uri,
                                                             void *data,
                                                             CamelException *ex);

`driver` :

`uri` :

`data` :

`ex` :

Returns :

### camel_filter_driver_new ()

    CamelFilterDriver*  camel_filter_driver_new             (CamelSession *);

`Param1` :

Returns :

  A new CamelFilterDriver object

### camel_filter_driver_set_logfile ()

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

`d` :

`logfile` :

### camel_filter_driver_set_status_func ()

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

`d` :

`func` :

`data` :

### camel_filter_driver_set_shell_func ()

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

`d` :

`func` :

`data` :

### camel_filter_driver_set_play_sound_func ()

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

`d` :

`func` :

`data` :

### camel_filter_driver_set_system_beep_func ()

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

`d` :

`func` :

`data` :

### camel_filter_driver_set_folder_func ()

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

`d` :

`fetcher` :

`data` :

### camel_filter_driver_set_default_folder ()

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

`d` :

`def` :

### camel_filter_driver_add_rule ()

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

`d` :

`name` :

`match` :

`action` :

### camel_filter_driver_remove_rule_by_name ()

    int                 camel_filter_driver_remove_rule_by_name
                                                            (CamelFilterDriver *d,
                                                             const char *name);

`d` :

`name` :

Returns :

### camel_filter_driver_flush ()

    void                camel_filter_driver_flush           (CamelFilterDriver *driver,
                                                             CamelException *ex);

Flush all of the only-once filter actions.

`driver` :

`ex` :

### camel_filter_driver_filter_message ()

    int                 camel_filter_driver_filter_message  (CamelFilterDriver *driver,
                                                             CamelMimeMessage *message,
                                                             CamelMessageInfo *info,
                                                             const char *uri,
                                                             CamelFolder *source,
                                                             const char *source_url,
                                                             const char *original_source_url,
                                                             CamelException *ex);

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

`driver` :

  CamelFilterDriver

`message` :

  message to filter or NULL

`info` :

  message info or NULL

`uri` :

`source` :

  source folder or NULL

`source_url` :

  url of source folder or NULL

`original_source_url` :

  url of original source folder (pre-movemail) or NULL

`ex` :

  exception

Returns :

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

### camel_filter_driver_filter_mbox ()

    int                 camel_filter_driver_filter_mbox     (CamelFilterDriver *driver,
                                                             const char *mbox,
                                                             const char *original_source_url,
                                                             CamelException *ex);

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.

`driver` :

  CamelFilterDriver

`mbox` :

  mbox filename to be filtered

`original_source_url` :

`ex` :

  exception

Returns :

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

### camel_filter_driver_filter_folder ()

    int                 camel_filter_driver_filter_folder   (CamelFilterDriver *driver,
                                                             CamelFolder *folder,
                                                             CamelUIDCache *cache,
                                                             GPtrArray *uids,
                                                             gboolean remove,
                                                             CamelException *ex);

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

`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

`ex` :

  exception

Returns :

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

### camel_filter_driver_expand_option ()

    void                camel_filter_driver_expand_option   (CamelFilterDriver *d,
                                                             GString *s,
                                                             GString *action,
                                                             struct filter_option *op);

`d` :

`s` :

`action` :

`op` :

### camel_filter_driver_rule_count ()

    int                 camel_filter_driver_rule_count      (CamelFilterDriver *d);

`d` :

Returns :

### camel_filter_driver_rule_get ()

    struct filter_option* camel_filter_driver_rule_get      (CamelFilterDriver *d,
                                                             int n);

`d` :

`n` :

Returns :