Camel.SExp
Description: Reference for Camel.SExp

### Class

# CamelSExp

since: 3.4

#### Description [src]

    class Camel.SExp : GObject.Object
    {
      /* No available fields */
    }

S-expression matching functions for message filtering.

`CamelSExp` implements the s-expression matching functions used by `CamelFilterDriver` to evaluate filter rules against messages.

Match expressions operate on a single message and return a boolean. Available matching functions include:

- `(body-contains string …)` — matches if the message body contains any of the given strings (searches text/… parts with tag-stripping for HTML).
- `(header-contains header string …)` / `(header-matches …)` / `(header-starts-with …)` / `(header-ends-with …)` — header matching.
- `(header-exists header)` — tests whether a header is present.
- `(match-all expression)` — evaluates a boolean against all messages.
- `(user-flag flag)` / `(user-tag tag value)` — user metadata matching.
- `(system-flag flag)` — system flag matching (seen, deleted, flagged, etc.).
- `(pipe-message cmd)` — runs the message through an external program whose exit code determines the match result.

# The following built-in s-exp's are supported:

list = (and list*) perform an intersection of a number of lists, and return that.

bool = (and bool*) perform a boolean AND of boolean values.

list = (or list*) perform a union of a number of lists, returning the new list.

bool = (or bool*) perform a boolean OR of boolean values.

gint = (+ int*) Add integers.

string = (+ string*) Concat strings.

time_t = (+ time_t*) Add time_t values.

gint = (- gint int*) Subtract integers from the first.

time_t = (- time_t*) Subtract time_t values from the first.

gint = (cast-int string|int|bool) Cast to an integer value.

string = (cast-string string|int|bool) Cast to a string value.

## Comparison operators:

bool = (< gint gint) bool = (> gint gint) bool = (= gint gint)

bool = (< string string) bool = (> string string) bool = (= string string)

bool = (< time_t time_t) bool = (> time_t time_t) bool = (= time_t time_t) Perform a comparison of 2 integers, 2 string values, or 2 time values.

## Function flow:

type = (if bool function) type = (if bool function function) Choose a flow path based on a boolean value

type = (begin func func func) Execute a sequence. The last function return is the return type.

Available since: 3.4

#### Hierarchy

#### Ancestors

- GObject

#### Constructors

###### camel_sexp_new

No description available.

since: 3.4

#### Functions

###### camel_sexp_encode_bool

Encode a bool into an s-expression `string`. Bools are encoded using #t #f syntax.

since: 3.4

###### camel_sexp_encode_string

Add a c string `v_string` to the s-expression stored in the gstring `s`. Quotes are added, and special characters are escaped appropriately.

since: 3.4

#### Instance methods

###### camel_sexp_add_function

Adds a function symbol which can not perform short evaluation. Use `camel_sexp_add_ifunction()` for functions which can.

since: 3.4

###### camel_sexp_add_ifunction

Adds a function symbol which can perform short evaluation, or doesn’t execute everything. Use `camel_sexp_add_function()` for any other types of the function symbols.

since: 3.4

###### camel_sexp_add_variable

Adds a variable named `name` to the given `scope`, set to the given `value`.

since: 3.4

###### camel_sexp_error

No description available.

since: 3.4

###### camel_sexp_eval

No description available.

since: 3.4

###### camel_sexp_evaluate_occur_times

No description available.

###### camel_sexp_fatal_error

Sets an error from the given format and stops execution. Int replaces previously set error, if any.

since: 3.4

###### camel_sexp_input_file

Prepares to scan a file.

since: 3.4

###### camel_sexp_input_text

Prepares to scan a text buffer.

since: 3.4

###### camel_sexp_parse

No description available.

since: 3.4

###### camel_sexp_parse_value

No description available.

since: 3.4

###### camel_sexp_remove_symbol

Revoes a symbol from a scope.

since: 3.4

###### camel_sexp_result_free

Frees the `result` and its internal data. Does nothing, when the `result` is `NULL`.

since: 3.4

###### camel_sexp_result_new

No description available.

since: 3.4

###### camel_sexp_resultv_free

Frees an array of results.

since: 3.4

###### camel_sexp_set_scope

Sets the current scope for the scanner.

since: 3.4

###### camel_sexp_term_eval

Evaluates a part of the expression.

since: 3.4

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct CamelSExpClass {
      GObjectClass parent_class;
      gpointer reserved;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.

`reserved: gpointer`

  No description available.