Commit b88c148d b88c148d185d11e0bdcf876e586e309ef8ea78f2 by Sergey Poznyakoff

Rewrite default mailbox format support to make sure it does not break format aut…

…odetection. Improve the docs.

* configure.ac (MU_DEFAULT_SCHEME): New configuration variable.
* mailbox/version.c (mu_conf_opt): Include default scheme.

* examples/mimetest.c, examples/mta.c, libmu_scm/mu_scm.c: Remove
mu_path_record. Use mu_registrar_set_default_record.

* libproto/mbox/folder.c (_path_is_scheme): Rename to
_mbox_is_scheme. Minor changes as well.
(_path_record, mu_path_record): Removed.
(_mbox_record): Use _mbox_is_scheme.

* libsieve/actions.c: Remove unused variable.

* include/mailutils/Makefile.am (types.h rule): Replace
_MU_DEFAULT_RECORD_. Change MU_OFF_TYPE replacement pattern to
_MU_OFF_TYPE_.

* include/mailutils/mailbox.h (mu_mailbox_set_default_proto)
(mu_mailbox_get_default_proto): Remove. See below.
* include/mailutils/registrar.h (mu_registrar_set_default_scheme)
(mu_registrar_get_default_scheme)
(mu_registrar_get_default_record)
(mu_registrar_set_default_record)
(mu_registrar_lookup_scheme): New prototypes.
(mu_path_record): Remove.
(mu_register_all_mbox_formats): Remove mu_path_record.
Set default scheme using mu_registrar_set_default_record.
(mu_register_local_mbox_formats): Likewise.
* include/mailutils/types.hin (MU_OFF_TYPE): Rename to
_MU_OFF_TYPE_.
(MU_DEFAULT_RECORD): New define.

* mailbox/mailbox.c (mu_mailbox_set_default_proto)
(mu_mailbox_get_default_proto): Remove.
(mu_mailbox_create): Remove default_proto kludge. mu_registrar
stuff is responsible for finding the correct record.
* mailbox/registrar.c (mu_registrar_set_default_record)
(mu_registrar_get_default_record)
(mu_registrar_set_default_scheme)
(mu_registrar_get_default_scheme)
(mu_registrar_lookup_scheme): New functions.
(mu_registrar_lookup_url): Fall back to default record if no
matching record is found and the URL was not set explicitly
(i.e. does not begin with a scheme).

* mailbox/gocs.c: Use mu_registrar_set_default_scheme instead of
mu_mailbox_set_default_proto.
* libsieve/extensions/pipe.c, libsieve/extensions/spamd.c,
libsieve/extensions/vacation.c: Fix comments.

* doc/texinfo/getdate.texi: New file (from gnulib).
* doc/texinfo/Makefile.am (mailutils_TEXINFOS): Add getdate.texi
(fix-sentence-spacing): New rule. Forces single-space
inter-sentence spacing.
(check-tabs, check-sentence-spacing): New rules.
(check-format): Depend on the above two.
(check-refs, check-fixmes, check-unrevised): Fix copy-paste
errors. Print diagnostics to stderr.

