Commit 7302745e 7302745e03e801ea3bffe0b7cbb6092317c06cd1 by Sergey Poznyakoff

Documented new version of sieve (not fully, still...)

1 parent b6943898
1 @c This is part of the GNU Mailutils manual. 1 @c This is part of the GNU Mailutils manual.
2 @c Copyright (C) 1999,2000,2001 Free Software Foundation, Inc. 2 @c Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
3 @c See file mailutils.texi for copying conditions. 3 @c See file mailutils.texi for copying conditions.
4 @comment ******************************************************************* 4 @comment *******************************************************************
5 5
...@@ -196,6 +196,7 @@ or single quotes). ...@@ -196,6 +196,7 @@ or single quotes).
196 @menu 196 @menu
197 * default:: Options understood by most GNU utilities. 197 * default:: Options understood by most GNU utilities.
198 * mailbox:: Specifies the mail spool location, and locking strategy. 198 * mailbox:: Specifies the mail spool location, and locking strategy.
199 * mailer:: Sets the mailer URL.
199 * address:: Specifies the default email address and domain. 200 * address:: Specifies the default email address and domain.
200 * daemon:: Options common for daemon programs. 201 * daemon:: Options common for daemon programs.
201 * auth:: Authentication-specific options. 202 * auth:: Authentication-specific options.
...@@ -238,6 +239,17 @@ Set path to the mailspool directory ...@@ -238,6 +239,17 @@ Set path to the mailspool directory
238 Set the default mailbox lock flags (E=external, R=retry, T=time, P=pid). 239 Set the default mailbox lock flags (E=external, R=retry, T=time, P=pid).
239 @end table 240 @end table
240 241
242 @node mailer
243 @subsection mailer --- Sets the default mailer URL.
244 @cindex :mailer
245
246 This option group overrides the default mailer URL (@url{sendmail:}).
247
248 @table @option
249 @item -m @var{url}
250 @itemx --mailer @var{url}
251 @end table
252
241 @node address 253 @node address
242 @subsection address --- Specifies the default email address and domain. 254 @subsection address --- Specifies the default email address and domain.
243 @cindex :address 255 @cindex :address
...@@ -2179,17 +2191,18 @@ utilities in detail. ...@@ -2179,17 +2191,18 @@ utilities in detail.
2179 @subsection A Sieve Interpreter 2191 @subsection A Sieve Interpreter
2180 2192
2181 Sieve interpreter @command{sieve} allows to apply Sieve scripts to an 2193 Sieve interpreter @command{sieve} allows to apply Sieve scripts to an
2182 arbitrary number of mailboxes. Currently @command{sieve} supports the 2194 arbitrary number of mailboxes. GNU @command{sieve} supports full set
2183 following actions: 2195 of actions and tests described in RFC 3028.
2184 2196
2185 @itemize 2197 @menu
2186 @item stop 2198 * Invoking Sieve::
2187 @item keep 2199 * Logging and Debugging::
2188 @item discard 2200 * Input Language::
2189 @item fileinto 2201 * Extending Sieve::
2190 @end itemize 2202 @end menu
2191 2203
2192 @subheading Invocation 2204 @node Invoking Sieve
2205 @subsubsection Invocation
2193 2206
2194 The @command{sieve} invocation syntax is: 2207 The @command{sieve} invocation syntax is:
2195 2208
...@@ -2212,16 +2225,25 @@ Specify debug flags. The @var{flags} argument is a sequence of one or ...@@ -2212,16 +2225,25 @@ Specify debug flags. The @var{flags} argument is a sequence of one or
2212 more of the following letters: 2225 more of the following letters:
2213 2226
2214 @multitable @columnfractions .40 .45 2227 @multitable @columnfractions .40 .45
2215 @item @samp{a} @tab Enable address parser traces
2216 @item @samp{g} @tab Enable main parser traces 2228 @item @samp{g} @tab Enable main parser traces
2217 @item @samp{T} @tab Enable mailutil traces 2229 @item @samp{T} @tab Enable mailutil traces
2218 @item @samp{P} @tab Trace network protocols 2230 @item @samp{P} @tab Trace network protocols
2219 @item @samp{t} @tab Enable sieve trace 2231 @item @samp{t} @tab Enable sieve trace
2220 @item @samp{h} @tab Debug sieve header filling 2232 @item @samp{i} @tab Trace the program instructions
2221 @item @samp{q} @tab Trace sieve message queries
2222 @end multitable 2233 @end multitable
2223 2234
2224 When omitted, @var{flags} defaults to @samp{TPt}. 2235 @xref{Logging and Debugging}, for detailed discussion of these.
2236
2237 @item -D
2238 @itemx --dump
2239 Compile the script, dump disassembled code on standard output and exit.
2240
2241 @item -e @var{address}
2242 @item --email @var{address}
2243 Override the user email address. This is useful for @code{reject} and
2244 @code{redirect} actions. By default, the user email address is deduced
2245 from the user name and the full name of the machine where sieve is
2246 executed.
2225 2247
2226 @item -f 2248 @item -f
2227 @itemx --mbox-url=@var{mbox} 2249 @itemx --mbox-url=@var{mbox}
...@@ -2231,10 +2253,6 @@ Mailbox to sieve (defaults to user's system mailbox) ...@@ -2231,10 +2253,6 @@ Mailbox to sieve (defaults to user's system mailbox)
2231 @itemx --keep-going 2253 @itemx --keep-going
2232 Keep on going if execution fails on a message 2254 Keep on going if execution fails on a message
2233 2255
2234 @item -M
2235 @itemx --mailer-url=@var{mailer}
2236 Override the mailer URL (defaults to "sendmail:")
2237
2238 @item -n 2256 @item -n
2239 @itemx --no-actions 2257 @itemx --no-actions
2240 Dry run: do not execute any actions, just print what would be done. 2258 Dry run: do not execute any actions, just print what would be done.
...@@ -2242,11 +2260,140 @@ Dry run: do not execute any actions, just print what would be done. ...@@ -2242,11 +2260,140 @@ Dry run: do not execute any actions, just print what would be done.
2242 @item -t @var{ticket} 2260 @item -t @var{ticket}
2243 @itemx --ticket=@var{ticket} 2261 @itemx --ticket=@var{ticket}
2244 Ticket file for mailbox authentication 2262 Ticket file for mailbox authentication
2263
2264 @item -v
2265 @itemx --verbose
2266 Log all actions executed.
2245 @end table 2267 @end table
2246 2268
2247 Apart from these, @command{sieve} understands the options from the 2269 Apart from these, @command{sieve} understands the options from the
2248 @code{mailbox} option group (@pxref{mailbox}). 2270 following groups: @code{mailbox}, @code{mailer}, @code{logging}.
2271
2272 @node Logging and Debugging
2273 @subsubsection Logging and debugging
2274
2275 The default behavior of @command{sieve} is to remain silent about
2276 anything except errors. However, it is sometimes necessary to see
2277 which actions are executed and on which messages. This is particularly
2278 useful when debugging the sieve scripts. The @option{--verbose}
2279 (@option{-v}) option outputs log of every action executed.
2280
2281 Option @option{--debug} allows to produce even more detailed debugging
2282 information. This option takes an argument specifying the
2283 debugging level to be enabled. The argument can consist of the
2284 following letters:
2285
2286 @table @samp
2287 @item @samp{t}
2288 This flag enables sieve tracing. It means that every test will be logged
2289 when executed.
2290
2291 @item @samp{T}
2292 This flag enables debugging of underlying @code{mailutils} library.
2293
2294 @item @samp{P}
2295 Trace network protocols: produces log of network transactions executed
2296 while running the script.
2297
2298 @item @samp{g}
2299 Enable main parser traces. This is useful for debugging the sieve grammar.
2300
2301 @item @samp{i}
2302 Trace the program instructions. It is the most extensive debugging
2303 level. It produces the full execution log of a sieve program, showing
2304 each instruction and states of the sieve machine. It is only useful
2305 for debugging the code generator.
2306 @end table
2307
2308 @emph{Note}, that there should be no whitespace
2309 between the short variant of the option (@option{-d}), and its
2310 argument. Similarly, when using long option (@option{--debug}),
2311 its argument must be preceded by equal sign.
2312
2313 If the argument to @option{--debug} is omitted, it defaults to
2314 @samp{TPt}.
2315
2316 Option @option{--dump} produces the disassembled dump of the compiled
2317 sieve program.
2318
2319 By default @command{sieve} output all diagnostics on standard error and verbose
2320 logs on standard output. This behaviour is changed when
2321 @option{--log-facility} is given in the command line (@pxref{logging}).
2322 This option causes @command{sieve} to output its diagnostics to
2323 the given syslog facility.
2324
2325 @node Input Language
2326 @subsubsection Input Language
2327
2328 @node Extending Sieve
2329 @subsubsection Extending Sieve
2330 The basic set of sieve actions, tests and comparators may be extended
2331 using loadable extensions. Usual @code{require} mechanism is used for
2332 that.
2333
2334 When processing arguments for @code{require} statement, @command{sieve}
2335 uses the following algorithm:
2336
2337 @enumerate 1
2338 @item Look up the name in a symbol table. If the name begins with
2339 @samp{comparator-} it is looked up in the comparator table. If it
2340 begins with @samp{test-}, the test table is used instead. Otherwise
2341 the name is looked up in the action table.
2342
2343 @item If the name is found, the search is terminated.
2344
2345 @item Otherwise, transform the name. First, any @samp{comparator-} or
2346 @samp{test-} prefix is stripped. Then, any character other than
2347 alphanumeric characters, @samp{.} and @samp{,} is replaced with
2348 dash (@samp{-}). The name thus obtained is used as a file name
2349 of an external loadable module.
2350
2351 @item Try to load the module. The module is searched in the
2352 following search paths (in the order given):
2353
2354 @enumerate 1
2355 @item Mailutils module directory. By default it is
2356 @file{$prefix/lib/mailutils}.
2357
2358 @item The value of the environment variable LTDL_LIBRARY_PATH.
2359
2360 @item System library search path: The system dependent library
2361 search path (e.g. on Linux it is set by the contents of the file
2362 @file{/etc/ld.so.conf} and the value of the environment variable
2363 LD_LIBRARY_PATH).
2364
2365 @end enumerate
2366
2367 Each search path must be a colon-separated list of absolute directories,
2368 for example, @samp{"/usr/lib/mypkg:/lib/foo"}.
2369
2370 In any of these directories, @command{sieve} first attempts to find
2371 and load the given filename. If this fails, it tries to append the
2372 following suffixes to the file name:
2373
2374 @enumerate 1
2375 @item the libtool archive extension @samp{.la}
2376
2377 @item the extension used for native dynamic libraries on the host
2378 platform, e.g., @samp{.so}, @samp{.sl}, etc.
2379 @end enumerate
2380
2381 @item If the module is found, @command{sieve} executes its
2382 initialization function (see below) and again looks up the name
2383 in the symbol table. If found, search terminates successfully.
2384
2385 @item If either the module is not found, or the symbol wasn't
2386 found after execution of the module initialization function,
2387 search is terminated with an error status. @command{sieve} then displays
2388 the following diagnostic message:
2389
2390 @example
2391 source for the required action NAME is not available
2392 @end example
2393
2394 @end enumerate
2249 2395
2396
2250 @c *********************************************************************** 2397 @c ***********************************************************************
2251 2398
2252 @page 2399 @page
......