FilterDriver
Object Hierarchy:
Description:
[
CCode ( type_id =
"camel_filter_driver_get_type ()" ) ]
public class FilterDriver :
Object
Rule-based message filtering engine.
FilterDriver manages the filtering process. Given a set of filter rules — each consisting of a matching
s-expression and an action s-expression — and a set of messages, it evaluates each rule against each message in turn.
Filter rules use two s-expressions evaluated by SExp:
- The **match expression** returns a boolean indicating whether the message matches. See
CamelFolderSearch for the
supported matching functions.
- The **action expression** is typically a `(begin ...)` block listing the actions to perform. Available actions include:
- `(delete)` — mark for deletion
- `(copy-to uri …)` / `(move-to uri …)` — copy or move to a folder
- `(set-system-flag flag)` / `(unset-system-flag flag)` — set/clear flags
- `(stop)` — halt further rule processing
- `(pipe-message cmd)` — pipe the message through an external command
- `(shell cmd …)` — run a shell command
- `(beep)` / `(play-sound file)` — notify the user
Content:
Creation methods:
Methods:
- public void add_rule (string name, string match, string action)
Adds a new rule to set of rules to process by the filter driver.
- public int filter_folder (Folder folder, UIDCache cache, GenericArray<string>? uids, bool remove, Cancellable? cancellable = null) throws Error
Filters a folder based on rules defined in the FilterDriver object.
- public int filter_mbox (string mbox, string? original_source_url, Cancellable? cancellable = null) throws Error
Filters an mbox file based on rules defined in the FilterDriver
object.
- public int filter_message (MimeMessage? message, MessageInfo? info, string? uid, Folder? source, string? store_uid, string? original_store_uid, Cancellable? cancellable = null) throws Error
Filters a message based on rules defined in the FilterDriver object.
- public void flush () throws Error
Flush all of the only-once filter actions.
- public bool remove_rule_by_name (string name)
Removes a rule by name, added by
add_rule.
- public void set_default_folder (Folder? def)
Sets a default folder for the driver.
- public void set_folder_func (FilterGetFolderFunc get_folder)
- public void set_logfile (FileStream logfile)
Sets a log file to use for logging.
- public void set_play_sound_func (FilterPlaySoundFunc func)
Sets a callback to call when a play of a sound is requested.
- public void set_shell_func (FilterShellFunc func)
Sets a shell command callback, which is called when a shell command
execution is requested.
- public void set_status_func (FilterStatusFunc func)
Sets a status callback, which is used to report progress/status.
- public void set_system_beep_func (FilterSystemBeepFunc func)
Sets a callback to use for system beep.
Inherited Members:
All known members inherited from class GLib.Object