* doc/texinfo/auth.texi, doc/texinfo/fdl.texi,
doc/texinfo/framework.texi, doc/texinfo/imap4.texi,
doc/texinfo/libmuauth.texi, doc/texinfo/mailbox.texi,
doc/texinfo/mailcap.texi, doc/texinfo/mailutils.texi,
doc/texinfo/mbox.texi, doc/texinfo/message.texi,
doc/texinfo/mom.texi, doc/texinfo/mu_message.texi,
doc/texinfo/mu_mime.texi, doc/texinfo/mu_scm.texi,
doc/texinfo/muint.texi, doc/texinfo/pop3.texi,
doc/texinfo/rendition.texi, doc/texinfo/sieve.texi,
doc/texinfo/url.texi, doc/texinfo/usage.texi: Use GNU instead of
@sc{gnu}, because latter looks awful when typeset (especially when
followed by a capitalized word). Fix format by running `make final'.

* doc/texinfo/programs.texi: Document more config statements.
* doc/texinfo/libsieve.texi: Document loadable actions and tests.
1 parent 8b4b2e28
2008-11-09 Sergey Poznyakoff <gray@gnu.org.ua>
Rewrite default mailbox format support to make sure it does not
break format autodetection. Improve the docs.
* configure.ac (MU_DEFAULT_SCHEME): New configuration variable.
* mailbox/version.c (mu_conf_opt): Include default scheme.
* examples/mimetest.c, examples/mta.c, libmu_scm/mu_scm.c: Remove
mu_path_record. Use mu_registrar_set_default_record.
* libproto/mbox/folder.c (_path_is_scheme): Rename to
_mbox_is_scheme. Minor changes as well.
(_path_record, mu_path_record): Removed.
(_mbox_record): Use _mbox_is_scheme.
* libsieve/actions.c: Remove unused variable.
* include/mailutils/Makefile.am (types.h rule): Replace
_MU_DEFAULT_RECORD_. Change MU_OFF_TYPE replacement pattern to
_MU_OFF_TYPE_.
* include/mailutils/mailbox.h (mu_mailbox_set_default_proto)
(mu_mailbox_get_default_proto): Remove. See below.
* include/mailutils/registrar.h (mu_registrar_set_default_scheme)
(mu_registrar_get_default_scheme)
(mu_registrar_get_default_record)
(mu_registrar_set_default_record)
(mu_registrar_lookup_scheme): New prototypes.
(mu_path_record): Remove.
(mu_register_all_mbox_formats): Remove mu_path_record.
Set default scheme using mu_registrar_set_default_record.
(mu_register_local_mbox_formats): Likewise.
* include/mailutils/types.hin (MU_OFF_TYPE): Rename to
_MU_OFF_TYPE_.
(MU_DEFAULT_RECORD): New define.
* mailbox/mailbox.c (mu_mailbox_set_default_proto)
(mu_mailbox_get_default_proto): Remove.
(mu_mailbox_create): Remove default_proto kludge. mu_registrar
stuff is responsible for finding the correct record.
* mailbox/registrar.c (mu_registrar_set_default_record)
(mu_registrar_get_default_record)
(mu_registrar_set_default_scheme)
(mu_registrar_get_default_scheme)
(mu_registrar_lookup_scheme): New functions.
(mu_registrar_lookup_url): Fall back to default record if no
matching record is found and the URL was not set explicitly
(i.e. does not begin with a scheme).
* mailbox/gocs.c: Use mu_registrar_set_default_scheme instead of
mu_mailbox_set_default_proto.
* libsieve/extensions/pipe.c, libsieve/extensions/spamd.c,
libsieve/extensions/vacation.c: Fix comments.
* doc/texinfo/getdate.texi: New file (from gnulib).
* doc/texinfo/Makefile.am (mailutils_TEXINFOS): Add getdate.texi
(fix-sentence-spacing): New rule. Forces single-space
inter-sentence spacing.
(check-tabs, check-sentence-spacing): New rules.
(check-format): Depend on the above two.
(check-refs, check-fixmes, check-unrevised): Fix copy-paste
errors. Print diagnostics to stderr.
* doc/texinfo/auth.texi, doc/texinfo/fdl.texi,
doc/texinfo/framework.texi, doc/texinfo/imap4.texi,
doc/texinfo/libmuauth.texi, doc/texinfo/mailbox.texi,
doc/texinfo/mailcap.texi, doc/texinfo/mailutils.texi,
doc/texinfo/mbox.texi, doc/texinfo/message.texi,
doc/texinfo/mom.texi, doc/texinfo/mu_message.texi,
doc/texinfo/mu_mime.texi, doc/texinfo/mu_scm.texi,
doc/texinfo/muint.texi, doc/texinfo/pop3.texi,
doc/texinfo/rendition.texi, doc/texinfo/sieve.texi,
doc/texinfo/url.texi, doc/texinfo/usage.texi: Use GNU instead of
@sc{gnu}, because latter looks awful when typeset (especially when
followed by a capitalized word). Fix format by running `make final'.
* doc/texinfo/programs.texi: Document more config statements.
* doc/texinfo/libsieve.texi: Document loadable actions and tests.
2008-11-07 Sergey Poznyakoff <gray@gnu.org.ua>
Bugfix
......
......@@ -1095,6 +1095,29 @@ if test "$EMACS" != "no"; then
fi
AC_SUBST(lisp_LISP)
# Default mailbox record
# Note: 1. Support for mbox type is always enabled.
# 2. Only local mailbox types are allowed for MU_DEFAULT_SCHEME
AC_ARG_VAR([MU_DEFAULT_SCHEME],
[Default mailbox record. Allowed values are: mbox (default), mh, and maildir.])
if test -z "$MU_DEFAULT_SCHEME"; then
MU_DEFAULT_SCHEME=mbox
fi
case $MU_DEFAULT_SCHEME in
mbox)
;;
mh|maildir)
eval testval=\$mu_cv_enable_$MU_DEFAULT_SCHEME
if test "$testval" != yes; then
AC_MSG_ERROR([Cannot set default mailbox record type: support for $MU_DEFAULT_SCHEME is disabled])
fi
;;
*) AC_MSG_ERROR([Unknown or not allowed mailbox scheme: $MU_DEFAULT_SCHEME]);;
esac
AC_DEFINE_UNQUOTED(MU_DEFAULT_SCHEME, "$MU_DEFAULT_SCHEME",
[Default mailbox scheme.])
AC_SUBST(MU_DEFAULT_RECORD,mu_${MU_DEFAULT_SCHEME}_record)
AC_ARG_VAR([DEFAULT_CUPS_CONFDIR],
[Set the location of CUPS configuration directory. Default is \$sysconfdir/cups])
......@@ -1134,6 +1157,7 @@ cat <<EOF
*******************************************************************
GNU Mailutils configured with the following settings:
Default mailbox scheme......... $status_scheme
Use PAM........................ $status_pam
Use -ltdl...................... $status_ltdl
Use DBM........................ $status_dbm
......@@ -1168,7 +1192,8 @@ Sendmail....................... $status_sendmail
Before proceeding, verify if these satisfy your requirements.
EOF
],
[status_pam=$status_pam
[status_scheme=$MU_DEFAULT_SCHEME
status_pam=$status_pam
status_ltdl=$status_ltdl
status_dbm="$status_dbm"
status_ldap=$status_ldap
......
......@@ -41,6 +41,7 @@ mailutils_TEXINFOS = \
fdl.texi\
folder.texi\
framework.texi\
getdate.texi\
headers.texi\
imap4.texi\
iterator.texi\
......@@ -115,40 +116,57 @@ master-menu:
untabify:
emacs -batch -l untabify.el $(info_TEXINFOS) $(mailutils_TEXINFOS)
fix-sentence-spacing:
for file in $(info_TEXINFOS) $(mailutils_TEXINFOS); \
do \
if grep -q '\. [@A-Z]' $$file; then \
mv $$file $${file}~; \
sed -r 's/\. ([@A-Z])/. \1/g' $${file}~ > $$file; \
fi; \
done
final: untabify master-menu
# Checks
check-format:
check-tabs:
@if test -n "`cat $(info_TEXINFOS) $(mailutils_TEXINFOS) |\
tr -d -c '\t'`"; then \
echo "Sources contain tabs; run make untabify"; \
echo >&2 "Sources contain tabs; run make untabify"; \
false; \
fi
check-sentence-spacing:
@if grep -q '\. [@A-Z]' $(info_TEXINFOS) $(mailutils_TEXINFOS); then \
echo >&2 "Sources contain double-space sentence separators"; \
echo >&2 "Run make fix-sentence-spacing to fix"; \
fi
check-format: check-tabs check-sentence-spacing
check-refs:
@for file in $(info_TEXINFOS) $(dico_TEXINFOS); \
@for file in $(info_TEXINFOS) $(mailutils_TEXINFOS); \
do \
sed -e = $$file | \
sed -n 'N;/@FIXME-.*ref/{s/\(^[0-9][0-9]*\).*@FIXME-.*ref{\([^}]*\)}.*/'$$file':\1: \2/gp}'; \
done > $@-t; \
if [ -s $@-t ]; then \
echo "Unresolved cross-references:"; \
cat $@-t;\
echo >&2 "Unresolved cross-references:"; \
cat $@-t >&2;\
rm $@-t; \
else \
rm -f $@-t; \
fi
check-fixmes:
@for file in $(info_TEXINFOS); \
@for file in $(info_TEXINFOS) $(mailutils_TEXINFOS); \
do \
sed -e = $$file | \
sed -n 'N;/@FIXME{/{s/\(^[0-9][0-9]*\).*@FIXME{\([^}]*\).*/'$$file':\1: \2/gp}'; \
done > $@-t; \
if [ -s $@-t ]; then \
echo "Unresolved FIXMEs:"; \
cat $@-t; \
echo >&2 "Unresolved FIXMEs:"; \
cat $@-t >&2; \
rm $@-t; \
false; \
else \
......@@ -156,10 +174,10 @@ check-fixmes:
fi
check-unrevised:
@grep -Hn @UNREVISED $(info_TEXINFOS) $(dico_TEXINFOS) > $@-t; \
@grep -Hn @UNREVISED $(info_TEXINFOS) $(mailutils_TEXINFOS) > $@-t; \
if [ -s $@-t ]; then \
echo "Unrevised nodes:"; \
cat $@-t; \
echo >&2 "Unrevised nodes:"; \
cat $@-t >&2; \
rm $@-t; \
false;\
else \
......
......@@ -25,7 +25,7 @@
Wherever the mail is and whatever format it is stored in, it is operated
upon using the same set of functions. To unified the C API,
@sc{gnu} Mailutils offers a heteroclite set of objects that work in
GNU Mailutils offers a heteroclite set of objects that work in
aggregation to do operations on emails.
Each object does a specific task and delegates non-related tasks to others.
The object comes alive by specifying a @emph{URL} parameter when created,
......
@c GNU date syntax documentation
@c Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@c 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.2 or
@c any later version published by the Free Software Foundation; with no
@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
@c Texts. A copy of the license is included in the ``GNU Free
@c Documentation License'' file as part of this distribution.
@cindex date input formats
@findex get_date
First, a quote:
@quotation
Our units of temporal measurement, from seconds on up to months, are so
complicated, asymmetrical and disjunctive so as to make coherent mental
reckoning in time all but impossible. Indeed, had some tyrannical god
contrived to enslave our minds to time, to make it all but impossible
for us to escape subjection to sodden routines and unpleasant surprises,
he could hardly have done better than handing down our present system.
It is like a set of trapezoidal building blocks, with no vertical or
horizontal surfaces, like a language in which the simplest thought
demands ornate constructions, useless particles and lengthy
circumlocutions. Unlike the more successful patterns of language and
science, which enable us to face experience boldly or at least
level-headedly, our system of temporal calculation silently and
persistently encourages our terror of time.
@dots{} It is as though architects had to measure length in feet, width
in meters and height in ells; as though basic instruction manuals
demanded a knowledge of five different languages. It is no wonder then
that we often look into our own immediate past or future, last Tuesday
or a week from Sunday, with feelings of helpless confusion. @dots{}
--- Robert Grudin, @cite{Time and the Art of Living}.
@end quotation
This section describes the textual date representations that @sc{gnu}
programs accept. These are the strings you, as a user, can supply as
arguments to the various programs. The C interface (via the
@code{get_date} function) is not described here.
@menu
* General date syntax:: Common rules.
* Calendar date items:: 19 Dec 1994.
* Time of day items:: 9:20pm.
* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}.
* Day of week items:: Monday and others.
* Relative items in date strings:: next tuesday, 2 years ago.
* Pure numbers in date strings:: 19931219, 1440.
* Seconds since the Epoch:: @@1078100502.
* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0".
* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al.
@end menu
@node General date syntax
@section General date syntax
@cindex general date syntax
@cindex items in date strings
A @dfn{date} is a string, possibly empty, containing many items
separated by whitespace. The whitespace may be omitted when no
ambiguity arises. The empty string means the beginning of today (i.e.,
midnight). Order of the items is immaterial. A date string may contain
many flavors of items:
@itemize @bullet
@item calendar date items
@item time of day items
@item time zone items
@item day of the week items
@item relative items
@item pure numbers.
@end itemize
@noindent We describe each of these item types in turn, below.
@cindex numbers, written-out
@cindex ordinal numbers
@findex first @r{in date strings}
@findex next @r{in date strings}
@findex last @r{in date strings}
A few ordinal numbers may be written out in words in some contexts. This is
most useful for specifying day of the week items or relative items (see
below). Among the most commonly used ordinal numbers, the word
@samp{last} stands for @math{-1}, @samp{this} stands for 0, and
@samp{first} and @samp{next} both stand for 1. Because the word
@samp{second} stands for the unit of time there is no way to write the
ordinal number 2, but for convenience @samp{third} stands for 3,
@samp{fourth} for 4, @samp{fifth} for 5,
@samp{sixth} for 6, @samp{seventh} for 7, @samp{eighth} for 8,
@samp{ninth} for 9, @samp{tenth} for 10, @samp{eleventh} for 11 and
@samp{twelfth} for 12.
@cindex months, written-out
When a month is written this way, it is still considered to be written
numerically, instead of being ``spelled in full''; this changes the
allowed strings.
@cindex language, in dates
In the current implementation, only English is supported for words and
abbreviations like @samp{AM}, @samp{DST}, @samp{EST}, @samp{first},
@samp{January}, @samp{Sunday}, @samp{tomorrow}, and @samp{year}.
@cindex language, in dates
@cindex time zone item
The output of the @command{date} command
is not always acceptable as a date string,
not only because of the language problem, but also because there is no
standard meaning for time zone items like @samp{IST}. When using
@command{date} to generate a date string intended to be parsed later,
specify a date format that is independent of language and that does not
use time zone items other than @samp{UTC} and @samp{Z}. Here are some
ways to do this:
@example
$ LC_ALL=C TZ=UTC0 date
Mon Mar 1 00:21:42 UTC 2004
$ TZ=UTC0 date +'%Y-%m-%d %H:%M:%SZ'
2004-03-01 00:21:42Z
$ date --iso-8601=ns | tr T ' ' # --iso-8601 is a GNU extension.
2004-02-29 16:21:42,692722128-0800
$ date --rfc-2822 # a GNU extension
Sun, 29 Feb 2004 16:21:42 -0800
$ date +'%Y-%m-%d %H:%M:%S %z' # %z is a GNU extension.
2004-02-29 16:21:42 -0800
$ date +'@@%s.%N' # %s and %N are GNU extensions.
@@1078100502.692722128
@end example
@cindex case, ignored in dates
@cindex comments, in dates
Alphabetic case is completely ignored in dates. Comments may be introduced
between round parentheses, as long as included parentheses are properly
nested. Hyphens not followed by a digit are currently ignored. Leading
zeros on numbers are ignored.
Invalid dates like @samp{2005-02-29} or times like @samp{24:00} are
rejected. In the typical case of a host that does not support leap
seconds, a time like @samp{23:59:60} is rejected even if it
corresponds to a valid leap second.
@node Calendar date items
@section Calendar date items
@cindex calendar date item
A @dfn{calendar date item} specifies a day of the year. It is
specified differently, depending on whether the month is specified
numerically or literally. All these strings specify the same calendar date:
@example
1972-09-24 # @sc{iso} 8601.
72-9-24 # Assume 19xx for 69 through 99,
# 20xx for 00 through 68.
72-09-24 # Leading zeros are ignored.
9/24/72 # Common U.S. writing.
24 September 1972
24 Sept 72 # September has a special abbreviation.
24 Sep 72 # Three-letter abbreviations always allowed.
Sep 24, 1972
24-sep-72
24sep72
@end example
The year can also be omitted. In this case, the last specified year is
used, or the current year if none. For example:
@example
9/24
sep 24
@end example
Here are the rules.
@cindex @sc{iso} 8601 date format
@cindex date format, @sc{iso} 8601
For numeric months, the @sc{iso} 8601 format
@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
any positive number, @var{month} is a number between 01 and 12, and
@var{day} is a number between 01 and 31. A leading zero must be present
if a number is less than ten. If @var{year} is 68 or smaller, then 2000
is added to it; otherwise, if @var{year} is less than 100,
then 1900 is added to it. The construct
@samp{@var{month}/@var{day}/@var{year}}, popular in the United States,
is accepted. Also @samp{@var{month}/@var{day}}, omitting the year.
@cindex month names in date strings
@cindex abbreviations for months
Literal months may be spelled out in full: @samp{January},
@samp{February}, @samp{March}, @samp{April}, @samp{May}, @samp{June},
@samp{July}, @samp{August}, @samp{September}, @samp{October},
@samp{November} or @samp{December}. Literal months may be abbreviated
to their first three letters, possibly followed by an abbreviating dot.
It is also permitted to write @samp{Sept} instead of @samp{September}.
When months are written literally, the calendar date may be given as any
of the following:
@example
@var{day} @var{month} @var{year}
@var{day} @var{month}
@var{month} @var{day} @var{year}
@var{day}-@var{month}-@var{year}
@end example
Or, omitting the year:
@example
@var{month} @var{day}
@end example
@node Time of day items
@section Time of day items
@cindex time of day item
A @dfn{time of day item} in date strings specifies the time on a given
day. Here are some examples, all of which represent the same time:
@example
20:02:00.000000
20:02
8:02pm
20:02-0500 # In @sc{est} (U.S. Eastern Standard Time).
@end example
More generally, the time of day may be given as
@samp{@var{hour}:@var{minute}:@var{second}}, where @var{hour} is
a number between 0 and 23, @var{minute} is a number between 0 and
59, and @var{second} is a number between 0 and 59 possibly followed by
@samp{.} or @samp{,} and a fraction containing one or more digits.
Alternatively,
@samp{:@var{second}} can be omitted, in which case it is taken to
be zero. On the rare hosts that support leap seconds, @var{second}
may be 60.
@findex am @r{in date strings}
@findex pm @r{in date strings}
@findex midnight @r{in date strings}
@findex noon @r{in date strings}
If the time is followed by @samp{am} or @samp{pm} (or @samp{a.m.}
or @samp{p.m.}), @var{hour} is restricted to run from 1 to 12, and
@samp{:@var{minute}} may be omitted (taken to be zero). @samp{am}
indicates the first half of the day, @samp{pm} indicates the second
half of the day. In this notation, 12 is the predecessor of 1:
midnight is @samp{12am} while noon is @samp{12pm}.
(This is the zero-oriented interpretation of @samp{12am} and @samp{12pm},
as opposed to the old tradition derived from Latin
which uses @samp{12m} for noon and @samp{12pm} for midnight.)
@cindex time zone correction
@cindex minutes, time zone correction by
The time may alternatively be followed by a time zone correction,
expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
of zone minutes.
The zone minutes term, @var{mm}, may be omitted, in which case
the one- or two-digit correction is interpreted as a number of hours.
You can also separate @var{hh} from @var{mm} with a colon.
When a time zone correction is given this way, it
forces interpretation of the time relative to
Coordinated Universal Time (@sc{utc}), overriding any previous
specification for the time zone or the local time zone. For example,
@samp{+0530} and @samp{+05:30} both stand for the time zone 5.5 hours
ahead of @sc{utc} (e.g., India).
This is the best way to
specify a time zone correction by fractional parts of an hour.
The maximum zone correction is 24 hours.
Either @samp{am}/@samp{pm} or a time zone correction may be specified,
but not both.
@node Time zone items
@section Time zone items
@cindex time zone item
A @dfn{time zone item} specifies an international time zone, indicated
by a small set of letters, e.g., @samp{UTC} or @samp{Z}
for Coordinated Universal
Time. Any included periods are ignored. By following a
non-daylight-saving time zone by the string @samp{DST} in a separate
word (that is, separated by some white space), the corresponding
daylight saving time zone may be specified.
Alternatively, a non-daylight-saving time zone can be followed by a
time zone correction, to add the two values. This is normally done
only for @samp{UTC}; for example, @samp{UTC+05:30} is equivalent to
@samp{+05:30}.
Time zone items other than @samp{UTC} and @samp{Z}
are obsolescent and are not recommended, because they
are ambiguous; for example, @samp{EST} has a different meaning in
Australia than in the United States. Instead, it's better to use
unambiguous numeric time zone corrections like @samp{-0500}, as
described in the previous section.
If neither a time zone item nor a time zone correction is supplied,
time stamps are interpreted using the rules of the default time zone
(@pxref{Specifying time zone rules}).
@node Day of week items
@section Day of week items
@cindex day of week item
The explicit mention of a day of the week will forward the date
(only if necessary) to reach that day of the week in the future.
Days of the week may be spelled out in full: @samp{Sunday},
@samp{Monday}, @samp{Tuesday}, @samp{Wednesday}, @samp{Thursday},
@samp{Friday} or @samp{Saturday}. Days may be abbreviated to their
first three letters, optionally followed by a period. The special
abbreviations @samp{Tues} for @samp{Tuesday}, @samp{Wednes} for
@samp{Wednesday} and @samp{Thur} or @samp{Thurs} for @samp{Thursday} are
also allowed.
@findex next @var{day}
@findex last @var{day}
A number may precede a day of the week item to move forward
supplementary weeks. It is best used in expression like @samp{third
monday}. In this context, @samp{last @var{day}} or @samp{next
@var{day}} is also acceptable; they move one week before or after
the day that @var{day} by itself would represent.
A comma following a day of the week item is ignored.
@node Relative items in date strings
@section Relative items in date strings
@cindex relative items in date strings
@cindex displacement of dates
@dfn{Relative items} adjust a date (or the current date if none) forward
or backward. The effects of relative items accumulate. Here are some
examples:
@example
1 year
1 year ago
3 years
2 days
@end example
@findex year @r{in date strings}
@findex month @r{in date strings}
@findex fortnight @r{in date strings}
@findex week @r{in date strings}
@findex day @r{in date strings}
@findex hour @r{in date strings}
@findex minute @r{in date strings}
The unit of time displacement may be selected by the string @samp{year}
or @samp{month} for moving by whole years or months. These are fuzzy
units, as years and months are not all of equal duration. More precise
units are @samp{fortnight} which is worth 14 days, @samp{week} worth 7
days, @samp{day} worth 24 hours, @samp{hour} worth 60 minutes,
@samp{minute} or @samp{min} worth 60 seconds, and @samp{second} or
@samp{sec} worth one second. An @samp{s} suffix on these units is
accepted and ignored.
@findex ago @r{in date strings}
The unit of time may be preceded by a multiplier, given as an optionally
signed number. Unsigned numbers are taken as positively signed. No
number at all implies 1 for a multiplier. Following a relative item by
the string @samp{ago} is equivalent to preceding the unit by a
multiplier with value @math{-1}.
@findex day @r{in date strings}
@findex tomorrow @r{in date strings}
@findex yesterday @r{in date strings}
The string @samp{tomorrow} is worth one day in the future (equivalent
to @samp{day}), the string @samp{yesterday} is worth
one day in the past (equivalent to @samp{day ago}).
@findex now @r{in date strings}
@findex today @r{in date strings}
@findex this @r{in date strings}
The strings @samp{now} or @samp{today} are relative items corresponding
to zero-valued time displacement, these strings come from the fact
a zero-valued time displacement represents the current time when not
otherwise changed by previous items. They may be used to stress other
items, like in @samp{12:00 today}. The string @samp{this} also has
the meaning of a zero-valued time displacement, but is preferred in
date strings like @samp{this thursday}.
When a relative item causes the resulting date to cross a boundary
where the clocks were adjusted, typically for daylight saving time,
the resulting date and time are adjusted accordingly.
The fuzz in units can cause problems with relative items. For
example, @samp{2003-07-31 -1 month} might evaluate to 2003-07-01,
because 2003-06-31 is an invalid date. To determine the previous
month more reliably, you can ask for the month before the 15th of the
current month. For example:
@example
$ date -R
Thu, 31 Jul 2003 13:02:39 -0700
$ date --date='-1 month' +'Last month was %B?'
Last month was July?
$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
Last month was June!
@end example
Also, take care when manipulating dates around clock changes such as
daylight saving leaps. In a few cases these have added or subtracted
as much as 24 hours from the clock, so it is often wise to adopt
universal time by setting the @env{TZ} environment variable to
@samp{UTC0} before embarking on calendrical calculations.
@node Pure numbers in date strings
@section Pure numbers in date strings
@cindex pure numbers in date strings
The precise interpretation of a pure decimal number depends
on the context in the date string.
If the decimal number is of the form @var{yyyy}@var{mm}@var{dd} and no
other calendar date item (@pxref{Calendar date items}) appears before it
in the date string, then @var{yyyy} is read as the year, @var{mm} as the
month number and @var{dd} as the day of the month, for the specified
calendar date.
If the decimal number is of the form @var{hh}@var{mm} and no other time
of day item appears before it in the date string, then @var{hh} is read
as the hour of the day and @var{mm} as the minute of the hour, for the
specified time of day. @var{mm} can also be omitted.
If both a calendar date and a time of day appear to the left of a number
in the date string, but no relative item, then the number overrides the
year.
@node Seconds since the Epoch
@section Seconds since the Epoch
If you precede a number with @samp{@@}, it represents an internal time
stamp as a count of seconds. The number can contain an internal
decimal point (either @samp{.} or @samp{,}); any excess precision not
supported by the internal representation is truncated toward minus
infinity. Such a number cannot be combined with any other date
item, as it specifies a complete time stamp.
@cindex beginning of time, for @acronym{POSIX}
@cindex epoch, for @acronym{POSIX}
Internally, computer times are represented as a count of seconds since
an epoch---a well-defined point of time. On @acronym{GNU} and
@acronym{POSIX} systems, the epoch is 1970-01-01 00:00:00 @sc{utc}, so
@samp{@@0} represents this time, @samp{@@1} represents 1970-01-01
00:00:01 @sc{utc}, and so forth. @acronym{GNU} and most other
@acronym{POSIX}-compliant systems support such times as an extension
to @acronym{POSIX}, using negative counts, so that @samp{@@-1}
represents 1969-12-31 23:59:59 @sc{utc}.
Traditional Unix systems count seconds with 32-bit two's-complement
integers and can represent times from 1901-12-13 20:45:52 through
2038-01-19 03:14:07 @sc{utc}. More modern systems use 64-bit counts
of seconds with nanosecond subcounts, and can represent all the times
in the known lifetime of the universe to a resolution of 1 nanosecond.
On most hosts, these counts ignore the presence of leap seconds.
For example, on most hosts @samp{@@915148799} represents 1998-12-31
23:59:59 @sc{utc}, @samp{@@915148800} represents 1999-01-01 00:00:00
@sc{utc}, and there is no way to represent the intervening leap second
1998-12-31 23:59:60 @sc{utc}.
@node Specifying time zone rules
@section Specifying time zone rules
@vindex TZ
Normally, dates are interpreted using the rules of the current time
zone, which in turn are specified by the @env{TZ} environment
variable, or by a system default if @env{TZ} is not set. To specify a
different set of default time zone rules that apply just to one date,
start the date with a string of the form @samp{TZ="@var{rule}"}. The
two quote characters (@samp{"}) must be present in the date, and any
quotes or backslashes within @var{rule} must be escaped by a
backslash.
For example, with the @acronym{GNU} @command{date} command you can
answer the question ``What time is it in New York when a Paris clock
shows 6:30am on October 31, 2004?'' by using a date beginning with
@samp{TZ="Europe/Paris"} as shown in the following shell transcript:
@example
$ export TZ="America/New_York"
$ date --date='TZ="Europe/Paris" 2004-10-31 06:30'
Sun Oct 31 01:30:00 EDT 2004
@end example
In this example, the @option{--date} operand begins with its own
@env{TZ} setting, so the rest of that operand is processed according
to @samp{Europe/Paris} rules, treating the string @samp{2004-10-31
06:30} as if it were in Paris. However, since the output of the
@command{date} command is processed according to the overall time zone
rules, it uses New York time. (Paris was normally six hours ahead of
New York in 2004, but this example refers to a brief Halloween period
when the gap was five hours.)
A @env{TZ} value is a rule that typically names a location in the
@uref{http://www.twinsun.com/tz/tz-link.htm, @samp{tz} database}.
A recent catalog of location names appears in the
@uref{http://twiki.org/cgi-bin/xtra/tzdate, TWiki Date and Time
Gateway}. A few non-@acronym{GNU} hosts require a colon before a
location name in a @env{TZ} setting, e.g.,
@samp{TZ=":America/New_York"}.
The @samp{tz} database includes a wide variety of locations ranging
from @samp{Arctic/Longyearbyen} to @samp{Antarctica/South_Pole}, but
if you are at sea and have your own private time zone, or if you are
using a non-@acronym{GNU} host that does not support the @samp{tz}
database, you may need to use a @acronym{POSIX} rule instead. Simple
@acronym{POSIX} rules like @samp{UTC0} specify a time zone without
daylight saving time; other rules can specify simple daylight saving
regimes. @xref{TZ Variable,, Specifying the Time Zone with @code{TZ},
libc, The GNU C Library}.
@node Authors of get_date
@section Authors of @code{get_date}
@cindex authors of @code{get_date}
@cindex Bellovin, Steven M.
@cindex Salz, Rich
@cindex Berets, Jim
@cindex MacKenzie, David
@cindex Meyering, Jim
@cindex Eggert, Paul
@code{get_date} was originally implemented by Steven M. Bellovin
(@email{smb@@research.att.com}) while at the University of North Carolina
at Chapel Hill. The code was later tweaked by a couple of people on
Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various
revisions for the @sc{gnu} system were made by David MacKenzie, Jim Meyering,
Paul Eggert and others.
@cindex Pinard, F.
@cindex Berry, K.
This chapter was originally produced by Fran@,{c}ois Pinard
(@email{pinard@@iro.umontreal.ca}) from the @file{getdate.y} source code,
and then edited by K.@: Berry (@email{kb@@cs.umb.edu}).
......@@ -4,7 +4,7 @@
@c See file mailutils.texi for copying conditions.
@comment *******************************************************************
@code{Libsieve} is @sc{gnu} implementation of the mail filtering
@code{Libsieve} is GNU implementation of the mail filtering
language Sieve. The library is built around a @dfn{Sieve Machine} --- an
abstract computer constructed specially to handle mail filtering tasks.
This computer has two registers: program counter and numeric accumulator;
......@@ -664,7 +664,7 @@ Dump the disassembled code of the sieve machine @var{mach}.
@subsection Writing Loadable Commands
This section contains an example of how to write external loadable
commands for @sc{gnu} libsieve.
commands for GNU libsieve.
@smallexample
@include numaddr.inc
......
......@@ -97,6 +97,7 @@ This edition of the @cite{GNU Mailutils Manual}, last updated on
Appendices
* References:: References.
* Date Input Formats::
* Usage Vars:: Configuring Help Summary
* GNU FDL:: This manual is under the GNU Free
Documentation License.
......@@ -388,6 +389,29 @@ Preprocessor
* #include:: Include the contents of a file.
* #searchpath:: Modify the current search path.
Tests
* Built-in Tests::
* External Tests::
Actions
* Built-in Actions::
* External Actions::
Date Input Formats
* General date syntax:: Common rules.
* Calendar date items:: 19 Dec 1994.
* Time of day items:: 9:20pm.
* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}.
* Day of week items:: Monday and others.
* Relative items in date strings:: next tuesday, 2 years ago.
* Pure numbers in date strings:: 19931219, 1440.
* Seconds since the Epoch:: @@1078100502.
* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0".
* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al.
@end detailmenu
@end menu
......@@ -673,6 +697,10 @@ Notifications}
@end itemize
@end itemize
@node Date Input Formats
@appendix Date Input Formats
@include getdate.texi
@include usage.texi
@include fdl.texi
......
......@@ -994,12 +994,11 @@ time, using @samp{_PATH_MAILDIR} define from the include file
@end enumerate
@deffn {Configuration} mailbox-type @var{type}
@vrindex MU_DEFAULT_SCHEME
Specifies type of mailboxes. By default, @samp{mbox} (UNIX mailbox)
is assumed.
Notice that, in Mailutils version @value{VERSION}, using this
statement effectively disables mailbox type autodetection. @FIXME{More
info on this.}
is assumed. This can be changed while configuring the package by
setting @code{MU_DEFAULT_SCHEME} configuration variable. The default
value can be verified by running @command{mailutils-config --info scheme}.
@end deffn
@deffn {Configuration} folder @var{dir}
......@@ -1546,13 +1545,22 @@ User credentials are retrieved from the system user database
(@file{/etc/password}).
@item sql
User credentials are retrieved from a @acronym{SQL} database.
Separate configuration statement, @code{sql}, is used to configure
A separate configuration statement, @code{sql}, is used to configure
it (@pxref{SQL Statement}).
@item virtdomain
User credentials are retrieved from a ``virtual domain'' user
database.
database. Virtual domains are configured using @code{virtdomain}
statement (@pxref{Virtdomain Statement}).
@item radius
User credentials are retrieved using @acronym{RADIUS}. @xref{Radius
Statement}, for a detailed description on how to configure it.
@item ldap
User credentials are retrieved from an @acronym{LDAP}
database. @xref{LDAP Statement}, for an information on how to
configure it.
@end table
@FIXME{This may be inaccurate:}
Unless overridden by @code{authorization} statement,
the default list of authorization modules is:
......@@ -1582,8 +1590,14 @@ statement (@pxref{SQL Statement, getpass}).
The user is authenticated via pluggable authentication module
(@acronym{PAM}). The @acronym{PAM} service name to be used is
configured in @code{pam} statement (@pxref{PAM Statement}).
@item radius
The user is authenticated on a remote @acronym{RADIUS}
server. @xref{Radius Statement}.
@item ldap
The user is authenticated using @acronym{LDAP}. @xref{LDAP Statement}.
@end table
@FIXME{This list is inaccurate:}
Unless overridden by @code{authentication} statement,
the list of authentication modules is:
......@@ -1673,21 +1687,161 @@ file.
@node Radius Statement
@subsection Radius Statement
@UNREVISED
@kwindex radius
@subheading Syntax
@smallexample
radius @{
# Set radius configuration directory.
directory @var{dir};
# @r{Radius request for authorization.}
auth @var{request};
# @r{Radius request for getpwnam.}
getpwnam @var{request};
# Radius request for getpwuid.
getpwuid @var{request};
# Set radius configuration directory.
directory @var{dir};
@}
@end smallexample
@subheading Description
The @code{radius} block statement configures @acronym{RADIUS
authentication} and authorization.
Mailutils uses GNU Radius library, which is configured via
@file{raddb/client.conf} file (@pxref{client.conf, Client Configuration,
Client Configuration, radius, GNU Radius Reference Manual}). Its exact
location depends on configuration settings that were used while
compiling GNU Radius. Usually it is @file{/usr/local/etc}, or
@file{/etc}. This default can also be changed at run time using
@code{directory} statement:
@deffn {Configuration} directory @var{dir}
Set full path name to the GNU Radius configuration directory.
@end deffn
It authorization is used, the Radius dictionary file must declare the
the following attributes:
@multitable @columnfractions 0.4 0.2 0.4
@headitem Attribute @tab Type @tab Description
@kwindex GNU-MU-User-Name
@item GNU-MU-User-Name @tab string @tab User login name
@kwindex GNU-MU-UID
@item GNU-MU-UID @tab integer @tab UID
@kwindex GNU-MU-GID
@item GNU-MU-GID @tab integer @tab GID
@kwindex GNU-MU-GECOS
@item GNU-MU-GECOS @tab string @tab GECOS
@kwindex GNU-MU-Dir
@item GNU-MU-Dir @tab string @tab Home directory
@kwindex GNU-MU-Shell
@item GNU-MU-Shell @tab string @tab User shell
@kwindex GNU-MU-Mailbox
@item GNU-MU-Mailbox @tab string @tab User mailbox
@kwindex GNU-MU-Quota
@item GNU-MU-Quota @tab integer @tab Mail quota (in bytes)
@end multitable
@flindex mailutils.dict
A dictionary file with appropriate definitions is included in the
Mailutils distribution: @file{examples/config/mailutils.dict}. This
file is not installed by default, you will have to manually copy it to
the GNU Radius @file{raddb/dict} directory and include it in the main
dictionary file @file{raddb/dictionary} by adding the following
statement:
@smallexample
$INCLUDE dict/mailutils.dict
@end smallexample
Requests to use for authentication and authorization are
configured using three statements: @code{auth}, @code{getpwnam} and
@code{getpwuid}. Each statement takes a single argument: a string,
containing a comma-separated list of assignements. An assignement
specifies a particular @dfn{attribute-value pair} (@pxref{Overview,
RADIUS Attributes,, radius, GNU Radius Reference Manual}) to send to
the server. The left-hand side of the assignement is a symbolic attribute
name, as defined in one of Radius dictionaries (@pxref{dictionary
file, Dictionary of Attributes,, radius, GNU Radius Reference
Manual}). The value is specified by the right-hand side of
assignement. For example:
@smallexample
"Service-Type = Authenticate-Only, NAS-Identifier = \"mail\""
@end smallexample
An assignement may contain references to the following macro-variables
(@FIXME-pxref{macro-variables}):
@table @asis
@item user
The actual user name (for @code{auth} and @code{getpwnam}), or user ID
(for @code{getpwuid}). For example:
@smallexample
User-Name = $@{user@}
@end smallexample
@item passwd
User password. For examples:
@smallexample
User-Password = $@{passwd@}
@end smallexample
@end table
@deffn {Configuration} auth @var{pairlist}
Specifies the request to be sent to authenticate the user. For example:
@smallexample
auth "User-Name = $@{user@}, User-Password = $@{passwd@}";
@end smallexample
The user is authenticated only if this request returns
@code{Access-Accept} (@pxref{Authentication Requests, Access-Accept,,
radius, GNU Radius Reference Manual}). Any returned attribute-value
pairs are ignored.
@end deffn
@deffn {Configuration} getpwnam @var{pairlist}
Specifies the request that returns user information for the
given user name. For example:
@smallexample
getpwnam "User-Name = $@{user@}, State = getpwnam, "
"Service-Type = Authenticate-Only";
@end smallexample
If the requested user account exists, the Radius server must return
@code{Access-Accept} packet with the following attributes:
@code{GNU-MU-User-Name}, @code{GNU-MU-UID}, @code{GNU-MU-GID},
@code{GNU-MU-GECOS}, @code{GNU-MU-Dir}, @code{GNU-MU-Shell}.
The attributes @code{GNU-MU-Mailbox} and @code{GNU-MU-Quota} are
optional.
If @code{GNU-MU-Mailbox} is present, it must contain a
valid mailbox @acronym{URL} (@FIXME-pxref{urls}). If
@code{GNU-MU-Mailbox} is not present, Mailutils constructs the
mailbox name using the settings from the @code{mailbox} configuration
statement (@pxref{Mailbox Statement}), or built-in defaults, if it is
not present.
If @code{GNU-MU-Quota} is present, it specifies the maximum mailbox
size for this user, in bytes. In the absence of this attribute,
mailbox size is unlimited.
@end deffn
@deffn {Configuration} getpwuid @var{pairlist}
Specifies the request that returns user information for the
given user ID. In @var{pairlist}, the @samp{user} macro-variable is
expanded to the numeric value of ID. For example:
@smallexample
getpwuid "User-Name = $@{user@}, State = getpwuid, "
"Service-Type = Authenticate-Only";
@end smallexample
The reply to @code{getpwuid} request is the same as to @code{getpwnam}
request (see above).
@end deffn
@node SQL Statement
@subsection SQL Statement
......@@ -1698,12 +1852,6 @@ radius @{
sql @{
# @r{Set SQL interface to use.}
interface @samp{mysql|odbc|postgres};
# @r{SQL query to use for getpwnam requests.}
getpwnam @var{query};
# @r{SQL query to use for getpwuid requests.}
getpwuid @var{query};
# @r{SQL query returning the user's password.}
getpass @var{query};
# @r{SQL server host name.}
host @var{arg};
# @r{SQL user name.}
......@@ -1718,8 +1866,68 @@ sql @{
password-type @samp{plain | hash | scrambled};
# @r{Set a field-map for parsing SQL replies.}
field-map @var{map};
# @r{SQL query returning the user's password.}
getpass @var{query};
# @r{SQL query to use for getpwnam requests.}
getpwnam @var{query};
# @r{SQL query to use for getpwuid requests.}
getpwuid @var{query};
@}
@end smallexample
@subsection Description
The @code{sql} statement configures access credentials to
@acronym{SQL} database and the queries for authentication and
authorization.
GNU Mailutils supports three types of @acronym{SQL} interfaces:
MySQL, PostgreSQL and ODBC. The latter is a standard API for using
database management systems, which can be used to communicate with a
wide variety of DBMS.
@deffn {Configuration} interface @var{type}
Configures type of DBMS interface. Allowed values for @var{type} are:
@table @asis
@item mysql
Interface with a MySQL server (@uref{http://www.mysql.org}).
@item odbc
Use ODBC interface. See @uref{http://www.unixodbc.org}, for a detailed
description of ODBC configuration.
@item postgres
Interface with a PostgreSQL server (@uref{http://www.postgres.org}).
@end table
@end deffn
The database and database access credentials are configured using the
following statements:
@deffn {Configuration} host @var{arg}
The host running the @acronym{SQL} server. The value can be either a
host name or an IP address in dotted-quad notation, in which case an
@acronym{INET} connection is used, or a full pathname to a file, in
which case a connection to @acronym{UNIX} socket is used.
@end deffn
@deffn {Configuration} port @var{arg}
TCP port the server is listening on (for @acronym{INET}
connections). This parameter is optional. Its default value depends on
the type of database being used.
@end deffn
@deffn {Configuration} db @var{arg};
Name of the database.
@end deffn
@deffn {Configuration} user @var{arg}
@acronym{SQL} user name.
@end deffn
@deffn {Configuration} passwd @var{arg};
Password to access the database.
@end deffn
@node LDAP Statement
@subsection LDAP Statement
......@@ -3094,7 +3302,7 @@ set
@node Mail Variables
@subsection How to Alter the Behavior of @command{mail}
Following variables control the behavior of @sc{gnu} @command{mail}:
Following variables control the behavior of GNU @command{mail}:
@table @code
@item appenddeadletter
......@@ -3916,7 +4124,7 @@ Default is --weedlist=''From Subject Date To CC Apparently-''
@pindex sieve
Sieve is a language for filtering e-mail messages at time of final
delivery, described in RFC 3028. @sc{gnu} Mailutils provides two
delivery, described in RFC 3028. GNU Mailutils provides two
implementations of this language: a stand-alone @dfn{sieve interpreter}
and a @dfn{sieve translator and filter}. The following sections describe these
utilities in detail.
......@@ -3930,10 +4138,10 @@ utilities in detail.
@subsection A Sieve Interpreter
Sieve interpreter @command{sieve} allows to apply Sieve scripts to an
arbitrary number of mailboxes. @sc{gnu} @command{sieve} implements a superset
arbitrary number of mailboxes. GNU @command{sieve} implements a superset
of the Sieve language as described in RFC 3028. @xref{Sieve Language},
for a description of the Sieve language. @xref{GNU Extensions}, for a
discussion of differences between the @sc{gnu} implementation of Sieve and
discussion of differences between the GNU implementation of Sieve and
its standard.
@menu
......@@ -4374,7 +4582,7 @@ Display usage summary and exit.
@item -L
@itemx --license
Display @sc{gnu} General Public License and exit.
Display GNU General Public License and exit.
@item -m @var{path}
@itemx --mail-spool @var{path}
......@@ -4558,7 +4766,7 @@ not delivered and the sender receives following notification message:
message. In this case @command{mail.local} does deliver the message.
@end enumerate
Version @value{VERSION} of @sc{gnu} mailutils is able to retrieve
Version @value{VERSION} of GNU mailutils is able to retrieve
mailbox quotas from a @sc{dbm} or @sc{sql} database.
@menu
......@@ -5104,7 +5312,7 @@ Remove all deletion marks from the messages after opening the mailbox.
@section IMAP4 Daemon
@pindex imap4d
@sc{gnu} @command{imap4d} is a daemon implementing @sc{imap4} rev1 protocol
GNU @command{imap4d} is a daemon implementing @sc{imap4} rev1 protocol
for accessing and handling electronic mail messages on a server. It can
be run either as a standalone program or from @file{inetd.conf} file.
......@@ -5118,7 +5326,7 @@ be run either as a standalone program or from @file{inetd.conf} file.
@cindex namespace
@cindex IMAP4 namespace
@sc{gnu} @command{imap4d} supports a notion of @dfn{namespaces} defined
GNU @command{imap4d} supports a notion of @dfn{namespaces} defined
in RFC 2342. A namespace is a set of directories upon which the user
has certain permissions. It should be understood that these permissions
apply only if the underlying filesystem allows them.
......@@ -5664,7 +5872,7 @@ The flags and their meanings are:
The Mailutils uses @sc{pam} libraries.
@item HAVE_LIBLTDL
The @sc{gnu} wrapper library @file{libltdl} is present and is used
The GNU wrapper library @file{libltdl} is present and is used
by Mailutils. @xref{Using libltdl,,,libtool,Using libltdl}, for
more information on @file{libltdl} library.
......
......@@ -4,7 +4,7 @@
@c See file mailutils.texi for copying conditions.
@comment *******************************************************************
The input language understood by the @sc{gnu} Sieve Library
The input language understood by the GNU Sieve Library
is a superset of the Sieve language as described in RFC 3028.
@menu
......@@ -52,8 +52,8 @@ Like in C, bracketed comments do not nest.
The basic lexical entities are @dfn{identifiers} and @dfn{literals}.
An @dfn{identifier} is a sequence of letters, digits and underscores, started
with a letter or underscore. For example, @code{header} and
An @dfn{identifier} is a sequence of letters, digits and underscores,
that begins with a letter or underscore. For example, @code{header} and
@code{check_822_again} are valid identifiers, whereas @code{1st} is not.
A special form of identifier is @dfn{tag}: it is an identifier prefixed
with a colon (@samp{:}), e.g.: @code{:comparator}.
......@@ -64,6 +64,7 @@ literals:
@itemize
@item Number
@cindex numbers, sieve
@dfn{Numbers} are given as ordinary unsigned decimal numbers. An
optional suffix may be used to indicate a multiple of a power of two.
......@@ -75,13 +76,14 @@ or 1,073,741,824 (2^30) times the value of the number.
The numbers have 32 bits of magnitude.
@item String
@cindex strings, sieve
A @dfn{string} is any sequence of characters enclosed in double quotes
(@samp{"}). A string cannot contain newlines and double quote
characters. This limitation will disappear in future releases.
@item Multiline Strings
@cindex multiline strings, sieve
@kwindex text:
A @dfn{multiline string} is used to represent large blocks of text
with embedded newlines and special characters. It starts with the
keyword @code{text:} followed by a newline and ends with a dot
......@@ -159,6 +161,7 @@ if header "from" "me@@example.com"
@noindent
@item String Lists
@cindex string list, sieve
A @dfn{string list} is a comma-delimited list of quoted strings, enclosed
in a pair of square brackets, e.g.:
......@@ -225,6 +228,7 @@ For example, consider the following command
@smallexample
header :mime :comparator "i;octet" ["to", "from"] "bug-mailutils@@gnu.org"
@end smallexample
@noindent
Here, given that @code{header} takes two positional arguments:
@code{header} is command name, the list @code{["to", "from"]} is first
......@@ -235,9 +239,10 @@ parameter.
@node Actions Described
@subsection Actions Described
@cindex action, sieve
An @dfn{action} is a Sieve command that performs some operation over
the message. Actions do the main job in any Sieve
a message. Actions do the main job in any Sieve
program. Syntactically, an action is a command terminated with
semicolon, e.g.:
......@@ -247,14 +252,15 @@ keep;
fileinto "mbox";
@end smallexample
@sc{gnu} Sieve provides the full set of actions described in RFC 3028.
GNU Sieve provides the full set of actions described in RFC 3028.
It also allows to extend this set using loadable
actions. @xref{Actions}, for detailed discussion of actions.
@node Control Flow
@subsection Control Flow
@kwindex if, sieve
The only control flow statement Sieve has is ``if'' statement. In its
The only control flow statement Sieve has is @code{if} statement. In its
simplest form it is:
@smallexample
......@@ -313,6 +319,7 @@ statements.
@node Tests and Conditions
@subsection Tests and Conditions
@cindex test, sieve
@dfn{Tests} are Sieve commands that return boolean value. E.g. the
test
......@@ -320,21 +327,28 @@ test
@smallexample
header :contains "from" "coyote"
@end smallexample
@noindent
returns true only if the header ``From'' of the current message contains
substring ``coyote''.
The tests shipped with the @sc{gnu} Sieve are described in @ref{Tests}.
The tests shipped with the GNU Sieve are described in @ref{Tests}.
@cindex condition, sieve
@dfn{Condition} is a Sieve expression that evaluates to @code{true} or
@code{false}. In its simplest form, condition is just a Sieve test.
@kwindex not, sieve
To reverse the sense of a condition use keyword @code{not}, e.g.:
@smallexample
not header :contains "from" "coyote"
@end smallexample
@kwindex and, sieve
@kwindex or, sieve
@kwindex allof
@kwindex anyof
The results of several conditions may be joined together by logical
@code{and} and @code{or} operations. The special form @code{allof}
takes several tests as its arguments and computes the logical @code{and}
......@@ -351,11 +365,12 @@ if anyof (not exists ["From", "Date"],
@node Preprocessor
@section Preprocessor
@cindex Sieve preprocessor statements, a @sc{gnu} extension
@cindex preprocessor, sieve
@cindex Sieve preprocessor statements
The preprocessor statements are a @sc{gnu} extension to the Sieve language.
Preprocessor statements are a GNU extension to the Sieve language.
The syntax for a preprocessor statement is similar to that used in
@code{C} programming language, i.e.: a pound character (@samp{#})
@code{C} programming language, i.e. a pound character (@samp{#})
followed by a preprocessor directive and its arguments. Any amount of
whitespace can be inserted between the @samp{#} and the directive.
Currently implemented directives are @code{include} and @code{searchpath}.
......@@ -367,7 +382,7 @@ Currently implemented directives are @code{include} and @code{searchpath}.
@node #include
@subheading Sieve #include directive
@cindex #include, sieve
@kwindex #include, sieve
The @code{#include} directive reads in the contents of the given file.
The contents is ``inserted'' into the text being parsed starting at the
......@@ -387,15 +402,16 @@ If @var{filename} starts with a directory separator character
@node #searchpath
@subheading Sieve #searchpath directive
@cindex #searchpath, sieve
@kwindex #searchpath, sieve
The @code{#searchpath} directive adds its argument to the list of
directories searched for loadable modules. It has the same effect
as @option{-L} command line switch used by @sc{gnu} sieve utility
as @option{-L} command line switch used by GNU sieve utility
(@FIXME-pxref{sieve group}).
@node Require Statement
@section Require Statement
@kwindex require, sieve
@smallexample
Syntax: require @var{string};
......@@ -419,11 +435,12 @@ Otherwise, the capability is understood as a name of an action to be
used.
The @code{require} statement, if present, must be used before any other
statement that is using the required capability. As an extension, the @sc{gnu}
statement that is using the required capability. As an extension, the GNU
sieve allows the @code{require} and any other statements to be
interspersed.
By default the following actions and comparators are always required:
By default the following actions and comparators need not be
explicitly required:
@itemize
@item stop
......@@ -443,7 +460,7 @@ require "fileinto";
require "comparator-i;ascii-numeric";
@end smallexample
When processing arguments for @code{require} statement, @sc{gnu} libsieve
When processing arguments for @code{require} statement, GNU libsieve
uses the following algorithm:
@enumerate 1
......@@ -481,6 +498,8 @@ search path (e.g. on Linux it is set by the contents of the file
@env{LD_LIBRARY_PATH}).
@end enumerate
@vindex LTDL_LIBRARY_PATH
@vindex LD_LIBRARY_PATH
The value of @env{LTDL_LIBRARY_PATH} and @env{LD_LIBRARY_PATH} must be a
colon-separated list of absolute directories, for example,
@samp{"/usr/lib/mypkg:/lib/foo"}.
......@@ -512,8 +531,9 @@ source for the required action NAME is not available
@node Comparators
@section Comparators
@cindex comparator, sieve
@sc{gnu} libsieve supports the following built-in comparators:
GNU libsieve supports the following built-in comparators:
@table @code
@item i;octet
......@@ -531,8 +551,9 @@ be explicitly required prior to use.
@node Tests
@section Tests
@cindex test, sieve
This section describes the built-in tests supported by @sc{gnu} libsieve.
This section describes the built-in tests supported by GNU libsieve.
In the discussion below the following macro-notations are used:
@table @var
......@@ -541,6 +562,8 @@ This tag specifies the matching type to be used with the test. It can
be one of the following:
@table @code
@kwindex :is, sieve
@kwindex is, sieve
@item :is
The @code{:is} match type describes an absolute match; if the contents of
the first string are absolutely the same as the contents of the
......@@ -548,12 +571,16 @@ second string, they match. Only the string ``frobnitzm'' is the string
``frobnitzm''. The null key ``:is'' and only ``:is'' the null value.
This is the default match-type.
@kwindex :contains, sieve
@kwindex contains, sieve
@item :contains
The @code{:contains} match type describes a substring match. If the value
argument contains the key argument as a substring, the match is true.
For instance, the string ``frobnitzm'' contains ``frob'' and ``nit'', but
not ``fbm''. The null key ``'' is contained in all values.
@kwindex :matches, sieve
@kwindex matches, sieve
@item :matches
The @code{:matches} version specifies a wildcard match using the
characters @samp{*} and @samp{?}. @samp{*} matches zero or more
......@@ -562,10 +589,14 @@ characters, and @samp{?} matches a single character. @samp{?} and
against themselves. The first backslash escapes the second backslash;
together, they escape the @samp{*}.
@kwindex :regex, sieve
@kwindex regex, sieve
@item :regex
The @code{:regex} version specifies a match using POSIX Extended Regular
Expressions.
@kwindex :value, sieve
@kwindex value, sieve
@item :value @var{relation}
The @code{:value} match type does a relational comparison between
strings. Valid values for @var{relation} are:
......@@ -590,6 +621,8 @@ Less Than
Less than or Equal
@end table
@kwindex :count, sieve
@kwindex count, sieve
@item :count @var{relation}
This match type first determines the number of the specified entities
(headers, addresses, etc.) in the message and does a relational
......@@ -597,6 +630,8 @@ comparison of the number of entities to the values specified in the
test expression. The test expression must be a list of one element.
@end table
@kwindex :comparator, sieve
@kwindex comparator, sieve
@item comparator
A @var{comparator} syntax item is defined as follows:
......@@ -623,12 +658,18 @@ specifies which part of an address must be used in comparisons.
Exactly one of the following tags may be used:
@table @code
@kwindex :all, sieve
@kwindex all, sieve
@item :all
Use the whole address. This is the default.
@kwindex :localpart, sieve
@kwindex localpart, sieve
@item :localpart
Use local part of the address.
@kwindex :domain, sieve
@kwindex domain, sieve
@item :domain
Use domain part of the address.
@end table
......@@ -651,6 +692,19 @@ comparator `i;ascii-numeric' is incompatible with match type `:matches'
in call to `header'
@end smallexample
GNU Sieve supports two kinds of tests. @dfn{Built-in tests} are
defined within the library and do not require any external files.
@dfn{External tests} are loadable modules that can be linked in at run
time using the @code{require} statement (@pxref{Require Statement}).
@menu
* Built-in Tests::
* External Tests::
@end menu
@node Built-in Tests
@subsection Built-in Tests
@deffn Test false
This test always evaluates to ``false''.
......@@ -661,7 +715,10 @@ This test always evaluates to ``false''.
This test always evaluates to ``true''.
@end deffn
@deffn Test address [@var{address-part}][@var{comparator}][@var{match-type}] @var{header-names} @var{key-list}
@deftypefn Test {} address [@var{address-part}] @
[@var{comparator}] @
[@var{match-type}] @
@var{header-names} @var{key-list}
@noindent
Tagged arguments:
......@@ -677,6 +734,7 @@ Specifies the comparator to be used instead of the default @code{i;ascii-casemap
@item match-type
Specifies the match type to be used instead of the default @code{:is}.
@end table
@noindent
Required arguments:
......@@ -710,13 +768,11 @@ if address :is :all "from" "tim@@example.com"
discard;
@}
@end smallexample
@end deffn
@deffn Test size [:over|:under] @var{number}
@noindent
@end deftypefn
@deftypefn Test {} size [:over | :under] @var{limit}(number)
The @code{size} test deals with the size of a message. The required
argument @var{number} represents the size of the message in bytes. It
argument @var{limit} represents the size of the message in bytes. It
may be suffixed with the following quantifiers:
@table @samp
......@@ -731,20 +787,26 @@ The number is expressed in megabytes.
The number is expressed in gigabytes.
@end table
@kwindex :over
If the tagged argument is @samp{:over}, and the size of the message is greater
than @var{number}, the test is true; otherwise, it is false.
@kwindex :under
If the argument is @samp{:under}, and the size of the message is less than
the @var{number}, the test is true; otherwise, it is false.
Otherwise, the test is true only if the size of the message equals
exactly @var{number}. This is a @sc{gnu} extension.
exactly @var{number}. This is a GNU extension.
The size of a message is defined to be the number of octets from the
initial header until the last character in the message body.
@end deffn
@end deftypefn
@deffn Test envelope [@var{address-part}][@var{comparator}][@var{match-type}] @var{envelope-part} @var{key-list}
@deftypefn Test {} envelope [@var{address-part}] @
[@var{comparator}] @
[@var{match-type}] @
@var{envelope-part}(string-list) @
@var{key-list}(string-list)
@noindent
Tagged arguments:
......@@ -782,9 +844,9 @@ then matching occurs against the FROM address used in the
@emph{Notice}, that due to the limitations imposed by @sc{smtp} envelope
structure the use of any other values in @var{envelope-parts} header is
meaningless.
@end deffn
@end deftypefn
@deffn Test exists @var{header-names}
@deftypefn Test {} exists @var{header-names}(string-list)
@noindent
Required arguments:
......@@ -793,9 +855,9 @@ Required arguments:
@item header-names
List of message header names.
@end table
@sp 1
@noindent
The @code{exists} test is @code{true} if the headers listed in
@var{header-names} argument exist within the message. All of the headers
must exist or the test is false.
......@@ -809,9 +871,13 @@ if not exists ["From","Date"]
discard;
@}
@end smallexample
@end deffn
@end deftypefn
@deffn Test header [@var{comparator}] [@var{match-type}] [:mime] @var{header-names} @var{key-list}
@deftypefn Test {} header [@var{comparator}] @
[@var{match-type}] @
[:mime] @
@var{header-names}(string-list) @
@var{key-list}(string-list)
@sp 1
@noindent
Tagged arguments:
......@@ -823,6 +889,7 @@ Specifies the comparator to be used instead of the default @code{i;ascii-casemap
@item @var{match-type}
Specifies the match type to be used instead of the default @code{:is}.
@kwindex :mime
@item :mime
This tag instructs @code{header} to search through the mime headers in
multipart messages as well.
......@@ -863,10 +930,25 @@ these tests on that header evaluate as follows:
header :is ["X-Caffeine"] [""] @result{} false
header :contains ["X-Caffeine"] [""] @result{} true
@end smallexample
@end deffn
@end deftypefn
@deffn Test numaddr [:over|:under] @var{header-names} @var{number}
@node External Tests
@subsection External Tests
@deftypefn Test {} numaddr [:over | :under] @
@var{header-names}(string-list) @
@var{count}(number)
@noindent
@subsubheading Synopsis
@smallexample
require "test-numaddr";
@dots{}
if numaddr @var{args}
@{
@dots{}
@}
@end smallexample
@subsubheading Description
This test is provided as an example of loadable extension tests. You
must use @samp{require "test-numaddr"} statement before actually using
it.
......@@ -875,19 +957,180 @@ The @code{numaddr} test counts Internet addresses in structured headers
that contain addresses. It returns true if the total number of
addresses satisfies the requested relation.
@kwindex :over
If the tagged argument is @samp{:over} and the number of addresses is
greater than @var{number}, the test is true; otherwise, it is false.
greater than @var{count}, the test is true; otherwise, it is false.
@kwindex :under
If the tagged argument is @samp{:under} and the number of addresses is
less than @var{number}, the test is true; otherwise, it is false.
less than @var{count}, the test is true; otherwise, it is false.
If the tagged argument is not given, @samp{:over} is assumed.
@end deffn
@end deftypefn
@deftypefn Test {} spamd [:host @var{tcp-host}(string)] @
[:port @var{tcp-port}(number)] @
[:socket @var{unix-socket}(string)] @
[:user @var{name}(string)] @
[:over | :under @var{limit}(string)]
@subsubheading Synopsis
@smallexample
require "test-spamd";
@dots{}
if spamd @var{args}
@{
# @r{This is spam}
@dots{}
@}
@end smallexample
@subsubheading Description
This test is an interface to SpamAssassin filter. It connects to the
@command{spamd} daemon using connection parameters specified by tagged
arguments @code{:host} and @code{:port} (if the daemon is listening on
an INET socket), or @code{:socket} (if the daemon is listening on a
UNIX socket) and returns true, if SpamAssassin qualifies the message
as spam. Tagged argument @var{limit} alters the default behavior. Its
value is a string representation of a floating point number. If
the tag @code{:over} is used, then the test returns true if the spam
score returned from SpamAssassin is greater than @var{limit}.
Otherwise, if @code{:under} is used, the test returns true if the spam
score is less than @var{limit}. The comparison takes into account
three decimal digits.
Tagged argument @code{:user} allows to select a specific user profile.
If it is not given, the user name is determined using the effective
UID.
Before returning, the @code{spamd} test adds the following headers to
the message:
@table @asis
@item X-Spamd-Status
@samp{YES} or @samp{NO}, depending on whether the message is qualified
as spam or ham.
@item X-Spamd-Score
Actual spam score value.
@item X-Spamd-Threshold
Spam score threshold, as configured in SpamAssassin settings.
@item X-Spamd-Keywords
Comma-separated list of keywords, describing the spam checks that
succeeded for this message.
@end table
@subsubheading Example
@smallexample
request "test-spamd";
if spamd :host 127.0.0.1 :port 3333
@{
discard;
@}
@end smallexample
@end deftypefn
@deftypefn Test {} list [@var{comparator}] [@var{match-type}] @
[ :delim @var{delimiters}(string) ] @
@var{headers}(string-list) @var{keys}(string-list)
@subsubheading Synopsis
@smallexample
require "test-list";
if list @var{args}
@{
@dots{}
@}
@end smallexample
@subsubheading Description
The @code{list} test evaluates to true if any of @var{headers} match any
key from @var{keys}. Each header is regarded as containing a list of
keywords. By default, comma is assumed as list separator. This can be
overridden by specifying the @code{:delim} tag, whose value is a
string consisting of valid list delimiter characters.
@subsubheading Example
This test can be used in conjunction with the @code{spamd} test
described above:
@smallexample
require ["fileinto", "test-spamd", "test-list"];
if spamd :host 127.0.0.1 :port 3333
@{
if list :matches :delim " ,"
"X-Spamd-Keywords" [ "HTML_*", "FORGED_*" ]
@{
fileinto "~/mail/spam";
@}
else
@{
discard;
@}
@}
@end smallexample
@end deftypefn
@deftypefn Test {} timestamp [:before | :after] @
@var{header}(string) @var{date}(string)
@subsubheading Synopsis
@smallexample
require "test-timestamp";
if timestamp @var{arg}
@{
@dots{}
@}
@end smallexample
@subsubheading Description
The @code{timestamp} test compares the value of a structured date header
field (@var{header}) with the given date (@var{date}).
If the tagged argument is @code{:after} and the date from the header is
after the specified date the result is true, otherwise, if the header
date is before the given date, the result is false.
If the tagged argument is @code{:before} and the date from the header is
before the specified date the result is true, otherwise, if the header
date is after the given date, the result is false.
If no tagged argument is supplied, @code{:after} is assumed.
Almost any date format is understood. @xref{Date Input Formats}, for
a detailed information on date formats.
@subsubheading Example
The test below succeeds if the date in @samp{X-Expire-Timestamp}
header is more than 5 days older than the current date:
@smallexample
require "test-timestamp";
if timestamp :before "X-Expire-Timestamp" "now - 5 days"
@{
discard;
@}
@end smallexample
@end deftypefn
@node Actions
@section Actions
There are two groups of GNU Sieve actions: @dfn{built-in actions},
which are defined within the library, and @dfn{external actions}, i.e.
loadable modules that can be linked in at run time using the
@code{require} statement (@pxref{Require Statement}).
@menu
* Built-in Actions::
* External Actions::
@end menu
The @sc{gnu} libsieve supports the following default actions:
@node Built-in Actions
@subsection Built-in Actions
The GNU libsieve supports the following built-in actions:
@itemize
@item stop
......@@ -929,6 +1172,7 @@ if header :contains ["from"] ["idiot@@example.edu"]
@end smallexample
@end deffn
@anchor{fileinto}
@deffn Action fileinto [:permissions @var{mode}] @var{folder}
@noindent
......@@ -1056,7 +1300,8 @@ coyote@@desert.example.org.
Message was refused by recipient's mail filtering program.
Reason given was as follows:
I am not taking mail from you, and I don't want your birdseed, either!
I am not taking mail from you, and I don't want your
birdseed, either!
----- =_aaaaaaaaaa0
Content-Type: message/delivery-status
......@@ -1098,8 +1343,6 @@ if header :mime :matches "Content-Type"
@end deffn
@deffn Action redirect @var{address}
@noindent
The @code{redirect} action is used to send the message to another user at
a supplied @var{address}, as a mail forwarding feature does. This action
makes no changes to the message body or existing headers, but it may add
......@@ -1114,10 +1357,155 @@ creates a new message with a different sender and message ID, wrapping
the old message in a new one.
@end deffn
@node External Actions
@subsection External Actions
@UNREVISED
GNU Mailutils is shipped with a set of external Sieve
actions. These actions are compiled as loadable modules and must be
required prior to use (@pxref{Require Statement}).
@deftypefn Action {} moderator [:keep] [:address @var{address}(string)] @
[:source @var{sieve-file}(string)]
@subsubheading Synopsis
@smallexample
require "moderator"
moderator @var{args};
@end smallexample
@subsubheading Description
@cindex mailman
This action is a moderator robot for Mailman-driven mail archives.
A Mailman moderation request is a MIME message consisting of the
following three parts:
@multitable @columnfractions 0.2 0.4 0.4
@headitem N @tab Content-Type @tab Description
@item 1 @tab text/plain @tab Introduction for the human reader.
@item 2 @tab message/rfc822 @tab Original submission.
@item 3 @tab message/rfc822 @tab Mailman control message.
@end multitable
Replying to part 3 (keeping the subject intact) instructs Mailman to
discard the original submission.
Replying to part 3 while adding an `Approved:' header with the list
password in it approves the submission.
The @code{moderator} action spawns an inferior Sieve machine and
filters the original submission (part 2) through it. If the inferior
machine marks the message as deleted, the action replies to the
control message, thereby causing the submission to be discarded. The
@samp{From:} address of the reply can be modified using
@code{:address} tag. After discarding the message, @code{moderator}
marks it as deleted, unless it is given @code{:keep} tag.
The argument of @code{:source} tag, if given, specifies the Sieve
source file to be used on the message. If @code{:tag} is not present,
@code{moderator} will create and use a copy of the existing Sieve machine.
The action checks the message structure: it will bail out if the message
does not have exactly 3 MIME parts, or if parts 2 and 3 are not of
@samp{message/rfc822} type. It is the responsibility of the caller to
make sure the message is actually a valid Mailman moderation request
(see the example below).
@subsubheading Example
@smallexample
if allof(header :is "Sender" "mailman-bounces@@gnu.org",
header :is "X-List-Administrivia" "yes")
@{
moderator :source "~/.sieve/mailman.sv";
@}
@end smallexample
@end deftypefn
@deftypefn Action {} pipe [:envelope] @var{command}(string)
@subsubheading Synopsis
@smallexample
require "pipe";
if pipe @var{args}
@{
@dots{}
@}
@end smallexample
@subsubheading Description
The @code{pipe} action sends executes a command specified by its
argument and sends the entire message to its standard input. The
@var{command} argument supplies the command line.
The envelope of the message is included, if the @code{:envelope} tag
is given.
@subsubheading Example
The example below uses the @command{maidag} utility
(@FIXME-pxref{maidag}) to forward the message to user @samp{gray} on
the machine @samp{mail.gnu.org}.
@smallexample
require "pipe";
pipe "/usr/sbin/maidag --url smtp://gray@@mail.gnu.org"
@end smallexample
@end deftypefn
@deftypefn Action {} vacation [:days @var{ndays}(number)] @
[:subject @var{subject}(string)] @
[:aliases @var{addrlist}(string-list)] @
[:addresses @var{noreply-address}(string-list)] @
[:reply_regex @var{expr}(string)] @
[:reply_prefix @var{prefix}(string)] @
@var{reply-text}(string)
@subsubheading Syntax
@smallexample
require "vacation";
vacation @var{args};
@end smallexample
@subsubheading Description
The @code{vacation} action returns a message with @var{reply-text} to
the sender. It is intended to inform the sender that the recipient is
not currently reading his mail.
If the @code{:subject} tag is given, its argument sets the subject of
the message. Otherwise, the subject is formed by prefixing original
subject with @samp{Re:}, or @var{prefix}, given with the
@code{:reply_prefix} tag. Before prefixing, any original prefixes
matching extended regular expression @var{expr} (@code{:reply_regex}
tag) are stripped from the subject line. If @code{:reply_regex} is not
specified, the default regexp is @samp{^re: *}.
The @code{:aliases} tag instructs @code{vacation} to handle messages
for any address in @var{addrlist} in the same manner as those received
for the user's principal email.
Before processing, @code{vacation} compares the sender address with
its @dfn{address exclusion list}. Elements of this list are extended
case-insensitive regular expressions. If the sender address matches
any of these expressions, the message will not be replied. The default
exclusion list is:
@smallexample
.*-REQUEST@@.*
.*-RELAY@@.*
.*-OWNER@@.*
^OWNER-.*
^postmaster@@.*
^UUCP@@.*
^MAILER@@.*
^MAILER-DAEMON@@.*
@end smallexample
New entries can be added to this list using @code{:addresses} tag.
The @code{:days} tag sets the @dfn{reply interval}. A reply is sent to
each sender once in @var{ndays} days. GNU Sieve keeps track of
sender addresses and dates in a DBM file @file{.vacation} stored in
the user's home directory. This tag is available only if Mailutils is
compiled with DBM support.
@end deftypefn
@node GNU Extensions
@section GNU Extensions
This section summarizes the @sc{gnu} extensions to the sieve language
This section summarizes the GNU extensions to the sieve language
@enumerate 1
@item Multiline strings syntax
......@@ -1143,7 +1531,7 @@ be performed within a string.
@itemize
@item According to the RFC an error must occur if a @code{require} appears
after a command other than @code{require}. The @sc{gnu} sieve library allows
after a command other than @code{require}. The GNU sieve library allows
interspersing the @code{require} and other statements. The only
requirement is that @code{require} must occur before a statement that is
using the required capability (@pxref{Require Statement}).
......@@ -1168,10 +1556,15 @@ The only value that can be meaningfully used as the first required
argument of an @code{envelope} test is @samp{from}. This limitation
may disappear from the subsequent releases.
@item @code{fileinto} action
The @code{fileinto} action allows to specify permissons on the mailbox,
in case it is created (@pxref{fileinto}).
@item Match type optional argument.
Along with the usual @code{:is}, @code{:matches} and @code{contains}
matching type, @sc{gnu} sieve library understands @code{:regex} type. This
matching type, GNU sieve library understands @code{:regex} type. This
matching type toggles POSIX Extended Regular Expression matching.
@end enumerate
......
......@@ -80,9 +80,9 @@ main (int argc, char **argv)
/* Registration. */
mu_registrar_record (mu_imap_record);
mu_registrar_record (mu_mbox_record);
mu_registrar_record (mu_path_record);
mu_registrar_record (mu_pop_record);
mu_registrar_record (mu_mbox_record);
mu_registrar_set_default_record (mu_mbox_record);
MU_ASSERT (mu_mailbox_create_default (&mbox, mailbox_name));
......
......@@ -250,9 +250,10 @@ make_tmp (FILE *input, const char *from, char **tempfile)
void
register_handlers ()
{
mu_registrar_record (mu_path_record);
mu_registrar_record (mu_mbox_record);
mu_registrar_record (mu_sendmail_record);
mu_registrar_record (mu_smtp_record);
mu_registrar_set_default_record (mu_mbox_record);
}
int
......
......@@ -27,7 +27,7 @@ debug.h: $(top_srcdir)/scripts/debugdef.m4 debug.hm4
m4 $(top_srcdir)/scripts/debugdef.m4 debug.hm4 > debug.h
types.h: $(top_srcdir)/include/mailutils/types.hin Makefile
sed 's/MU_OFF_TYPE/$(MU_OFF_TYPE)/' $(top_srcdir)/include/mailutils/types.hin > $@
sed 's/_MU_OFF_TYPE_/$(MU_OFF_TYPE)/;s/_MU_DEFAULT_RECORD_/$(MU_DEFAULT_RECORD)/' $(top_srcdir)/include/mailutils/types.hin > $@
DISTCLEANFILES = types.h
pkginclude_DATA = types.h
......
......@@ -35,10 +35,6 @@ const char *mu_mailbox_url (void);
const char *mu_folder_directory (void);
int mu_construct_user_mailbox_url (char **pout, const char *name);
/* Default mailbox protocol */
int mu_mailbox_set_default_proto (const char *proto);
const char *mu_mailbox_get_default_proto (void);
/* Constructor/destructor and possible types. */
extern int mu_mailbox_create (mu_mailbox_t *, const char *);
extern int mu_mailbox_create_from_url (mu_mailbox_t *, mu_url_t);
......
......@@ -47,10 +47,19 @@ struct _mu_record
int (*_list_p) (mu_record_t, const char *, int);
};
/* Defaults */
extern int mu_registrar_set_default_scheme (const char *scheme);
extern const char *mu_registrar_get_default_scheme (void);
extern int mu_registrar_get_default_record (mu_record_t *prec);
extern void mu_registrar_set_default_record (mu_record_t record);
/* Registration. */
extern int mu_registrar_get_iterator (mu_iterator_t *);
extern int mu_registrar_get_list (mu_list_t *) __attribute__ ((deprecated));
extern int mu_registrar_lookup_scheme (const char *scheme,
mu_record_t *precord);
extern int mu_registrar_lookup (const char *name, int flags,
mu_record_t *precord, int *pflags);
extern int mu_registrar_lookup_url (mu_url_t url, int flags,
......@@ -101,8 +110,6 @@ extern mu_record_t mu_nntp_record;
/* Local Mailbox Unix Mailbox, "mbox:" */
extern mu_record_t mu_mbox_record;
/* Local Folder/Mailbox, / */
extern mu_record_t mu_path_record;
/* Local MH, "mh:" */
extern mu_record_t mu_mh_record;
/* Maildir, "maildir:" */
......@@ -131,7 +138,6 @@ extern mu_record_t mu_sendmail_record;
extern mu_record_t mu_prog_record;
#define mu_register_all_mbox_formats() do {\
mu_registrar_record (mu_path_record);\
mu_registrar_record (mu_mbox_record);\
mu_registrar_record (mu_pop_record);\
mu_registrar_record (mu_pops_record);\
......@@ -139,13 +145,14 @@ extern mu_record_t mu_prog_record;
mu_registrar_record (mu_imaps_record);\
mu_registrar_record (mu_mh_record);\
mu_registrar_record (mu_maildir_record);\
mu_registrar_set_default_record (MU_DEFAULT_RECORD);\
} while (0)
#define mu_register_local_mbox_formats() do {\
mu_registrar_record (mu_path_record);\
mu_registrar_record (mu_mbox_record);\
mu_registrar_record (mu_mh_record);\
mu_registrar_record (mu_maildir_record);\
mu_registrar_set_default_record (MU_DEFAULT_RECORD);\
} while (0)
#define mu_register_remote_mbox_formats() do {\
......
......@@ -71,7 +71,7 @@ struct _mu_acl;
struct _mu_server;
struct _mu_tcp_server;
typedef MU_OFF_TYPE mu_off_t;
typedef _MU_OFF_TYPE_ mu_off_t;
typedef struct _mu_address *mu_address_t;
typedef struct _mu_attribute *mu_attribute_t;
......@@ -122,6 +122,8 @@ typedef struct _mu_progmailer *mu_progmailer_t;
#define mu_offsetof(s,f) ((size_t)&((s*)0)->f)
#define MU_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
#define MU_DEFAULT_RECORD _MU_DEFAULT_RECORD_
#ifdef __cplusplus
}
#endif
......
......@@ -219,5 +219,6 @@ mu_scm_init ()
mu_scm_mime_init ();
#include "mu_scm.x"
mu_registrar_record (mu_path_record);
mu_registrar_record (MU_DEFAULT_RECORD);
mu_registrar_set_default_record (MU_DEFAULT_RECORD);
}
......
......@@ -46,30 +46,14 @@
/* We export url parsing and the initialisation of
the mailbox, via the register entry/record. */
static struct _mu_record _mbox_record =
{
MU_MBOX_PRIO,
MU_MBOX_SCHEME,
mu_url_expand_path, /* URL init. */
_mailbox_mbox_init, /* Mailbox init. */
NULL, /* Mailer init. */
_folder_mbox_init, /* Folder init. */
NULL, /* No need for an back pointer. */
NULL, /* _is_scheme method. */
NULL, /* _get_url method. */
NULL, /* _get_mailbox method. */
NULL, /* _get_mailer method. */
NULL /* _get_folder method. */
};
mu_record_t mu_mbox_record = &_mbox_record;
static int
_path_is_scheme (mu_record_t record, mu_url_t url, int flags)
_mbox_is_scheme (mu_record_t record, mu_url_t url, int flags)
{
int rc = 0;
if (url && record->scheme)
{
if (mu_url_is_scheme (url, record->scheme))
return MU_FOLDER_ATTRIBUTE_FILE & flags;
if (mu_scheme_autodetect_p (url))
{
struct stat st;
......@@ -77,11 +61,7 @@ _path_is_scheme (mu_record_t record, mu_url_t url, int flags)
mu_url_sget_path (url, &path);
if (stat (path, &st) < 0)
{
if (errno == ENOENT)
rc |= MU_FOLDER_ATTRIBUTE_FILE;
return rc;
}
return 0;
if (S_ISREG (st.st_mode) || S_ISCHR (st.st_mode))
{
......@@ -114,26 +94,25 @@ _path_is_scheme (mu_record_t record, mu_url_t url, int flags)
&& S_ISDIR (st.st_mode))
rc |= MU_FOLDER_ATTRIBUTE_DIRECTORY;
}
}
return rc;
}
static struct _mu_record _path_record =
static struct _mu_record _mbox_record =
{
MU_PATH_PRIO,
MU_PATH_SCHEME,
NULL, /* URL init. */
MU_MBOX_PRIO,
MU_MBOX_SCHEME,
mu_url_expand_path, /* URL init. */
_mailbox_mbox_init, /* Mailbox init. */
NULL, /* Mailer init. */
_folder_mbox_init, /* Folder init. */
NULL, /* No need for an owner. */
_path_is_scheme, /* is_scheme method. */
NULL, /* get_url method. */
NULL, /* get_mailbox method. */
NULL, /* get_mailer method. */
NULL /* get_folder method. */
NULL, /* No need for an back pointer. */
_mbox_is_scheme, /* _is_scheme method. */
NULL, /* _get_url method. */
NULL, /* _get_mailbox method. */
NULL, /* _get_mailer method. */
NULL /* _get_folder method. */
};
mu_record_t mu_path_record = &_path_record;
mu_record_t mu_mbox_record = &_mbox_record;
/* lsub/subscribe/unsubscribe are not needed. */
static void folder_mbox_destroy (mu_folder_t);
......
......@@ -533,7 +533,7 @@ perms_tag_checker (const char *name, mu_list_t tags, mu_list_t args)
mu_iterator_next (itr))
{
int flag;
char *p;
const char *p;
mu_sieve_runtime_tag_t *t;
mu_iterator_current (itr, (void **)&t);
if (strcmp (t->tag, "permissions") == 0)
......
......@@ -16,7 +16,11 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
/* Syntax: pipe [:envelope] <program call: string>
/* Syntax: pipe [:envelope] <program: string>
The pipe action executes a shell command specified by its
argument and pipes the entire message to its standard input.
The envelope of the message is included, if the :envelope tag is given.
Notes/FIXME: 1. it would be nice to implement meta-variables in
<program call> which would expand to various
......
......@@ -232,7 +232,7 @@ sigpipe_handler (int sig MU_ARG_UNUSED)
/* The test proper */
/* Syntax: spamd [":host" <tcp-host: string]
/* Syntax: spamd [":host" <tcp-host: string>]
[":port" <tcp-port: number> /
":socket" <unix-socket: string>]
[":user" <name: string>]
......
......@@ -23,7 +23,7 @@
[:reply_regex <expr: string>]
[:reply_prefix <prefix: string>]
<reply text: string>
*/
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -32,6 +32,7 @@
#include <mailutils/nls.h>
#include <mailutils/debug.h>
#include <mailutils/syslog.h>
#include <mailutils/registrar.h>
#include <syslog.h>
int mu_load_user_rcfile = 1;
......@@ -73,7 +74,7 @@ mu_gocs_mailbox_init (void *data)
}
if (p->mailbox_type)
{
if (mu_mailbox_set_default_proto (p->mailbox_type))
if (mu_registrar_set_default_scheme (p->mailbox_type))
mu_error (_("Invalid mailbox type: %s"), p->mailbox_type);
free (p->mailbox_type);
p->mailbox_type = NULL;
......
......@@ -77,44 +77,6 @@ mailbox_folder_create (mu_mailbox_t mbox, const char *name,
return rc;
}
static char *default_proto;
int
mu_mailbox_set_default_proto (const char *proto)
{
char *p;
size_t len = strlen (proto);
if (proto [len - 1] == ':')
{
p = strdup (proto);
if (!p)
return ENOMEM;
}
else
{
p = malloc (len + 2);
if (!p)
return ENOMEM;
strcpy (p, proto);
p[len] = ':';
p[len+1] = 0;
}
if (mu_registrar_lookup (p, MU_FOLDER_ATTRIBUTE_FILE, NULL, NULL))
return MU_ERR_NO_HANDLER;
if (default_proto)
free (default_proto);
default_proto = p;
return 0;
}
const char *
mu_mailbox_get_default_proto ()
{
return default_proto ? default_proto : "/";
}
static int
_create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name)
{
......@@ -235,22 +197,10 @@ _create_mailbox (mu_mailbox_t *pmbox, const char *name)
int
mu_mailbox_create (mu_mailbox_t *pmbox, const char *name)
{
int rc;
if (pmbox == NULL)
return MU_ERR_OUT_PTR_NULL;
if (!mu_is_proto (name) && default_proto)
{
char *tmp_name = malloc (strlen (default_proto) + strlen (name) + 1);
strcpy (tmp_name, default_proto);
strcat (tmp_name, name);
rc = _create_mailbox (pmbox, tmp_name);
free (tmp_name);
}
else
rc = _create_mailbox (pmbox, name);
return rc;
return _create_mailbox (pmbox, name);
}
int
......
......@@ -35,7 +35,7 @@
#include <mailutils/nls.h>
#include <mailutils/error.h>
#include <mailutils/url.h>
#include <mailutils/mutil.h>
#include <registrar0.h>
/* NOTE: We will leak here since the monitor and the registrar will never
......@@ -43,6 +43,44 @@
static mu_list_t registrar_list;
struct mu_monitor registrar_monitor = MU_MONITOR_INITIALIZER;
static mu_record_t mu_default_record;
void
mu_registrar_set_default_record (mu_record_t record)
{
mu_default_record = record;
}
int
mu_registrar_get_default_record (mu_record_t *prec)
{
if (mu_default_record)
{
if (prec)
*prec = mu_default_record;
return 0;
}
return MU_ERR_NOENT;
}
int
mu_registrar_set_default_scheme (const char *scheme)
{
int status;
mu_record_t rec;
status = mu_registrar_lookup_scheme (scheme, &rec);
if (status == 0)
mu_default_record = rec;
return status;
}
const char *
mu_registrar_get_default_scheme ()
{
return mu_default_record ? mu_default_record->scheme : NULL;
}
static int
_registrar_get_list (mu_list_t *plist)
{
......@@ -91,6 +129,34 @@ mu_registrar_get_iterator (mu_iterator_t *pitr)
}
int
mu_registrar_lookup_scheme (const char *scheme, mu_record_t *precord)
{
size_t len;
mu_iterator_t iterator;
int status = mu_registrar_get_iterator (&iterator);
if (status != 0)
return status;
status = MU_ERR_NOENT;
len = strcspn (scheme, ":");
for (mu_iterator_first (iterator); !mu_iterator_is_done (iterator);
mu_iterator_next (iterator))
{
mu_record_t record;
mu_iterator_current (iterator, (void **)&record);
if (strlen (record->scheme) == len
&& memcmp (record->scheme, scheme, len) == 0)
{
if (precord)
*precord = record;
status = 0;
break;
}
}
mu_iterator_destroy (&iterator);
return status;
}
int
mu_registrar_lookup_url (mu_url_t url, int flags,
mu_record_t *precord, int *pflags)
{
......@@ -116,6 +182,17 @@ mu_registrar_lookup_url (mu_url_t url, int flags,
}
}
mu_iterator_destroy (&iterator);
if (status &&
/*s FIXME: This check is not enough. */
!mu_is_proto (mu_url_to_string (url))
&& mu_registrar_get_default_record (precord) == 0)
{
status = 0;
if (pflags)
*pflags = flags & MU_FOLDER_ATTRIBUTE_FILE; /* FIXME? */
}
return status;
}
......
......@@ -47,6 +47,7 @@ static struct mu_conf_option mu_conf_option[] = {
{ "VERSION=" VERSION, N_("Version of this package") },
{ "SYSCONFDIR=" SYSCONFDIR, N_("System configuration directory") },
{ "MAILSPOOLDIR=" MU_PATH_MAILDIR, N_("Default mail spool directory") },
{ "SCHEME=" MU_DEFAULT_SCHEME, N_("Default mailbox type") },
{ "LOG_FACILITY=" LOG_FACILITY_STRING, N_("Default syslog facility") },
#ifdef USE_LIBPAM
{ "USE_LIBPAM", N_("PAM support") },
......