CamelFilterDriver
3
CAMEL Library

# CamelFilterDriver

## Synopsis

    struct              CamelFilterDriver;
    CamelFolder *       (*CamelFilterGetFolderFunc)         (CamelFilterDriver *driver,
                                                             const gchar *uri,
                                                             gpointer 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,
                                                             gpointer data);
    void                camel_filter_driver_set_shell_func  (CamelFilterDriver *d,
                                                             CamelFilterShellFunc *func,
                                                             gpointer data);
    void                camel_filter_driver_set_play_sound_func
                                                            (CamelFilterDriver *d,
                                                             CamelFilterPlaySoundFunc *func,
                                                             gpointer data);
    void                camel_filter_driver_set_system_beep_func
                                                            (CamelFilterDriver *d,
                                                             CamelFilterSystemBeepFunc *func,
                                                             gpointer data);
    void                camel_filter_driver_set_folder_func (CamelFilterDriver *d,
                                                             CamelFilterGetFolderFunc fetcher,
                                                             gpointer data);
    void                camel_filter_driver_set_default_folder
                                                            (CamelFilterDriver *d,
                                                             CamelFolder *def);
    void                camel_filter_driver_add_rule        (CamelFilterDriver *d,
                                                             const gchar *name,
                                                             const gchar *match,
                                                             const gchar *action);
    gint                camel_filter_driver_remove_rule_by_name
                                                            (CamelFilterDriver *d,
                                                             const gchar *name);
    void                camel_filter_driver_flush           (CamelFilterDriver *driver,
                                                             CamelException *ex);
    gint                camel_filter_driver_filter_message  (CamelFilterDriver *driver,
                                                             CamelMimeMessage *message,
                                                             CamelMessageInfo *info,
                                                             const gchar *uid,
                                                             CamelFolder *source,
                                                             const gchar *source_url,
                                                             const gchar *original_source_url,
                                                             CamelException *ex);
    gint                camel_filter_driver_filter_mbox     (CamelFilterDriver *driver,
                                                             const gchar *mbox,
                                                             const gchar *original_source_url,
                                                             CamelException *ex);
    gint                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);
    gint                camel_filter_driver_rule_count      (CamelFilterDriver *d);
    struct filter_option * camel_filter_driver_rule_get     (CamelFilterDriver *d,
                                                             gint n);

## Description

## Details

### struct CamelFilterDriver

    struct CamelFilterDriver {
    	CamelObject parent;

    	struct _CamelFilterDriverPrivate *priv;
    };

### CamelFilterGetFolderFunc ()

    CamelFolder *       (*CamelFilterGetFolderFunc)         (CamelFilterDriver *driver,
                                                             const gchar *uri,
                                                             gpointer 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,
                                                             gpointer data);

`d` :

`func` :

`data` :

### camel_filter_driver_set_shell_func ()

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

`d` :

`func` :

`data` :

### camel_filter_driver_set_play_sound_func ()

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

`d` :

`func` :

`data` :

### camel_filter_driver_set_system_beep_func ()

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

`d` :

`func` :

`data` :

### camel_filter_driver_set_folder_func ()

    void                camel_filter_driver_set_folder_func (CamelFilterDriver *d,
                                                             CamelFilterGetFolderFunc fetcher,
                                                             gpointer 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 gchar *name,
                                                             const gchar *match,
                                                             const gchar *action);

`d` :

`name` :

`match` :

`action` :

### camel_filter_driver_remove_rule_by_name ()

    gint                camel_filter_driver_remove_rule_by_name
                                                            (CamelFilterDriver *d,
                                                             const gchar *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 ()

    gint                camel_filter_driver_filter_message  (CamelFilterDriver *driver,
                                                             CamelMimeMessage *message,
                                                             CamelMessageInfo *info,
                                                             const gchar *uid,
                                                             CamelFolder *source,
                                                             const gchar *source_url,
                                                             const gchar *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

`uid` :

  message uid or NULL

`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 ()

    gint                camel_filter_driver_filter_mbox     (CamelFilterDriver *driver,
                                                             const gchar *mbox,
                                                             const gchar *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 ()

    gint                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 ()

    gint                camel_filter_driver_rule_count      (CamelFilterDriver *d);

`d` :

Returns :

### camel_filter_driver_rule_get ()

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

`d` :

`n` :

Returns :