GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: sieve interpreter   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index

3.10.1.4 Extending sieve

The basic set of sieve actions, tests and comparators may be extended using loadable extensions. The usual require mechanism is used for that.

When processing arguments for require statement, sieve uses the following algorithm:

  1. Look up the name in a symbol table. If the name begins with ‘comparator-’ it is looked up in the comparator table. If it begins with ‘test-’, the test table is searched instead. Otherwise the name is looked up in the action table.
  2. If the name is found, the search is terminated.
  3. Otherwise, transform the name. First, any ‘comparator-’ or ‘test-’ prefix is stripped. Then, any character other than alphanumeric characters, ‘.’ and ‘,’ is replaced with dash (‘-’). The name thus obtained is used as a file name of an external loadable module.
  4. Try to load the module. The module is searched in the following search paths (in the order given):
    1. Mailutils module directory. By default it is $prefix/lib/mailutils.
    2. The value of the environment variable LTDL_LIBRARY_PATH.
    3. Additional search directories specified with the. --libdir-prefix command line option (see libdir-prefix), or the library-path-prefix configuration statement (see library-path-prefix).
    4. Additional search directories specified with the library-path statement (see library-path) in Sieve configuration file.
    5. Additional search directories specified with the. --libdir command line option (see libdir).
    6. Additional search directories specified with the #searchpath Sieve directive (see #searchpath).
    7. System library search path: The system dependent library search path (e.g. on Linux it is set by the contents of the file /etc/ld.so.conf and the value of the environment variable LD_LIBRARY_PATH).

    The value of LTDL_LIBRARY_PATH and LD_LIBRARY_PATH must be a colon-separated list of absolute directories, for example, ‘"/usr/lib/mypkg:/lib/foo"’.

    In any of these directories, sieve first attempts to find and load the given filename. If this fails, it tries to append the following suffixes to the file name:

    1. the libtool archive extension ‘.la
    2. the extension used for native dynamic libraries on the host platform, e.g., ‘.so’, ‘.sl’, etc.
  5. If the module is found, sieve executes its initialization function (see below) and again looks up the name in the symbol table. If found, search terminates successfully.
  6. If either the module is not found, or the symbol wasn’t found after execution of the module initialization function, search is terminated with an error status. sieve then displays the following diagnostic message:
    source for the required action NAME is not available
    

GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: sieve interpreter   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index