Commit 75e3a3eb 75e3a3ebde7a363bf65e6c51a179508a3a1b3e62 by Sergey Poznyakoff

Updated

1 parent f1cbdaab
1 2002-12-14 Sergey Poznyakoff
2
3 * mail/previous.c: Skip deleted messages
4 * mail/next: Likewise.
5
6 * auth/sql.c (mu_auth_sql_by_uid): Fixed typo.
7
8 * include/mailutils/libsieve.h: Changed type of `number'
9 to size_t.
10 * libsieve/sieve.y (union): Likewise
11 * include/mailutils/mu_auth.h: Removed duplicate declaration
12 of mu_auth_data_free.
13 * libsieve/actions.c (build_mime): To improve readability,
14 output additional newline before reporting the reason.
15 * libsieve/sieve.l: Allow backslashes in quoted strings.
16 * sieve/testsuite/Reject: Updated
17
18 * doc/texinfo/libmu_scm.texi: New file. Documents libmu_scm
19 library.
20 * doc/texinfo/Makefile.am: Added libmu_scm.texi
21 * doc/texinfo/libmuauth.texi: Updated
22 * doc/texinfo/libsieve.texi: Updated
23 * doc/texinfo/mailutils.texi: Updated
24 * doc/texinfo/programs.texi: Updated
25 * doc/texinfo/imap4.texi: Updated
26 * doc/texinfo/mailer.texi: Updated
27
28 * TODO: Updated
29 * mh/TODO: New file
30 * NEWS: Updated
31
1 2002-12-13 Sergey Poznyakoff 32 2002-12-13 Sergey Poznyakoff
2 33
3 * mail.local/mail.local.h: Create temporary mailbox instead of 34 * mail.local/mail.local.h: Create temporary mailbox instead of
......
...@@ -10,6 +10,10 @@ Version 0.2: ...@@ -10,6 +10,10 @@ Version 0.2:
10 to disable support for any protocol or mailbox format to reduce 10 to disable support for any protocol or mailbox format to reduce
11 the size of the library. 11 the size of the library.
12 12
13 * Added new utility mailutils-config. This utility prints gcc command
14 line options needed for compiling and linknig an application against
15 mailutils.
16
13 * libsieve: New library. Supports Sieve language as described in 17 * libsieve: New library. Supports Sieve language as described in
14 RFC 3028 and provides a mechanism for dynamic loading of 18 RFC 3028 and provides a mechanism for dynamic loading of
15 user-defined actions, tests and comparators. 19 user-defined actions, tests and comparators.
......
...@@ -115,14 +115,34 @@ IMPORTANT: ...@@ -115,14 +115,34 @@ IMPORTANT:
115 115
116 + support AUTH=anonymous (imap://cyrus.andrew.cmu.edu/archive.info-cyrus) 116 + support AUTH=anonymous (imap://cyrus.andrew.cmu.edu/archive.info-cyrus)
117 117
118 [libmuauth]
119
120 - First argument to mu_auth_fp (and second one to mu_auth_runlist) should
121 be struct mu_auth_data ** instead of void *.
122
118 [examples] 123 [examples]
119 124
120 - unify the mbox-* and mimetest examples with messages, it would be nice 125 - unify the mbox-* and mimetest examples with messages, it would be nice
121 to have a general purpose tool 126 to have a general purpose tool
122 127
128 [mh]
129
130 - see mh/TODO
131
123 [sieve] 132 [sieve]
124 133
125 + need to deal with the envelope addressing issues 134 - Implement boolean shortcut evaluation for `allof' and `anyof'
135
136 - Extend the `text:' token. The planned syntax is:
137
138 text:[-][delimiter]
139
140 The meaning of optional flags is the same as in shell "here document"
141 construct: '-' strips all leading tab characters from the string body,
142 thus allowing it to be indented in a natural fashion; 'delimiter'
143 introduces the new end-of-text delimiter instead of the default
144 dot. If 'delimiter' starts with a backslash, no preprocessing will
145 be performed within a string.
126 146
127 - uid isn't good to identify messages, use message-id? 147 - uid isn't good to identify messages, use message-id?
128 148
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
10 10
11 Internet Message Access Protocol - Version (4rev1). In IMAP4, the client 11 Internet Message Access Protocol - Version (4rev1). In IMAP4, the client
12 must be prepared to accept any responses at all times. The server responses 12 must be prepared to accept any responses at all times. The server responses
13 have three forms: status reponses, server data and command continuation 13 have three forms: status responses, server data and command continuation
14 request. Untaged responses, for hitorical reasons are also call 14 request. Untagged responses, for historical reasons are also call
15 "unsolicited responses". 15 "unsolicited responses".
16 16
17 @subsection Commands 17 @subsection Commands
......
...@@ -2,3 +2,334 @@ ...@@ -2,3 +2,334 @@
2 @c Copyright (C) 1999,2000,2001,2002 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
6 The functions from @file{libmailbox} library get user information from
7 the system user database. The library @file{libmuauth} extends this
8 functionality, allowing @file{libmailbox} functions to obtain
9 information about a user from several places, like @sc{sql} database,
10 etc. The method used is described in detail in @ref{authentication}.
11 This chapter contains a very succinct description of the underlying
12 library mechanism.
13
14 @menu
15 * Data Types::
16 * Initializing the lubmuauth::
17 * Module Creation and Destruction::
18 * Obtaining Authorization Information::
19 * Existing Modules::
20 * Using Libmuauth in Your Programs::
21 @end menu
22
23 @node Data Types
24 @section Data Types
25 @cindex libmuauth, data types
26
27 @deftp {Data Type} mu_auth_fp
28
29 This is a pointer to authentication or authorization data. It
30 is defined as follows:
31
32 @example
33 typedef int (*mu_auth_fp) (void *@var{return_data},
34 void *@var{key},
35 void *@var{func_data},
36 void *@var{call_data});
37 @end example
38 @noindent
39 Its arguments are:
40
41 @table @var
42 @item return_data
43 @footnote{Actually it shoud have been @code{struct mu_auth_data** return_data}.
44 This will be fixed in the next release}.
45 Upon successful return authorization handler leaves in this memory
46 location a pointer to the filled @code{mu_auth_data} structure
47 with the user's information.
48
49 For authentication handlers this argument is always @code{NULL} and
50 should be ignored.
51
52 @item key
53 The search key value. Its actual type depends upon type of the handler.
54
55 For authorization handlers it is @code{const char*} if the handler is called by
56 @code{mu_get_auth_by_name()} and @code{uid_t *} if it is called by
57 @code{mu_get_auth_by_uid()}.
58
59 For authentication handlers it is always @code{struct mu_auth_data*}
60 representing the user's data obtained by a previous call to
61 @code{mu_get_auth_by_@dots{}} call.
62
63 @item func_data
64 Any data associated with this handler.
65
66 @item call_data
67 Any call specific data. This argument is not used at the moment.
68 @end table
69 @end deftp
70
71 @deftp {Data Type} mu_auth_data
72
73 The @code{mu_auth_data} is used to return the information about the
74 user. It is similar to system @code{struct passwd}, except that it
75 is more mailutils-specific. Its definition is:
76
77 @example
78 @group
79 struct mu_auth_data @{
80 /* These are from struct passwd */
81 char *name; /* user name */
82 char *passwd; /* user password */
83 uid_t uid; /* user id */
84 gid_t gid; /* group id */
85 char *gecos; /* real name */
86 char *dir; /* home directory */
87 char *shell; /* shell program */
88 /* */
89 char *mailbox; /* Path to the user's system mailbox */
90 int change_uid; /* Should the uid be changed? */
91 @};
92 @end group
93 @end example
94 @end deftp
95
96 @deftp {Data Type} mu_auth_module
97
98 The @code{mu_auth_module} structure contains full information about a
99 libmuauth module. It is declared as follows:
100
101 @example
102 @group
103 struct mu_auth_module @{
104 char *name; /* Module name */
105 struct argp *argp; /* Corresponding argp structure */
106 mu_auth_fp authenticate; /* Authentication function ... */
107 void *authenticate_data; /* ... and its specific data */
108 mu_auth_fp auth_by_name; /* Get user info by user name */
109 void *auth_by_name_data; /* ... and its specific data */
110 mu_auth_fp auth_by_uid; /* Get user info by user id */
111 void *auth_by_uid_data; /* ... and its specific data */
112 @};
113 @end group
114 @end example
115 @end deftp
116
117 @node Initializing the lubmuauth
118 @section Initializing the lubmuauth
119
120 @deftypefn void mu_auth_init (void)
121
122 This function registers the command line capability ``auth''. It must be
123 called after registering @file{libmuauth} modules and before calling
124 @code{mu_agrp_parse()}. If an error occurs, this function prints
125 diagnostic message and aborts the program.
126 @end deftypefn
127
128 @deftypefn void MU_AUTH_REGISTER_ALL_MODULES (void)
129
130 This macro registers all default modules and calls @code{mu_auth_init()}.
131 @end deftypefn
132
133 @node Module Creation and Destruction
134 @section Module Creation and Destruction
135
136 @deftypefn int mu_auth_data_alloc (struct mu_auth_data **ptr, const char *name, const char *passwd, uid_t uid, gid_t gid, const char *gecos, const char *dir, const char *shell, const char *mailbox, int change_uid)
137
138 Create a @code{mu_auth_data} structure and initialize it with the given
139 values. Returns 0 on success and 1 otherwise.
140 @end deftypefn
141
142 @deftypefn void mu_auth_data_free (struct mu_auth_data *@var{ptr})
143
144 Free the @code{mu_auth_data} structure allocated by a call to
145 @code{mu_auth_data_alloc()}.
146 @end deftypefn
147
148 @deftypefn void mu_auth_register_module (struct mu_auth_module *@var{mod})
149
150 Register the module defined by the @var{mod} argument.
151 @end deftypefn
152
153 @node Obtaining Authorization Information
154 @section Obtaining Authorization Information
155 @cindex libmuauth, obtaining authorization information
156
157 @deftypefn int mu_auth_runlist (list_t @var{flist}, void *@var{return_data}, void *@var{key}, void *@var{call_data});
158
159 The list is expected to contain @code{mu_auth_fp} pointers. Each of them
160 is dereferenced and executed until either the list is exhausted or any
161 of the functions returns non-zero, whichever occurs first. The
162 @var{return_data} and @var{key} arguments are passed as the first two
163 parameters to the function (see the definition of @code{mu_auth_fp},
164 notice the footnote), the @code{call_data} is passed as its last
165 parameter.
166
167 The function returns 0 if none of the functions from @code{list}
168 succeeded, i.e. returned non-zero value. Otherwise it returns the
169 return code from the succeeded function.
170 @end deftypefn
171
172 @deftypefn {struct mu_auth_data *} mu_get_auth_by_name (const char *@var{username})
173
174 Search the information about given user by its username. Similar to
175 system's @code{getpwnam} call).
176
177 @end deftypefn
178
179 @deftypefn {struct mu_auth_data *} mu_get_auth_by_uid (uid_t @var{uid})
180 Search the information about given user by its uid. Similar to
181 system's @code{getpwuid} call).
182 @end deftypefn
183
184 @deftypefn int mu_authenticate (struct mu_auth_data *@var{auth_data}, char *@var{pass})
185
186 Authenticate the user whose data are in @var{auth_data} using password
187 @var{pass}. Return 0 if the user is authenticated.
188 @end deftypefn
189
190 @node Existing Modules
191 @section Existing Modules
192 @cindex libmuauth modules
193
194 @deftypefn int mu_auth_nosupport (void *return_data, void *key, void *func_data, void *call_data);
195
196 The ``not-supported'' module. Always returns @code{ENOSYS}.
197 @end deftypefn
198
199 @defvar mu_auth_system_module
200
201 This module is always registered even if @file{libmuauth} is not linked.
202 It performs usual authentication using system user database
203 (@file{/etc/password} et al.)
204 @end defvar
205
206 @defvar mu_auth_generic_module
207
208 This module is always registered even if @file{libmuauth} is not linked.
209 Both its authorization handlers are @code{mu_auth_nosupport}. Its
210 authentication handler computes the MD5 or DES hash over the supplied
211 password with the seed taken from @code{passwd} member of its @var{key}
212 argument. Then it compares the obtained hash with the @code{passwd}
213 member itself and returns 1 if both strings match.
214 @end defvar
215
216 @defvar mu_auth_pam_module
217
218 Implements PAM authentication. Both authorization handlers are
219 @code{mu_auth_nosupport()}.
220 @end defvar
221
222 @defvar mu_auth_sql_module
223
224 Implements authentication and authorization via MySQL database. The
225 credentials for accessing the database are taken from global variables
226 @code{sql_host}, @code{sql_port}, @code{sql_user}, @code{sql_passwd}
227 and @code{sql_db}. The SQL queries for retrieving user information
228 from global variables @code{sql_getpwnam_query} and
229 @code{sql_getpwuid_query}. The variable @code{sql_getpass_query} keeps
230 the query used for retrieving user's password. @xref{auth}, for
231 information on command line options used to set these variables.
232 @end defvar
233
234 @defvar mu_auth_virtual_module
235
236 Implements @code{mu_get_auth_by_name} method using virtual mail domains.
237 Neither @code{mu_get_auth_by_uid} nor @code{mu_authenticate} is
238 implemented. This module must be used together with @code{generic}
239 module.
240 @end defvar
241
242
243 @node Using Libmuauth in Your Programs
244 @section Using Libmuauth in Your Programs
245 @cindex using libmuauth
246 @cindex linking with libmuauth
247 @cindex libmuauth, linking with
248
249 To link your program against @file{libmuauth}, obtain loader arguments
250 by running @command{mailutils-config} as follows:
251
252 @example
253 mailutils-config --link auth
254 @end example
255 @noindent
256
257 @xref{mailutils-config}, for more information about this utility.
258
259 Here is a sample Makefile fragment:
260
261 @example
262 MU_LDFLAGS=`mailutils-config --link auth`
263 MU_INCLUDES=`mailutils-config --include`
264
265 myprog: myprog.c
266 $(CC) -omyprog $(CFLAGS) $(MU_INCLUDES) myprog.c $(MU_LDFLAGS)
267 @end example
268
269 If your program will be using only default modules provided by the
270 library, then it will suffice to call
271 @code{MU_AUTH_REGISTER_ALL_MODULES()} somewhere near the start of
272 your program. As an example, consider the following code fragment
273 (it is taken from the @command{imap4d} daemon):
274
275 @example
276 @group
277 int
278 main (int argc, char **argv)
279 @{
280 struct group *gr;
281 int status = EXIT_SUCCESS;
282
283 state = STATE_NONAUTH; /* Starting state in non-auth. */
284
285 MU_AUTH_REGISTER_ALL_MODULES ();
286 mu_argp_parse (&argp, &argc, &argv, 0, imap4d_capa,
287 NULL, &daemon_param);
288 @dots{}
289 @end group
290 @end example
291
292 Otherwise, if you program will use it's own modules, first register
293 them with @code{mu_auth_register_module} and then call
294 @code{mu_auth_init()}, e.g.:
295
296 @example
297 @group
298 struct mu_auth_module radius_module = @{
299 @dots{}
300 @};
301
302 struct mu_auth_module ext_module = @{
303 @dots{}
304 @};
305
306 int
307 main (int argc, char **argv)
308 @{
309 mu_auth_register_module (&radius_module);
310 mu_auth_register_module (&ext_module);
311 mu_auth_init ();
312
313 @dots{}
314 @end group
315 @end example
316
317 These two approaches may be combined, allowing you to use both your
318 modules and the ones provided by Mailutils. Consider the example below:
319
320 @example
321 @group
322 int
323 main (int argc, char **argv)
324 @{
325 mu_auth_register_module (&radius_module);
326 mu_auth_register_module (&ext_module);
327 MU_AUTH_REGISTER_ALL_MODULES ();
328
329 @dots{}
330 @}
331 @end group
332 @end example
333
334
335
......
...@@ -15,6 +15,44 @@ This chapter describes @sc{gnu} Sieve library. ...@@ -15,6 +15,44 @@ This chapter describes @sc{gnu} Sieve library.
15 @node Library Description 15 @node Library Description
16 @section Library Description 16 @section Library Description
17 17
18 @code{Libsieve} is @sc{gnu} implementation of the mail filtering
19 language Sieve.
20
21 The library is built around a @dfn{Sieve Machine} --- an abstract
22 computer constructed specially to handle mail filtering tasks. This
23 computer has two registers: program counter and numeric accumulator;
24 a runtime stack of unlimited depth and the code segment. A set of
25 functions is provided for creating and destroying instances of Sieve
26 Machine, manipulating its internal data, compiling and executing a
27 sieve program.
28
29 The following is a typical scenario of using @code{libsieve}:
30
31 @enumerate
32 @item Application program creates the instance of sieve machine.
33
34 @item Then @code{sieve_compile} function is called to translate
35 the Sieve source into an equivalent program executable by the
36 Machine
37
38 @item A mailbox is opened and associated with the Machine
39
40 @item The Machine executes the program over the mailbox
41
42 @item When the execution of the program is finished, all messages upon which
43 an action was executed other than @code{keep} are marked with the delete
44 flag. Thus, running @code{mailbox_expunge} upon the mailbox finishes
45 the job, leaving in the mailbox only those messages that were preserved
46 by the filter.
47
48 @item Finally, the instance of Sieve Machine is destroyed and the
49 resources allocated for it are reclaimed.
50
51 @end enumerate
52
53 The following sections describe in detail the functions from the
54 Sieve Library.
55
18 @menu 56 @menu
19 * Sieve Data Types:: 57 * Sieve Data Types::
20 * Manipulating the Sieve Machine:: 58 * Manipulating the Sieve Machine::
...@@ -188,7 +226,7 @@ Other arguments. ...@@ -188,7 +226,7 @@ Other arguments.
188 @end table 226 @end table
189 227
190 @deftp {Function Type} sieve_parse_error_t 228 @deftp {Function Type} sieve_parse_error_t
191 This data type is decalred as follows: 229 This data type is declared as follows:
192 @example 230 @example
193 typedef int (*sieve_parse_error_t) (void *@var{data}, 231 typedef int (*sieve_parse_error_t) (void *@var{data},
194 const char *@var{filename}, int @var{lineno}, 232 const char *@var{filename}, int @var{lineno},
...@@ -233,7 +271,7 @@ The name of the action. ...@@ -233,7 +271,7 @@ The name of the action.
233 271
234 @item fmt 272 @item fmt
235 @itemx var 273 @itemx var
236 These two arguments give the detaied description of the action. 274 These two arguments give the detailed description of the action.
237 @end table 275 @end table
238 276
239 @deftp {Function Type} sieve_comparator_t 277 @deftp {Function Type} sieve_comparator_t
...@@ -322,14 +360,15 @@ order. ...@@ -322,14 +360,15 @@ order.
322 @deftypefn int sieve_machine_add_destructor (sieve_machine_t @var{mach}, sieve_destructor_t @var{destr}, void *@var{ptr}); 360 @deftypefn int sieve_machine_add_destructor (sieve_machine_t @var{mach}, sieve_destructor_t @var{destr}, void *@var{ptr});
323 361
324 This function registers a destructor function @var{dest}. The purpose 362 This function registers a destructor function @var{dest}. The purpose
325 of the destructor is to free any resourses assotiated with the item 363 of the destructor is to free any resources associated with the item
326 @var{ptr}. The desctructor function takes a single argument --- a 364 @var{ptr}. The destructor function takes a single argument --- a
327 pointer to the data being destroyed. All registered destructors are 365 pointer to the data being destroyed. All registered destructors are
328 called in reverse order upon execution of 366 called in reverse order upon execution of
329 @code{sieve_machine_destroy()}. Here's a short example of the use 367 @code{sieve_machine_destroy()}. Here's a short example of the use
330 of this function: 368 of this function:
331 369
332 @example 370 @example
371 @group
333 static void 372 static void
334 free_regex (void *data) 373 free_regex (void *data)
335 @{ 374 @{
...@@ -349,6 +388,7 @@ match_part_checker (const char *name, list_t tags, list_t args) ...@@ -349,6 +388,7 @@ match_part_checker (const char *name, list_t tags, list_t args)
349 . 388 .
350 . 389 .
351 @} 390 @}
391 @end group
352 @end example 392 @end example
353 @end deftypefn 393 @end deftypefn
354 394
...@@ -407,8 +447,10 @@ not set, the default parse error printer will be used. It is defined as ...@@ -407,8 +447,10 @@ not set, the default parse error printer will be used. It is defined as
407 follows: 447 follows:
408 448
409 @example 449 @example
450 @group
410 int 451 int
411 _sieve_default_parse_error (void *unused, const char *filename, int lineno, 452 _sieve_default_parse_error (void *unused,
453 const char *filename, int lineno,
412 const char *fmt, va_list ap) 454 const char *fmt, va_list ap)
413 @{ 455 @{
414 if (filename) 456 if (filename)
...@@ -417,6 +459,7 @@ _sieve_default_parse_error (void *unused, const char *filename, int lineno, ...@@ -417,6 +459,7 @@ _sieve_default_parse_error (void *unused, const char *filename, int lineno,
417 fprintf (stderr, "\n"); 459 fprintf (stderr, "\n");
418 return 0; 460 return 0;
419 @} 461 @}
462 @end group
420 @end example 463 @end example
421 @end deftypefn 464 @end deftypefn
422 465
...@@ -567,7 +610,7 @@ If @var{ptr} is @code{NULL}, no operation is performed. ...@@ -567,7 +610,7 @@ If @var{ptr} is @code{NULL}, no operation is performed.
567 @subsection Compiling and Executing the Script 610 @subsection Compiling and Executing the Script
568 611
569 @deftypefn int sieve_compile (sieve_machine_t @var{mach}, const char *@var{name}) 612 @deftypefn int sieve_compile (sieve_machine_t @var{mach}, const char *@var{name})
570 Compile the seive script from the file @var{name}. 613 Compile the sieve script from the file @var{name}.
571 @end deftypefn 614 @end deftypefn
572 615
573 @deftypefn int sieve_mailbox (sieve_machine_t @var{mach}, mailbox_t @var{mbox}) 616 @deftypefn int sieve_mailbox (sieve_machine_t @var{mach}, mailbox_t @var{mbox})
...@@ -591,6 +634,7 @@ The input language understood by the @sc{gnu} Sieve Library is a superset of ...@@ -591,6 +634,7 @@ The input language understood by the @sc{gnu} Sieve Library is a superset of
591 the Sieve language as described in RFC 3028. 634 the Sieve language as described in RFC 3028.
592 635
593 @menu 636 @menu
637 * Lexical Structure::
594 * Syntax:: 638 * Syntax::
595 * Preprocessor:: 639 * Preprocessor::
596 * Require Statement:: 640 * Require Statement::
...@@ -599,9 +643,307 @@ the Sieve language as described in RFC 3028. ...@@ -599,9 +643,307 @@ the Sieve language as described in RFC 3028.
599 * Actions:: 643 * Actions::
600 @end menu 644 @end menu
601 645
646 @node Lexical Structure
647 @subsection Lexical Structure
648
649 @subheading Whitespace and Comments
650
651 Comments are semantically equivalent to whitespace and can be used
652 anyplace that whitespace is (with one exception in multi-line strings,
653 as described below).
654
655 There are two kinds of comments: hash comments, that begin with a
656 @samp{#} character that is not contained within a string and continue
657 until the next newline, and C-style or bracketed comments, that are
658 delimited by @samp{/*} and @samp{*/} tokens. The bracketed comments
659 may span multiple lines. E.g.:
660
661 @example
662 if size :over 100K
663 @{ # this is a comment
664 discard;
665 @}
666
667 if size :over 100K
668 @{ /* this is a comment
669 this is still a comment */ discard /* this is a comment again
670 */ ;
671 @}
672 @end example
673
674 Like in C, bracketed comments do not nest.
675
676 @subheading Lexical Tokens
677
678 The basic lexical entities are @dfn{identifiers} and @dfn{literals}.
679
680 An @dfn{identifier} is a sequence of letters, digits and underscores, started
681 with a letter or underscore. For example, @code{header} and
682 @code{check_822_again} are valid identifiers, whereas @code{1st} is not.
683 A special form of identifier is @dfn{tag}: it is an identifier prefixed
684 with a colon (@samp{:}), e.g.: @code{:comparator}.
685
686 A @dfn{literal} is a data that is not executed, merely evaluated ``as
687 is'', to be used as arguments to commands. There are four kinds of
688 literals:
689
690 @itemize
691 @item Number
692
693 @dfn{Numbers} are given as ordinary unsigned decimal numbers. An
694 optional suffix may be used to indicate a multiple of a power of two.
695 The suffixes are: @samp{K} specifying ``kibi-'', or 1,024 (2^10) times
696 the value of the number; @samp{M} specifying ``mebi-'', or 1,048,576
697 (2^20) times the value of the number; and @samp{G} specifying ``tebi-'',
698 or 1,073,741,824 (2^30) times the value of the number.
699
700 The numbers have 32 bits of magnitude.
701
702 @item String
703
704 A @dfn{string} is any sequence of characters enclosed in double quotes
705 (@samp{"}). A string cannot contain newlines and double quote
706 characters. This limitation will disappear in future releases.
707
708 @item Multiline Strings
709
710 A @dfn{multiline string} is used to represent large blocks of text
711 with embedded newlines and special characters. It starts with the
712 keyword @code{text:} followed by a newline and ends with a dot
713 (@samp{.}) on a newline by itself. Any characters between these two
714 markers are taken verbatim. For example:
715
716 @example
717 text:
718 **This is an authomatic response from my message filtering program.**
719
720 I can not attend your message right now. However it
721 will be saved, and I will read it as soon as I am back.
722
723 Regards,
724 Fred
725 .
726 @end example
727
728 Notice that a hashed comment or whitespace may occur between
729 @code{text:} and the newline. However, when used inside the multiline
730 string a hash sign looses its special meaning (except in one case, see
731 below) and is taken as is, as well as bracketed comment delimiters.
732 In other words, no comments are allowed within a multiline string. E.g.:
733
734 @example
735 text: # This is a comment
736
737 Sample text
738 # This line is taken verbatim
739 /* And this line too */
740 .
741 @end example
742
743 The only exception to this rule is that preprocessor @code{include}
744 statement is expanded as usual when found within a multiline string
745 (@pxref{#include}), e.g.:
746
747 @example
748 text:
749 #include <myresponse.txt>
750 .
751 @end example
752
753 This results in the contents of file @file{myresponse.txt} being read
754 and interpreted as the contents of the multiline string.
755
756 @item String Lists
757
758 A @dfn{string list} is a comma-delimited list of quoted strings, enclosed
759 in a pair of square brackets, e.g.:
760
761 @example
762 ["me@@example.com", "me00@@landru.example.edu"]
763 @end example
764
765 For convenience, in any context where a list of strings is appropriate,
766 a single string is allowed without being a member of a list: it is
767 equivalent to a list with a single member. For example, the following
768 two statements are equivalent:
769
770 @example
771 exists "To";
772 exists ["To"];
773 @end example
774
775 @end itemize
776
602 @node Syntax 777 @node Syntax
603 @subsection Syntax 778 @subsection Syntax
604 779
780 Being designed for the sole purpose of filtering mail, Sieve has a very
781 simple syntax.
782
783 @menu
784 * Commands::
785 * Actions Described::
786 * Control Flow::
787 * Tests and Conditions::
788 @end menu
789
790 @node Commands
791 @subsubsection Commands
792
793 The basic syntax element is a @dfn{command}. It is defined as follows:
794
795 @example
796 @var{command-name} [@var{tags}] @var{args}
797 @end example
798 @noindent
799 where @var{command-name} is an identifier representing the name of the
800 command, @var{tags} is an optional list of @dfn{optional} or
801 @dfn{tagged arguments} and @var{args} is a list of @dfn{required} or
802 @dfn{positional arguments}.
803
804 Positional arguments are literals delimited with whitespace. They
805 provide the command with the information necessary to its proper
806 functioning. Each command has a fixed number of positional arguments. It
807 is an error to supply more arguments to the command or to give it fewer
808 arguments than it accepts.
809
810 Optional arguments allow to modify the behaviour of the command, like
811 command line options in UNIX do. They are a list of @dfn{tags}
812 (@pxref{Lexical Structure}) separated by whitespace. An optional
813 argument may have at most one parameter.
814
815 Each command understands a set of optional arguments. Supplying it tags
816 that it does not understand results in an error.
817
818 For example, consider the following command
819
820 @example
821 header :mime :comparator "i;octet" ["to", "from"] "bug-mailutils@@gnu.org"
822 @end example
823 @noindent
824 Here, given that @code{header} takes two positional arguments:
825 @code{header} is command name, the list @code{["to", "from"]} is first
826 positional argument and the string @code{"bug-mailutils@@gnu.org"} is second
827 positional argument. There are two optional arguments: @code{:mime} and
828 @code{:comparator}. The latter has a string @code{"i;octet"} as its
829 parameter.
830
831 @node Actions Described
832 @subsubsection Actions Described
833
834 An @dfn{action} is a Sieve command that performs some operation over
835 the message. Actions do the main job in any Sieve
836 program. Syntactically, an action is a command terminated with
837 semicolon, e.g.:
838
839 @example
840 keep;
841
842 fileinto "mbox";
843 @end example
844
845 @sc{gnu} Sieve provides the full set of actions described in RFC 3028.
846 It also allows to extend this set using loadable
847 actions. @xref{Actions}, for detailed discussion of actions.
848
849 @node Control Flow
850 @subsubsection Control Flow
851
852 The only control flow statement Sieve has is ``if'' statement. In its
853 simplest form it is:
854
855 @example
856 if @code{condition} @{ @dots{} @}
857 @end example
858
859 The effect of this statement is that the sequence of actions between the
860 curly braces is executed only if the @code{condition} evaluates to
861 @code{true}.
862
863 The more elaborate form of this statement allows to execute two
864 different sets of actions depending on whether the condition is
865 true or not:
866
867 @example
868 if @code{condition} @{ @dots{} @} else @{ @dots{} @}
869 @end example
870
871 The most advanced form of the ``if'' statement allows to select an
872 action depending on what condition from the set of conditions is met.
873
874 @example
875 if @code{cond1} @{ @dots{} @} elsif @code{cond2} @{ @dots{} @} else @{ @dots{} @}
876 @end example
877
878 There may be any number of ``elsif'' branches in an ``if''
879 statement. However it may have at most one ``else'' branch.
880 Notes for C programmers:
881
882 @enumerate
883 @item The braces surrounding each branch of an ``if'' statement are
884 required.
885 @item The ``else if'' construct is disallowed. Use ``elsif'' keyword
886 instead.
887 @end enumerate
888
889 Here's an example of ``if'' statement:
890
891 @example
892 if header :contains "from" "coyote"
893 @{
894 discard;
895 @}
896 elsif header :contains ["subject"] ["$$$"]
897 @{
898 discard;
899 @}
900 else
901 @{
902 fileinto "INBOX";
903 @}
904 @end example
905
906 The following section describes in detail conditions used in ``if''
907 statements.
908
909 @node Tests and Conditions
910 @subsubsection Tests and Conditions
911
912 @dfn{Tests} are Sieve commands that return boolean value. E.g. the
913 test
914
915 @example
916 header :contains "from" "coyote"
917 @end example
918 @noindent
919 returns true only if the header ``From'' of the current message contains
920 substring ``coyote''.
921
922 The tests shipped with the @sc{gnu} Sieve are described in @ref{Tests}.
923
924 @dfn{Condition} is a Sieve expression that evaluates to @code{true} or
925 @code{false}. In its simplest form, condition is just a Sieve test.
926
927 To reverse the sense of a condition use keyword @code{not}, e.g.:
928
929 @example
930 not header :contains "from" "coyote"
931 @end example
932
933 The results of several conditions may be joined together by logical
934 @code{and} and @code{or} operations. The special form @code{allof}
935 takes several tests as its arguments and computes the logical @code{and}
936 of their results. Similarly, the form @code{anyof} performs logical
937 @code{or} over the results of its arguments. E.g.:
938
939 @example
940 if anyof (not exists ["From", "Date"],
941 header :contains "from" "fool@@example.edu")
942 @{
943 discard;
944 @}
945 @end example
946
605 @node Preprocessor 947 @node Preprocessor
606 @subsection Preprocessor 948 @subsection Preprocessor
607 @cindex Sieve preprocessor statements, a @sc{gnu} extension 949 @cindex Sieve preprocessor statements, a @sc{gnu} extension
...@@ -609,7 +951,7 @@ the Sieve language as described in RFC 3028. ...@@ -609,7 +951,7 @@ the Sieve language as described in RFC 3028.
609 The preprocessor statements are a @sc{gnu} extension to the Sieve language. 951 The preprocessor statements are a @sc{gnu} extension to the Sieve language.
610 The syntax for a preprocessor statement is similar to that used in 952 The syntax for a preprocessor statement is similar to that used in
611 @code{C} programming language, i.e.: a pound character (@samp{#}) 953 @code{C} programming language, i.e.: a pound character (@samp{#})
612 followed by a preprocessor directive and any arguments. Any amount of 954 followed by a preprocessor directive and its arguments. Any amount of
613 whitespace can be inserted between the @samp{#} and the directive. 955 whitespace can be inserted between the @samp{#} and the directive.
614 Currently implemented directives are @code{include} and @code{searchpath}. 956 Currently implemented directives are @code{include} and @code{searchpath}.
615 957
...@@ -677,6 +1019,7 @@ sieve allows the @code{require} and any other statements to be ...@@ -677,6 +1019,7 @@ sieve allows the @code{require} and any other statements to be
677 interspersed. 1019 interspersed.
678 1020
679 By default the following actions and comparators are always required: 1021 By default the following actions and comparators are always required:
1022
680 @itemize 1023 @itemize
681 @item stop 1024 @item stop
682 @item keep 1025 @item keep
...@@ -826,7 +1169,6 @@ A @var{comparator} syntax item is defined as follows: ...@@ -826,7 +1169,6 @@ A @var{comparator} syntax item is defined as follows:
826 :comparator "@var{comparator-name}" 1169 :comparator "@var{comparator-name}"
827 @end example 1170 @end example
828 @noindent 1171 @noindent
829 @sp 1
830 It instructs sieve to use the given comparator with the test. 1172 It instructs sieve to use the given comparator with the test.
831 If @var{comparator-name} is not one of @samp{i;octet}, 1173 If @var{comparator-name} is not one of @samp{i;octet},
832 @samp{i;ascii-casemap} it must be required prior to using it. 1174 @samp{i;ascii-casemap} it must be required prior to using it.
...@@ -866,7 +1208,6 @@ an appropriate error message. For example, the statement: ...@@ -866,7 +1208,6 @@ an appropriate error message. For example, the statement:
866 @example 1208 @example
867 if header :matches :comparator "i;ascii-numeric" 1209 if header :matches :comparator "i;ascii-numeric"
868 @end example 1210 @end example
869 @sp 1
870 @noindent 1211 @noindent
871 would result in the following error message: 1212 would result in the following error message:
872 1213
...@@ -876,15 +1217,18 @@ in call to `header' ...@@ -876,15 +1217,18 @@ in call to `header'
876 @end example 1217 @end example
877 1218
878 @deffn Test false 1219 @deffn Test false
1220
879 This test always evaluates to ``false''. 1221 This test always evaluates to ``false''.
880 @end deffn 1222 @end deffn
881 1223
882 @deffn Test true 1224 @deffn Test true
1225
883 This test always evaluates to ``true''. 1226 This test always evaluates to ``true''.
884 @end deffn 1227 @end deffn
885 1228
886 @deffn Test address [@var{address-part}][@var{comparator}][@var{match-type}] @var{header-names} @var{key-list} 1229 @deffn Test address [@var{address-part}][@var{comparator}][@var{match-type}] @var{header-names} @var{key-list}
887 1230
1231 @noindent
888 Tagged arguments: 1232 Tagged arguments:
889 1233
890 @table @var 1234 @table @var
...@@ -898,7 +1242,6 @@ Specifies the comparator to be used instead of the default @code{i;ascii-casemap ...@@ -898,7 +1242,6 @@ Specifies the comparator to be used instead of the default @code{i;ascii-casemap
898 @item match-type 1242 @item match-type
899 Specifies the match type to be used instead of the default @code{:is}. 1243 Specifies the match type to be used instead of the default @code{:is}.
900 @end table 1244 @end table
901 @sp 1
902 @noindent 1245 @noindent
903 Required arguments: 1246 Required arguments:
904 1247
...@@ -909,7 +1252,6 @@ A list of header names. ...@@ -909,7 +1252,6 @@ A list of header names.
909 @item key-list 1252 @item key-list
910 A list of address values. 1253 A list of address values.
911 @end table 1254 @end table
912 @sp 1
913 @noindent 1255 @noindent
914 1256
915 The @code{address} test matches Internet addresses in structured headers 1257 The @code{address} test matches Internet addresses in structured headers
...@@ -936,8 +1278,8 @@ if address :is :all "from" "tim@@example.com" ...@@ -936,8 +1278,8 @@ if address :is :all "from" "tim@@example.com"
936 @end deffn 1278 @end deffn
937 1279
938 @deffn Test size [:over|:under] @var{number} 1280 @deffn Test size [:over|:under] @var{number}
939 @sp 1
940 @noindent 1281 @noindent
1282
941 The @code{size} test deals with the size of a message. The required 1283 The @code{size} test deals with the size of a message. The required
942 argument @var{number} represents the size of the message in bytes. It 1284 argument @var{number} represents the size of the message in bytes. It
943 may be suffixed with the following quantifiers: 1285 may be suffixed with the following quantifiers:
...@@ -968,8 +1310,8 @@ initial header until the last character in the message body. ...@@ -968,8 +1310,8 @@ initial header until the last character in the message body.
968 @end deffn 1310 @end deffn
969 1311
970 @deffn Test envelope [@var{address-part}][@var{comparator}][@var{match-type}] @var{envelope-part} @var{key-list} 1312 @deffn Test envelope [@var{address-part}][@var{comparator}][@var{match-type}] @var{envelope-part} @var{key-list}
971 @sp 1
972 @noindent 1313 @noindent
1314
973 Tagged arguments: 1315 Tagged arguments:
974 1316
975 @table @var 1317 @table @var
...@@ -983,7 +1325,6 @@ Specifies the comparator to be used instead of the default @code{i;ascii-casemap ...@@ -983,7 +1325,6 @@ Specifies the comparator to be used instead of the default @code{i;ascii-casemap
983 @item match-type 1325 @item match-type
984 Specifies the match type to be used instead of the default @code{:is}. 1326 Specifies the match type to be used instead of the default @code{:is}.
985 @end table 1327 @end table
986 @sp 1
987 @noindent 1328 @noindent
988 Required arguments: 1329 Required arguments:
989 1330
...@@ -994,7 +1335,6 @@ A list of envelope parts to operate upon. ...@@ -994,7 +1335,6 @@ A list of envelope parts to operate upon.
994 @item key-list 1335 @item key-list
995 A list of address values. 1336 A list of address values.
996 @end table 1337 @end table
997 @sp 1
998 @noindent 1338 @noindent
999 1339
1000 The @code{envelope} test is true if the specified part of the @sc{smtp} 1340 The @code{envelope} test is true if the specified part of the @sc{smtp}
...@@ -1010,8 +1350,8 @@ meaningless. ...@@ -1010,8 +1350,8 @@ meaningless.
1010 @end deffn 1350 @end deffn
1011 1351
1012 @deffn Test exists @var{header-names} 1352 @deffn Test exists @var{header-names}
1013 @sp 1
1014 @noindent 1353 @noindent
1354
1015 Required arguments: 1355 Required arguments:
1016 1356
1017 @table @var 1357 @table @var
...@@ -1091,7 +1431,7 @@ header :contains ["X-Caffeine"] [""] @result{} true ...@@ -1091,7 +1431,7 @@ header :contains ["X-Caffeine"] [""] @result{} true
1091 @end deffn 1431 @end deffn
1092 1432
1093 @deffn Test numaddr [:over|:under] @var{header-names} @var{number} 1433 @deffn Test numaddr [:over|:under] @var{header-names} @var{number}
1094 1434 @noindent
1095 This test is provided as an example of loadable extension tests. You 1435 This test is provided as an example of loadable extension tests. You
1096 must use @samp{require "test-numaddr"} statement before actually using 1436 must use @samp{require "test-numaddr"} statement before actually using
1097 it. 1437 it.
...@@ -1156,7 +1496,7 @@ if header :contains ["from"] ["idiot@@example.edu"] ...@@ -1156,7 +1496,7 @@ if header :contains ["from"] ["idiot@@example.edu"]
1156 1496
1157 @deffn Action fileinto @var{folder} 1497 @deffn Action fileinto @var{folder}
1158 @noindent 1498 @noindent
1159 @sp 1 1499
1160 Required arguments: 1500 Required arguments:
1161 1501
1162 @table @var 1502 @table @var
...@@ -1256,6 +1596,8 @@ if header :mime :matches "Content-Type" ...@@ -1256,6 +1596,8 @@ if header :mime :matches "Content-Type"
1256 @end deffn 1596 @end deffn
1257 1597
1258 @deffn Action redirect @var{address} 1598 @deffn Action redirect @var{address}
1599 @noindent
1600
1259 The @code{redirect} action is used to send the message to another user at 1601 The @code{redirect} action is used to send the message to another user at
1260 a supplied @var{address}, as a mail forwarding feature does. This action 1602 a supplied @var{address}, as a mail forwarding feature does. This action
1261 makes no changes to the message body or existing headers, but it may add 1603 makes no changes to the message body or existing headers, but it may add
......
...@@ -24,7 +24,7 @@ The API is still changing. ...@@ -24,7 +24,7 @@ The API is still changing.
24 24
25 @deftypefun int mailer_send_message (mailer_t @var{mailer}, message_t @var{msg}, address_t @var{from}, address_t @var{to}); 25 @deftypefun int mailer_send_message (mailer_t @var{mailer}, message_t @var{msg}, address_t @var{from}, address_t @var{to});
26 26
27 If from is not @var{NULL}, it must containg a single fully qualified 27 If from is not @var{NULL}, it must contain a single fully qualified
28 RFC2822 email address which will be used as the envelope from 28 RFC2822 email address which will be used as the envelope from
29 address. This is the address to which delivery status notifications 29 address. This is the address to which delivery status notifications
30 are sent, so it never matters what it is set to until it REALLY matters. 30 are sent, so it never matters what it is set to until it REALLY matters.
...@@ -101,7 +101,7 @@ Some possible use cases the API must support are: ...@@ -101,7 +101,7 @@ Some possible use cases the API must support are:
101 101
102 2 - mailer_deliver(mailer, msg, address_t( "<>" ), to) 102 2 - mailer_deliver(mailer, msg, address_t( "<>" ), to)
103 103
104 Don't want mail loops, so the nul but valid SMTP address of <> is 104 Don't want mail loops, so the null but valid SMTP address of <> is
105 the envelope from. 105 the envelope from.
106 106
107 @subheading The sendmail mailer. 107 @subheading The sendmail mailer.
......
...@@ -118,10 +118,10 @@ Mailutils. ...@@ -118,10 +118,10 @@ Mailutils.
118 @end ifinfo 118 @end ifinfo
119 @menu 119 @menu
120 * Introduction:: GNU Mailutils 120 * Introduction:: GNU Mailutils
121 @comment * Concrete API:: Concrete API. 121 * libmailbox:: Main library
122 * Framework:: Framework. 122 * libmuauth:: Auxiliary library for authenticating users.
123 * Authentication Library:: Auxiliary library for authenticating users. 123 * libmu_scm:: Interface with Guile
124 * Sieve Library:: GNU implementation of Sieve mail filtering. 124 * libsieve:: GNU implementation of Sieve mail filtering.
125 * Programs:: Programs. 125 * Programs:: Programs.
126 * Reporting Bugs:: How to report a bug. 126 * Reporting Bugs:: How to report a bug.
127 * News:: Where to get information about @sc{gnu} Mailutils 127 * News:: Where to get information about @sc{gnu} Mailutils
...@@ -134,7 +134,7 @@ Indices ...@@ -134,7 +134,7 @@ Indices
134 134
135 @end menu 135 @end menu
136 136
137 @node Introduction, Framework, Top, Top 137 @node Introduction, libmailbox, Top, Top
138 @comment node-name, next, previous, up 138 @comment node-name, next, previous, up
139 @chapter Introduction 139 @chapter Introduction
140 @cindex Introduction 140 @cindex Introduction
...@@ -257,34 +257,34 @@ Notifications} ...@@ -257,34 +257,34 @@ Notifications}
257 257
258 @end itemize 258 @end itemize
259 259
260 @comment @node Concrete API, Framework, Introduction, Top 260 @node libmailbox, libmuauth, Introduction, Top
261 @comment @comment node-name, next, previous, up
262 @comment @chapter Concrete API
263 @comment @cindex Concrete API
264
265 @comment @include c-api.texi
266
267 @node Framework, Authentication Library, Introduction, Top
268 @comment node-name, next, previous, up 261 @comment node-name, next, previous, up
269 @chapter Framework 262 @chapter Framework
270 @cindex Framework 263 @cindex Framework
271 264
272 @include framework.texi 265 @include framework.texi
273 266
274 @node Authentication Library, Sieve Library, Framework, Top 267 @node libmuauth, libmu_scm, libmailbox, Top
275 @chapter Authentication Library 268 @chapter Authentication Library
276 @cindex Authentication Library 269 @cindex Authentication Library
277 @cindex libmuauth 270 @cindex libmuauth
278 271
279 @include libmuauth.texi 272 @include libmuauth.texi
280 273
281 @node Sieve Library, Programs, Authentication Library, Top 274 @node libmu_scm, libsieve, libmuauth, Top
275 @chapter Mailutils to Scheme interface
276 @cindex Scheme
277 @cindex libmu_scm
278
279 @include libmu_scm.texi
280
281 @node libsieve, Programs, libmu_scm, Top
282 @chapter Sieve Library 282 @chapter Sieve Library
283 @cindex Sieve Library 283 @cindex Sieve Library
284 @cindex libsieve 284 @cindex libsieve
285 @include libsieve.texi 285 @include libsieve.texi
286 286
287 @node Programs, Reporting Bugs, Sieve Library, Top 287 @node Programs, Reporting Bugs, libsieve, Top
288 @comment node-name, next, previous, up 288 @comment node-name, next, previous, up
289 @chapter Programs 289 @chapter Programs
290 @cindex Programs 290 @cindex Programs
......
...@@ -310,7 +310,7 @@ of seconds. ...@@ -310,7 +310,7 @@ of seconds.
310 @cindex :auth 310 @cindex :auth
311 311
312 These options control the authorization and authentication module 312 These options control the authorization and authentication module
313 lists. For a description of auhtentication concepts, refer to 313 lists. For a description of authentication concepts, refer to
314 @xref{authentication}. 314 @xref{authentication}.
315 315
316 @table @option 316 @table @option
...@@ -351,7 +351,7 @@ The hashed value of the user password is retrieved from the @acronym{sql} ...@@ -351,7 +351,7 @@ The hashed value of the user password is retrieved from the @acronym{sql}
351 database using query supplied by @option{--sql-getpass} option 351 database using query supplied by @option{--sql-getpass} option
352 (see below). 352 (see below).
353 @item pam 353 @item pam
354 The user is authenicated via pluggable authentication module 354 The user is authenticated via pluggable authentication module
355 (@acronym{pam}). The @acronym{pam} service name to be used is 355 (@acronym{pam}). The @acronym{pam} service name to be used is
356 configured via @option{--pam-service} option (see below) 356 configured via @option{--pam-service} option (see below)
357 @end table 357 @end table
...@@ -455,7 +455,7 @@ be run either as a standalone program or from @file{inetd.conf} file. ...@@ -455,7 +455,7 @@ be run either as a standalone program or from @file{inetd.conf} file.
455 455
456 @sc{gnu} imap4d supports a notion of @dfn{namespaces} defined in RFC 2342. A 456 @sc{gnu} imap4d supports a notion of @dfn{namespaces} defined in RFC 2342. A
457 namespace is a set of directories upon which the user has certain 457 namespace is a set of directories upon which the user has certain
458 permissions. It should be understood that these persmissions apply 458 permissions. It should be understood that these permissions apply
459 only if the underlying filesystem allows them. 459 only if the underlying filesystem allows them.
460 460
461 The three namespaces supported by @command{imap4d} are: 461 The three namespaces supported by @command{imap4d} are:
...@@ -1306,7 +1306,7 @@ Prints out the messages from @var{msglist}. The variable @code{crt} ...@@ -1306,7 +1306,7 @@ Prints out the messages from @var{msglist}. The variable @code{crt}
1306 determines the minimum number of lines the body of the message must 1306 determines the minimum number of lines the body of the message must
1307 contain in order to be piped through pager command specified 1307 contain in order to be piped through pager command specified
1308 by environment variable @code{PAGER}. If @code{crt} is set to a numeric 1308 by environment variable @code{PAGER}. If @code{crt} is set to a numeric
1309 value, this value is taken as the mininmum number of lines. Otherwise, 1309 value, this value is taken as the minimum number of lines. Otherwise,
1310 if @code{crt} is set without a value then the height of the terminal 1310 if @code{crt} is set without a value then the height of the terminal
1311 screen is used to compute the threshold. The number of lines on 1311 screen is used to compute the threshold. The number of lines on
1312 screen is controlled by @code{screen} variable. 1312 screen is controlled by @code{screen} variable.
...@@ -2028,7 +2028,7 @@ Enable network protocol traces (MU_DEBUG_PROT) ...@@ -2028,7 +2028,7 @@ Enable network protocol traces (MU_DEBUG_PROT)
2028 Enable sieve trace (MU_SIEVE_DEBUG_TRACE) 2028 Enable sieve trace (MU_SIEVE_DEBUG_TRACE)
2029 2029
2030 @item l 2030 @item l
2031 Enble sieve action logs 2031 Enable sieve action logs
2032 @end table 2032 @end table
2033 2033
2034 The digits in the range @samp{0} -- @samp{9} used in @var{flags} set 2034 The digits in the range @samp{0} -- @samp{9} used in @var{flags} set
...@@ -2209,7 +2209,7 @@ by default only the first one is presented. ...@@ -2209,7 +2209,7 @@ by default only the first one is presented.
2209 2209
2210 @item -d 2210 @item -d
2211 @itemx --debug 2211 @itemx --debug
2212 Display mailbox debuging information. 2212 Display mailbox debugging information.
2213 2213
2214 @item -f @var{MAILBOX} 2214 @item -f @var{MAILBOX}
2215 @itemx --folder=@var{MAILBOX} 2215 @itemx --folder=@var{MAILBOX}
...@@ -2513,7 +2513,6 @@ The program uses following option groups: @xref{mailbox}. ...@@ -2513,7 +2513,6 @@ The program uses following option groups: @xref{mailbox}.
2513 * Specifying Mailboxes to Operate Upon:: 2513 * Specifying Mailboxes to Operate Upon::
2514 * Passing Options to Scheme:: 2514 * Passing Options to Scheme::
2515 * Guimb Invocation Summary:: 2515 * Guimb Invocation Summary::
2516 * Scheme Procedures and Variables::
2517 @end menu 2516 @end menu
2518 2517
2519 @node Specifying Scheme Program to Execute 2518 @node Specifying Scheme Program to Execute
...@@ -2596,7 +2595,7 @@ lines to the beginning of your script to allow for its immediate execution: ...@@ -2596,7 +2595,7 @@ lines to the beginning of your script to allow for its immediate execution:
2596 @noindent 2595 @noindent
2597 (replace @samp{/usr/local/bin/} with the actual path to the @command{guimb}). 2596 (replace @samp{/usr/local/bin/} with the actual path to the @command{guimb}).
2598 2597
2599 Otherwise, if you use @option{--file} or @option{--expression} oprions, 2598 Otherwise, if you use @option{--file} or @option{--expression} options,
2600 the additional arguments may be passed to the Scheme program @option{-g} 2599 the additional arguments may be passed to the Scheme program @option{-g}
2601 (@option{--guile-arg}) command line option. For example: 2600 (@option{--guile-arg}) command line option. For example:
2602 2601
...@@ -2656,213 +2655,6 @@ Display help message. ...@@ -2656,213 +2655,6 @@ Display help message.
2656 Display program version. 2655 Display program version.
2657 @end table 2656 @end table
2658 2657
2659 @node Scheme Procedures and Variables
2660 @subsection Scheme Procedures and Variables
2661
2662 @menu
2663 * Address Functions::
2664 * Mailbox Functions::
2665 * Message Functions::
2666 * MIME Functions::
2667 * Log Functions::
2668 @end menu
2669
2670
2671 @node Address Functions
2672 @subsubsection Address Functions
2673
2674 @deffn Function mu-address-get-personal ADDRESS NUM
2675 Return personal part of an email address.
2676 @end deffn
2677
2678 @deffn Function mu-address-get-comments ADDRESS NUM
2679 @end deffn
2680
2681 @deffn Function mu-address-get-email ADDRESS NUM
2682 Return email part of an email address.
2683 @end deffn
2684
2685 @deffn Function mu-address-get-domain ADDRESS NUM
2686 Return domain part of an email address
2687 @end deffn
2688
2689 @deffn Function mu-address-get-local ADDRESS NUM
2690 Return local part of an email address.
2691 @end deffn
2692
2693 @deffn Function mu-address-get-count ADDRESS
2694 Return number of parts in email address.
2695 @end deffn
2696
2697 @node Mailbox Functions
2698 @subsubsection Mailbox Functions
2699
2700 @deffn Function mu-mailbox-open URL MODE
2701 Opens a mailbox specified by URL.
2702 @end deffn
2703
2704 @deffn Function mu-mailbox-close MBOX
2705 Closes mailbox MBOX
2706 @end deffn
2707
2708 @deffn Function mu-mailbox-get-url MBOX
2709 Returns the URL of the mailbox.
2710 @end deffn
2711
2712 @deffn Function mu-mailbox-get-port MBOX MODE
2713 Returns a port associated with the contents of the MBOX.
2714 MODE is a string defining operation mode of the stream. It may
2715 contain any of the two characters: @samp{r} for reading, @samp{w} for
2716 writing.
2717 @end deffn
2718
2719 @deffn Function mu-mailbox-get-message MBOX MSGNO
2720 Retrieve from MBOX message # MSGNO.
2721 @end deffn
2722
2723 @deffn Function mu-mailbox-messages-count MBOX
2724 Returns number of messages in the mailbox.
2725 @end deffn
2726
2727 @deffn Function mu-mailbox-expunge MBOX
2728 Expunges deleted messages from the mailbox.
2729 @end deffn
2730
2731 @deffn Function mu-mailbox-url MBOX
2732 Returns the URL of the mailbox
2733 @end deffn
2734
2735 @deffn Function mu-mailbox-append-message MBOX MESG
2736 Appends the message to the mailbox
2737 @end deffn
2738
2739 @node Message Functions
2740 @subsubsection Message Functions
2741
2742 @deffn Function mu-message-copy MESG
2743 Creates the copy of the given message.
2744 @end deffn
2745
2746 @deffn Function mu-message-set-header MESG HEADER VALUE REPLACE
2747 Sets new VALUE to the header HEADER of the message MESG.
2748 If the HEADER is already present in the message its value
2749 is replaced with the supplied one if the optional REPLACE is
2750 #t. Otherwise new header is created and appended.
2751 @end deffn
2752
2753 @deffn Function mu-message-get-size MESG
2754 Returns the size of the given message.
2755 @end deffn
2756
2757 @deffn Function mu-message-get-lines MESG
2758 Returns number of lines in the given message.
2759 @end deffn
2760
2761 @deffn Function mu-message-get-sender MESG
2762 Returns the sender email address for the message MESG.
2763 @end deffn
2764
2765 @deffn Function mu-message-get-header MESG HEADER
2766 Returns the header value of the HEADER in the MESG.
2767 @end deffn
2768
2769 @deffn Function mu-message-get-header-fields MESG HEADERS
2770 Returns the list of headers in the MESG. If optional HEADERS is
2771 specified it should be a list of header names to restrict return
2772 value to.
2773 @end deffn
2774
2775 @deffn Function mu-message-set-header-fields MESG LIST REPLACE
2776 Set the headers in the message MESG from LIST
2777 LIST is a list of (cons HEADER VALUE)
2778 Optional parameter REPLACE specifies whether the new header
2779 values should replace the headers already present in the
2780 message.
2781 @end deffn
2782
2783 @deffn Function mu-message-delete MESG FLAG
2784 Mark given message as deleted. Optional FLAG allows to toggle deleted mark
2785 The message is deleted if it is #t and undeleted if it is #f
2786 @end deffn
2787
2788 @deffn Function mu-message-get-flag MESG FLAG
2789 Return value of the attribute FLAG.
2790 @end deffn
2791
2792 @deffn Function mu-message-set-flag MESG FLAG VALUE
2793 Set the given attribute of the message. If optional VALUE is #f, the
2794 attribute is unset.
2795 @end deffn
2796
2797 @deffn Function mu-message-get-user-flag MESG FLAG
2798 Returns value of the user attribute FLAG.
2799 @end deffn
2800
2801 @deffn Function mu-message-set-user-flag MESG FLAG VALUE
2802 Set the given user attribute of the message. If optional VALUE is
2803 #f, the attribute is unset.
2804 @end deffn
2805
2806 @deffn Function mu-message-get-port MESG MODE FULL
2807 Returns a port associated with the given MESG. MODE is a string
2808 defining operation mode of the stream. It may contain any of the
2809 two characters: @samp{r} for reading, @samp{w} for writing.
2810 If optional FULL argument specified, it should be a boolean value.
2811 If it is #t then the returned port will allow access to any
2812 part of the message (including headers). If it is #f then the port
2813 accesses only the message body (the default).
2814 @end deffn
2815
2816 @deffn Function mu-message-get-body MESG
2817 Returns the message body for the message MESG.
2818 @end deffn
2819
2820 @deffn Function mu-message-send MESG MAILER
2821 Sends the message MESG. Optional MAILER overrides default
2822 mailer settings in mu-mailer.
2823 @end deffn
2824
2825 @node MIME Functions
2826 @subsubsection MIME Functions
2827
2828 @deffn Function mu-mime-create FLAGS MESG
2829 Creates a new MIME object.
2830 @end deffn
2831
2832 @deffn Function mu-mime-multipart? MIME
2833 Returns #t if MIME is a multipart object.
2834 @end deffn
2835
2836 @deffn Function mu-mime-get-num-parts MIME
2837 Returns number of parts in a MIME object.
2838 @end deffn
2839
2840 @deffn Function mu-mime-get-part MIME PART
2841 Returns part number PART from a MIME object.
2842 @end deffn
2843
2844 @deffn Function mu-mime-add-part MIME MESG
2845 Adds MESG to the MIME object.
2846 @end deffn
2847
2848 @deffn Function mu-mime-get-message MIME
2849 Converts MIME object to a message.
2850 @end deffn
2851
2852 @node Log Functions
2853 @subsubsection Log Functions
2854
2855 @deffn Function mu-openlog IDENT OPTION FACILITY
2856 Opens a connection to the system logger for Guile program.
2857 @end deffn
2858
2859 @deffn Function mu-logger PRIO TEXT
2860 Generates a log message to be distributed via syslogd.
2861 @end deffn
2862
2863 @deffn Function mu-closelog
2864 Closes the channel to the system logger open by mu-openlog.
2865 @end deffn
2866 2658
2867 @page 2659 @page
2868 @node comsatd 2660 @node comsatd
......
...@@ -44,45 +44,44 @@ ENVELOPE TO: <coyote@desert.example.org> ...@@ -44,45 +44,44 @@ ENVELOPE TO: <coyote@desert.example.org>
44 11: I don't want to read these messages. 44 11: I don't want to read these messages.
45 12: 45 12:
46 13: Regards. 46 13: Regards.
47 14: . 47 14:
48 15: 48 -re
49 -re 49 15: [0-9:=-]+
50 16: [0-9:=-]+ 50 16: Content-Type: message/delivery-status
51 17: Content-Type: message/delivery-status 51 17:
52 18: 52 -re
53 -re 53 18: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]*
54 19: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]* 54 -re
55 -re 55 19: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
56 20: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* 56 20: Final-Recipient: RFC822; foobar@nonexistent.net
57 21: Final-Recipient: RFC822; foobar@nonexistent.net 57 21: Action: deleted
58 22: Action: deleted 58 22: Disposition: automatic-action/MDN-sent-automatically;deleted
59 23: Disposition: automatic-action/MDN-sent-automatically;deleted 59 -re
60 -re 60 23: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
61 24: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* 61 24:
62 25: 62 -re
63 -re 63 25: [0-9:=-]+
64 26: [0-9:=-]+ 64 26: Content-Type: message/rfc822
65 27: Content-Type: message/rfc822 65 27:
66 28: 66 28: From: coyote@desert.example.org
67 29: From: coyote@desert.example.org 67 29: To: roadrunner@acme.example.com
68 30: To: roadrunner@acme.example.com 68 30: Subject: I have a present for you
69 31: Subject: I have a present for you 69 31: X-Caffeine: C8H10N4O2
70 32: X-Caffeine: C8H10N4O2 70 32:
71 33: 71 33: Look, I'm sorry about the whole anvil thing, and I really
72 34: Look, I'm sorry about the whole anvil thing, and I really 72 34: didn't mean to try and drop it on you from the top of the
73 35: didn't mean to try and drop it on you from the top of the 73 35: cliff. I want to try to make it up to you. I've got some
74 36: cliff. I want to try to make it up to you. I've got some 74 36: great birdseed over here at my place--top of the line
75 37: great birdseed over here at my place--top of the line 75 37: stuff--and if you come by, I'll have it all wrapped up
76 38: stuff--and if you come by, I'll have it all wrapped up 76 38: for you. I'm really sorry for all the problems I've caused
77 39: for you. I'm really sorry for all the problems I've caused 77 39: for you over the years, but I know we can work this out.
78 40: for you over the years, but I know we can work this out. 78 40:
79 41: 79 41: --
80 42: -- 80 42: Wile E. Coyote "Super Genius" coyote@desert.example.org
81 43: Wile E. Coyote "Super Genius" coyote@desert.example.org 81 43:
82 44: 82 -re
83 -re 83 44: [0-9:=-]+
84 45: [0-9:=-]+ 84 45:
85 46:
86 END OF MESSAGE 85 END OF MESSAGE
87 ENVELOPE FROM: MAILER-DAEMON@nonexistent.net 86 ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
88 ENVELOPE TO: <b1ff@de.res.example.com> 87 ENVELOPE TO: <b1ff@de.res.example.com>
...@@ -104,43 +103,42 @@ ENVELOPE TO: <b1ff@de.res.example.com> ...@@ -104,43 +103,42 @@ ENVELOPE TO: <b1ff@de.res.example.com>
104 11: I don't want to read these messages. 103 11: I don't want to read these messages.
105 12: 104 12:
106 13: Regards. 105 13: Regards.
107 14: . 106 14:
108 15: 107 -re
109 -re 108 15: [0-9:=-]+
110 16: [0-9:=-]+ 109 16: Content-Type: message/delivery-status
111 17: Content-Type: message/delivery-status 110 17:
112 18: 111 -re
113 -re 112 18: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]*
114 19: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]* 113 -re
115 -re 114 19: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
116 20: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* 115 20: Final-Recipient: RFC822; foobar@nonexistent.net
117 21: Final-Recipient: RFC822; foobar@nonexistent.net 116 21: Action: deleted
118 22: Action: deleted 117 22: Disposition: automatic-action/MDN-sent-automatically;deleted
119 23: Disposition: automatic-action/MDN-sent-automatically;deleted 118 -re
120 -re 119 23: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
121 24: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* 120 24:
122 25: 121 -re
123 -re 122 25: [0-9:=-]+
124 26: [0-9:=-]+ 123 26: Content-Type: message/rfc822
125 27: Content-Type: message/rfc822 124 27:
126 28: 125 28: From: youcouldberich!@reply-by-postal-mail.invalid
127 29: From: youcouldberich!@reply-by-postal-mail.invalid 126 29: To: rube@landru.example.edu
128 30: To: rube@landru.example.edu 127 30: Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$
129 31: Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$ 128 31: Date: TBD
130 32: Date: TBD 129 32: X-Number: 0015
131 33: X-Number: 0015 130 33:
132 34: 131 34: YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT
133 35: YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT 132 35: IT! SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS! IT WILL
134 36: IT! SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS! IT WILL 133 36: GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!
135 37: GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY! 134 37: MONEY! MONEY! COLD HARD CASH! YOU WILL RECEIVE OVER
136 38: MONEY! MONEY! COLD HARD CASH! YOU WILL RECEIVE OVER 135 38: $20,000 IN LESS THAN TWO MONTHS! AND IT'S LEGAL!!!!!!!!!
137 39: $20,000 IN LESS THAN TWO MONTHS! AND IT'S LEGAL!!!!!!!!! 136 39: !!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1 JUST
138 40: !!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1 JUST 137 40: SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!
139 41: SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW! 138 41:
140 42: 139 -re
141 -re 140 42: [0-9:=-]+
142 43: [0-9:=-]+ 141 43:
143 44:
144 END OF MESSAGE 142 END OF MESSAGE
145 ENVELOPE FROM: MAILER-DAEMON@nonexistent.net 143 ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
146 ENVELOPE TO: <bar@dontmailme.org> 144 ENVELOPE TO: <bar@dontmailme.org>
...@@ -162,40 +160,39 @@ ENVELOPE TO: <bar@dontmailme.org> ...@@ -162,40 +160,39 @@ ENVELOPE TO: <bar@dontmailme.org>
162 11: I don't want to read these messages. 160 11: I don't want to read these messages.
163 12: 161 12:
164 13: Regards. 162 13: Regards.
165 14: . 163 14:
166 15: 164 -re
167 -re 165 15: [0-9:=-]+
168 16: [0-9:=-]+ 166 16: Content-Type: message/delivery-status
169 17: Content-Type: message/delivery-status 167 17:
170 18: 168 -re
171 -re 169 18: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]*
172 19: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]* 170 -re
173 -re 171 19: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
174 20: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* 172 20: Final-Recipient: RFC822; foobar@nonexistent.net
175 21: Final-Recipient: RFC822; foobar@nonexistent.net 173 21: Action: deleted
176 22: Action: deleted 174 22: Disposition: automatic-action/MDN-sent-automatically;deleted
177 23: Disposition: automatic-action/MDN-sent-automatically;deleted 175 -re
178 -re 176 23: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
179 24: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* 177 24:
180 25: 178 -re
181 -re 179 25: [0-9:=-]+
182 26: [0-9:=-]+ 180 26: Content-Type: message/rfc822
183 27: Content-Type: message/rfc822 181 27:
184 28: 182 28: Received: (from bar@dontmailme.org)
185 29: Received: (from bar@dontmailme.org) 183 29: by dontmailme.org id fERKR9N16790
186 30: by dontmailme.org id fERKR9N16790 184 30: for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
187 31: for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200 185 31: Date: Fri, 28 Dec 2001 23:28:08 +0200
188 32: Date: Fri, 28 Dec 2001 23:28:08 +0200 186 32: From: Bar <bar@dontmailme.org>
189 33: From: Bar <bar@dontmailme.org> 187 33: To: Foo Bar <foobar@nonexistent.net>
190 34: To: Foo Bar <foobar@nonexistent.net> 188 34: Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
191 35: Message-Id: <200112232808.fERKR9N16790@dontmailme.org> 189 35: Subject: Coffee
192 36: Subject: Coffee 190 36:
193 37: 191 37: How about some coffee?
194 38: How about some coffee? 192 38:
195 39: 193 -re
196 -re 194 39: [0-9:=-]+
197 40: [0-9:=-]+ 195 40:
198 41:
199 END OF MESSAGE 196 END OF MESSAGE
200 FILE END 197 FILE END
201 TEST END 198 TEST END
......