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
1 2008-11-09 Sergey Poznyakoff <gray@gnu.org.ua>
2
3 Rewrite default mailbox format support to make sure it does not
4 break format autodetection. Improve the docs.
5
6 * configure.ac (MU_DEFAULT_SCHEME): New configuration variable.
7 * mailbox/version.c (mu_conf_opt): Include default scheme.
8
9 * examples/mimetest.c, examples/mta.c, libmu_scm/mu_scm.c: Remove
10 mu_path_record. Use mu_registrar_set_default_record.
11
12 * libproto/mbox/folder.c (_path_is_scheme): Rename to
13 _mbox_is_scheme. Minor changes as well.
14 (_path_record, mu_path_record): Removed.
15 (_mbox_record): Use _mbox_is_scheme.
16
17 * libsieve/actions.c: Remove unused variable.
18
19 * include/mailutils/Makefile.am (types.h rule): Replace
20 _MU_DEFAULT_RECORD_. Change MU_OFF_TYPE replacement pattern to
21 _MU_OFF_TYPE_.
22
23 * include/mailutils/mailbox.h (mu_mailbox_set_default_proto)
24 (mu_mailbox_get_default_proto): Remove. See below.
25 * include/mailutils/registrar.h (mu_registrar_set_default_scheme)
26 (mu_registrar_get_default_scheme)
27 (mu_registrar_get_default_record)
28 (mu_registrar_set_default_record)
29 (mu_registrar_lookup_scheme): New prototypes.
30 (mu_path_record): Remove.
31 (mu_register_all_mbox_formats): Remove mu_path_record.
32 Set default scheme using mu_registrar_set_default_record.
33 (mu_register_local_mbox_formats): Likewise.
34 * include/mailutils/types.hin (MU_OFF_TYPE): Rename to
35 _MU_OFF_TYPE_.
36 (MU_DEFAULT_RECORD): New define.
37
38 * mailbox/mailbox.c (mu_mailbox_set_default_proto)
39 (mu_mailbox_get_default_proto): Remove.
40 (mu_mailbox_create): Remove default_proto kludge. mu_registrar
41 stuff is responsible for finding the correct record.
42 * mailbox/registrar.c (mu_registrar_set_default_record)
43 (mu_registrar_get_default_record)
44 (mu_registrar_set_default_scheme)
45 (mu_registrar_get_default_scheme)
46 (mu_registrar_lookup_scheme): New functions.
47 (mu_registrar_lookup_url): Fall back to default record if no
48 matching record is found and the URL was not set explicitly
49 (i.e. does not begin with a scheme).
50
51 * mailbox/gocs.c: Use mu_registrar_set_default_scheme instead of
52 mu_mailbox_set_default_proto.
53 * libsieve/extensions/pipe.c, libsieve/extensions/spamd.c,
54 libsieve/extensions/vacation.c: Fix comments.
55
56 * doc/texinfo/getdate.texi: New file (from gnulib).
57 * doc/texinfo/Makefile.am (mailutils_TEXINFOS): Add getdate.texi
58 (fix-sentence-spacing): New rule. Forces single-space
59 inter-sentence spacing.
60 (check-tabs, check-sentence-spacing): New rules.
61 (check-format): Depend on the above two.
62 (check-refs, check-fixmes, check-unrevised): Fix copy-paste
63 errors. Print diagnostics to stderr.
64
65 * doc/texinfo/auth.texi, doc/texinfo/fdl.texi,
66 doc/texinfo/framework.texi, doc/texinfo/imap4.texi,
67 doc/texinfo/libmuauth.texi, doc/texinfo/mailbox.texi,
68 doc/texinfo/mailcap.texi, doc/texinfo/mailutils.texi,
69 doc/texinfo/mbox.texi, doc/texinfo/message.texi,
70 doc/texinfo/mom.texi, doc/texinfo/mu_message.texi,
71 doc/texinfo/mu_mime.texi, doc/texinfo/mu_scm.texi,
72 doc/texinfo/muint.texi, doc/texinfo/pop3.texi,
73 doc/texinfo/rendition.texi, doc/texinfo/sieve.texi,
74 doc/texinfo/url.texi, doc/texinfo/usage.texi: Use GNU instead of
75 @sc{gnu}, because latter looks awful when typeset (especially when
76 followed by a capitalized word). Fix format by running `make final'.
77
78 * doc/texinfo/programs.texi: Document more config statements.
79 * doc/texinfo/libsieve.texi: Document loadable actions and tests.
80
1 2008-11-07 Sergey Poznyakoff <gray@gnu.org.ua> 81 2008-11-07 Sergey Poznyakoff <gray@gnu.org.ua>
2 82
3 Bugfix 83 Bugfix
......
...@@ -1095,6 +1095,29 @@ if test "$EMACS" != "no"; then ...@@ -1095,6 +1095,29 @@ if test "$EMACS" != "no"; then
1095 fi 1095 fi
1096 AC_SUBST(lisp_LISP) 1096 AC_SUBST(lisp_LISP)
1097 1097
1098 # Default mailbox record
1099 # Note: 1. Support for mbox type is always enabled.
1100 # 2. Only local mailbox types are allowed for MU_DEFAULT_SCHEME
1101 AC_ARG_VAR([MU_DEFAULT_SCHEME],
1102 [Default mailbox record. Allowed values are: mbox (default), mh, and maildir.])
1103 if test -z "$MU_DEFAULT_SCHEME"; then
1104 MU_DEFAULT_SCHEME=mbox
1105 fi
1106 case $MU_DEFAULT_SCHEME in
1107 mbox)
1108 ;;
1109 mh|maildir)
1110 eval testval=\$mu_cv_enable_$MU_DEFAULT_SCHEME
1111 if test "$testval" != yes; then
1112 AC_MSG_ERROR([Cannot set default mailbox record type: support for $MU_DEFAULT_SCHEME is disabled])
1113 fi
1114 ;;
1115 *) AC_MSG_ERROR([Unknown or not allowed mailbox scheme: $MU_DEFAULT_SCHEME]);;
1116 esac
1117 AC_DEFINE_UNQUOTED(MU_DEFAULT_SCHEME, "$MU_DEFAULT_SCHEME",
1118 [Default mailbox scheme.])
1119 AC_SUBST(MU_DEFAULT_RECORD,mu_${MU_DEFAULT_SCHEME}_record)
1120
1098 AC_ARG_VAR([DEFAULT_CUPS_CONFDIR], 1121 AC_ARG_VAR([DEFAULT_CUPS_CONFDIR],
1099 [Set the location of CUPS configuration directory. Default is \$sysconfdir/cups]) 1122 [Set the location of CUPS configuration directory. Default is \$sysconfdir/cups])
1100 1123
...@@ -1134,6 +1157,7 @@ cat <<EOF ...@@ -1134,6 +1157,7 @@ cat <<EOF
1134 ******************************************************************* 1157 *******************************************************************
1135 GNU Mailutils configured with the following settings: 1158 GNU Mailutils configured with the following settings:
1136 1159
1160 Default mailbox scheme......... $status_scheme
1137 Use PAM........................ $status_pam 1161 Use PAM........................ $status_pam
1138 Use -ltdl...................... $status_ltdl 1162 Use -ltdl...................... $status_ltdl
1139 Use DBM........................ $status_dbm 1163 Use DBM........................ $status_dbm
...@@ -1168,7 +1192,8 @@ Sendmail....................... $status_sendmail ...@@ -1168,7 +1192,8 @@ Sendmail....................... $status_sendmail
1168 Before proceeding, verify if these satisfy your requirements. 1192 Before proceeding, verify if these satisfy your requirements.
1169 EOF 1193 EOF
1170 ], 1194 ],
1171 [status_pam=$status_pam 1195 [status_scheme=$MU_DEFAULT_SCHEME
1196 status_pam=$status_pam
1172 status_ltdl=$status_ltdl 1197 status_ltdl=$status_ltdl
1173 status_dbm="$status_dbm" 1198 status_dbm="$status_dbm"
1174 status_ldap=$status_ldap 1199 status_ldap=$status_ldap
......
...@@ -41,6 +41,7 @@ mailutils_TEXINFOS = \ ...@@ -41,6 +41,7 @@ mailutils_TEXINFOS = \
41 fdl.texi\ 41 fdl.texi\
42 folder.texi\ 42 folder.texi\
43 framework.texi\ 43 framework.texi\
44 getdate.texi\
44 headers.texi\ 45 headers.texi\
45 imap4.texi\ 46 imap4.texi\
46 iterator.texi\ 47 iterator.texi\
...@@ -115,40 +116,57 @@ master-menu: ...@@ -115,40 +116,57 @@ master-menu:
115 untabify: 116 untabify:
116 emacs -batch -l untabify.el $(info_TEXINFOS) $(mailutils_TEXINFOS) 117 emacs -batch -l untabify.el $(info_TEXINFOS) $(mailutils_TEXINFOS)
117 118
119 fix-sentence-spacing:
120 for file in $(info_TEXINFOS) $(mailutils_TEXINFOS); \
121 do \
122 if grep -q '\. [@A-Z]' $$file; then \
123 mv $$file $${file}~; \
124 sed -r 's/\. ([@A-Z])/. \1/g' $${file}~ > $$file; \
125 fi; \
126 done
127
118 final: untabify master-menu 128 final: untabify master-menu
119 129
120 130
121 # Checks 131 # Checks
122 check-format: 132 check-tabs:
123 @if test -n "`cat $(info_TEXINFOS) $(mailutils_TEXINFOS) |\ 133 @if test -n "`cat $(info_TEXINFOS) $(mailutils_TEXINFOS) |\
124 tr -d -c '\t'`"; then \ 134 tr -d -c '\t'`"; then \
125 echo "Sources contain tabs; run make untabify"; \ 135 echo >&2 "Sources contain tabs; run make untabify"; \
126 false; \ 136 false; \
127 fi 137 fi
128 138
139 check-sentence-spacing:
140 @if grep -q '\. [@A-Z]' $(info_TEXINFOS) $(mailutils_TEXINFOS); then \
141 echo >&2 "Sources contain double-space sentence separators"; \
142 echo >&2 "Run make fix-sentence-spacing to fix"; \
143 fi
144
145 check-format: check-tabs check-sentence-spacing
146
129 check-refs: 147 check-refs:
130 @for file in $(info_TEXINFOS) $(dico_TEXINFOS); \ 148 @for file in $(info_TEXINFOS) $(mailutils_TEXINFOS); \
131 do \ 149 do \
132 sed -e = $$file | \ 150 sed -e = $$file | \
133 sed -n 'N;/@FIXME-.*ref/{s/\(^[0-9][0-9]*\).*@FIXME-.*ref{\([^}]*\)}.*/'$$file':\1: \2/gp}'; \ 151 sed -n 'N;/@FIXME-.*ref/{s/\(^[0-9][0-9]*\).*@FIXME-.*ref{\([^}]*\)}.*/'$$file':\1: \2/gp}'; \
134 done > $@-t; \ 152 done > $@-t; \
135 if [ -s $@-t ]; then \ 153 if [ -s $@-t ]; then \
136 echo "Unresolved cross-references:"; \ 154 echo >&2 "Unresolved cross-references:"; \
137 cat $@-t;\ 155 cat $@-t >&2;\
138 rm $@-t; \ 156 rm $@-t; \
139 else \ 157 else \
140 rm -f $@-t; \ 158 rm -f $@-t; \
141 fi 159 fi
142 160
143 check-fixmes: 161 check-fixmes:
144 @for file in $(info_TEXINFOS); \ 162 @for file in $(info_TEXINFOS) $(mailutils_TEXINFOS); \
145 do \ 163 do \
146 sed -e = $$file | \ 164 sed -e = $$file | \
147 sed -n 'N;/@FIXME{/{s/\(^[0-9][0-9]*\).*@FIXME{\([^}]*\).*/'$$file':\1: \2/gp}'; \ 165 sed -n 'N;/@FIXME{/{s/\(^[0-9][0-9]*\).*@FIXME{\([^}]*\).*/'$$file':\1: \2/gp}'; \
148 done > $@-t; \ 166 done > $@-t; \
149 if [ -s $@-t ]; then \ 167 if [ -s $@-t ]; then \
150 echo "Unresolved FIXMEs:"; \ 168 echo >&2 "Unresolved FIXMEs:"; \
151 cat $@-t; \ 169 cat $@-t >&2; \
152 rm $@-t; \ 170 rm $@-t; \
153 false; \ 171 false; \
154 else \ 172 else \
...@@ -156,10 +174,10 @@ check-fixmes: ...@@ -156,10 +174,10 @@ check-fixmes:
156 fi 174 fi
157 175
158 check-unrevised: 176 check-unrevised:
159 @grep -Hn @UNREVISED $(info_TEXINFOS) $(dico_TEXINFOS) > $@-t; \ 177 @grep -Hn @UNREVISED $(info_TEXINFOS) $(mailutils_TEXINFOS) > $@-t; \
160 if [ -s $@-t ]; then \ 178 if [ -s $@-t ]; then \
161 echo "Unrevised nodes:"; \ 179 echo >&2 "Unrevised nodes:"; \
162 cat $@-t; \ 180 cat $@-t >&2; \
163 rm $@-t; \ 181 rm $@-t; \
164 false;\ 182 false;\
165 else \ 183 else \
......
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
10 10
11 @end smallexample 11 @end smallexample
12 12
13 There are many ways to authenticate to a server. To be flexible the 13 There are many ways to authenticate to a server. To be flexible the
14 authentication process is provided by three objects @code{mu_authority_t}, 14 authentication process is provided by three objects @code{mu_authority_t},
15 @code{mu_ticket_t}, and @code{mu_wicket_t}. The @code{mu_authority_t} can implement 15 @code{mu_ticket_t}, and @code{mu_wicket_t}. The @code{mu_authority_t} can implement
16 different protocol like APOP, MD5-AUTH, One Time Passwd, etc. By default 16 different protocol like APOP, MD5-AUTH, One Time Passwd, etc. By default
17 if a mailbox does not understand or know how to authenticate it falls back 17 if a mailbox does not understand or know how to authenticate it falls back
18 to user/passwd authentication. The @code{mu_ticket_t} is a way for 18 to user/passwd authentication. The @code{mu_ticket_t} is a way for
19 Mailboxes and Mailers provide a way to authenticate when the URL does not 19 Mailboxes and Mailers provide a way to authenticate when the URL does not
20 contain enough information. The default action is to call the function 20 contain enough information. The default action is to call the function
21 @code{mu_authority_authenticate()} which will get the @emph{user} and @emph{passwd} 21 @code{mu_authority_authenticate()} which will get the @emph{user} and @emph{passwd}
22 if not set, this function can be overridden by a custom method. 22 if not set, this function can be overridden by a custom method.
23 23
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
25 25
26 Wherever the mail is and whatever format it is stored in, it is operated 26 Wherever the mail is and whatever format it is stored in, it is operated
27 upon using the same set of functions. To unified the C API, 27 upon using the same set of functions. To unified the C API,
28 @sc{gnu} Mailutils offers a heteroclite set of objects that work in 28 GNU Mailutils offers a heteroclite set of objects that work in
29 aggregation to do operations on emails. 29 aggregation to do operations on emails.
30 Each object does a specific task and delegates non-related tasks to others. 30 Each object does a specific task and delegates non-related tasks to others.
31 The object comes alive by specifying a @emph{URL} parameter when created, 31 The object comes alive by specifying a @emph{URL} parameter when created,
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
10 10
11 @end smallexample 11 @end smallexample
12 12
13 Internet Message Access Protocol - Version (4rev1). In IMAP4, the client 13 Internet Message Access Protocol - Version (4rev1). In IMAP4, the client
14 must be prepared to accept any responses at all times. The server responses 14 must be prepared to accept any responses at all times. The server responses
15 have three forms: status responses, server data and command continuation 15 have three forms: status responses, server data and command continuation
16 request. Untagged responses, for historical reasons are also call 16 request. Untagged responses, for historical reasons are also call
17 "unsolicited responses". 17 "unsolicited responses".
......
...@@ -9,7 +9,7 @@ the system user database. The library @file{libmuauth} extends this ...@@ -9,7 +9,7 @@ the system user database. The library @file{libmuauth} extends this
9 functionality, allowing @file{libmailbox} functions to obtain 9 functionality, allowing @file{libmailbox} functions to obtain
10 information about a user from several places, like @sc{sql} database, 10 information about a user from several places, like @sc{sql} database,
11 etc. The method used is described in detail in @ref{Auth Statement, 11 etc. The method used is described in detail in @ref{Auth Statement,
12 authentication}. This chapter contains a very succinct description of 12 authentication}. This chapter contains a very succinct description of
13 the underlying library mechanism. 13 the underlying library mechanism.
14 14
15 @menu 15 @menu
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 @c See file mailutils.texi for copying conditions. 4 @c See file mailutils.texi for copying conditions.
5 @comment ******************************************************************* 5 @comment *******************************************************************
6 6
7 @code{Libsieve} is @sc{gnu} implementation of the mail filtering 7 @code{Libsieve} is GNU implementation of the mail filtering
8 language Sieve. The library is built around a @dfn{Sieve Machine} --- an 8 language Sieve. The library is built around a @dfn{Sieve Machine} --- an
9 abstract computer constructed specially to handle mail filtering tasks. 9 abstract computer constructed specially to handle mail filtering tasks.
10 This computer has two registers: program counter and numeric accumulator; 10 This computer has two registers: program counter and numeric accumulator;
...@@ -620,7 +620,7 @@ string @var{str}. ...@@ -620,7 +620,7 @@ string @var{str}.
620 620
621 @deftypefun {void *} mu_sieve_mrealloc (mu_sieve_machine_t @var{mach}, void *@var{ptr}, size_t @var{size}) 621 @deftypefun {void *} mu_sieve_mrealloc (mu_sieve_machine_t @var{mach}, void *@var{ptr}, size_t @var{size})
622 Changes the size of the memory block pointed to by @var{ptr} to 622 Changes the size of the memory block pointed to by @var{ptr} to
623 @var{size} bytes. The contents will be unchanged to the minimum of the 623 @var{size} bytes. The contents will be unchanged to the minimum of the
624 old and new sizes; newly allocated memory will be uninitialized. If 624 old and new sizes; newly allocated memory will be uninitialized. If
625 @var{ptr} is @code{NULL}, the call is equivalent to 625 @var{ptr} is @code{NULL}, the call is equivalent to
626 @code{mu_sieve_malloc(@var{mach}, @var{size})}; if @var{size} is equal to 626 @code{mu_sieve_malloc(@var{mach}, @var{size})}; if @var{size} is equal to
...@@ -664,7 +664,7 @@ Dump the disassembled code of the sieve machine @var{mach}. ...@@ -664,7 +664,7 @@ Dump the disassembled code of the sieve machine @var{mach}.
664 @subsection Writing Loadable Commands 664 @subsection Writing Loadable Commands
665 665
666 This section contains an example of how to write external loadable 666 This section contains an example of how to write external loadable
667 commands for @sc{gnu} libsieve. 667 commands for GNU libsieve.
668 668
669 @smallexample 669 @smallexample
670 @include numaddr.inc 670 @include numaddr.inc
......
...@@ -69,7 +69,7 @@ Destroys and releases resources held by @var{mbox}. ...@@ -69,7 +69,7 @@ Destroys and releases resources held by @var{mbox}.
69 69
70 @deftypefun int mu_mailbox_open (mu_mailbox_t @var{mbox}, int @var{flag}) 70 @deftypefun int mu_mailbox_open (mu_mailbox_t @var{mbox}, int @var{flag})
71 A connection is open, if no stream was provided, a stream 71 A connection is open, if no stream was provided, a stream
72 is created based on the @var{mbox} type. The @var{flag} can be OR'ed. 72 is created based on the @var{mbox} type. The @var{flag} can be OR'ed.
73 See @code{stream_create()} for @var{flag}'s description. 73 See @code{stream_create()} for @var{flag}'s description.
74 74
75 The return value is @code{0} on success and a code number on error conditions: 75 The return value is @code{0} on success and a code number on error conditions:
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
12 12
13 The standard @cite{RFC 1524} (A User Agent Configuration Mechanism) 13 The standard @cite{RFC 1524} (A User Agent Configuration Mechanism)
14 suggests a file format to be used to inform a mail user agent about 14 suggests a file format to be used to inform a mail user agent about
15 facilities for handling mail in various format. The configuration 15 facilities for handling mail in various format. The configuration
16 file is known also as mailcap and it is tipically found in UNIX 16 file is known also as mailcap and it is tipically found in UNIX
17 platforms, a example of @file{/etc/mailcap}: 17 platforms, a example of @file{/etc/mailcap}:
18 18
...@@ -24,10 +24,10 @@ application/pgp; gpg < %s | metamail; needsterminal; \ ...@@ -24,10 +24,10 @@ application/pgp; gpg < %s | metamail; needsterminal; \
24 @end smallexample 24 @end smallexample
25 25
26 A mailcap file consits of a set of mailcap entries per line, lines 26 A mailcap file consits of a set of mailcap entries per line, lines
27 beginning with @samp{#} are considered comments and ignored. Long 27 beginning with @samp{#} are considered comments and ignored. Long
28 mailcap entry may be continued on multiple lines if each line ends 28 mailcap entry may be continued on multiple lines if each line ends
29 with a backslash character @samp{\}, the multiline will be considered 29 with a backslash character @samp{\}, the multiline will be considered
30 a single mailcap entry. The overall format in @acronym{BNF}: 30 a single mailcap entry. The overall format in @acronym{BNF}:
31 31
32 @smallexample 32 @smallexample
33 @group 33 @group
......
...@@ -55,11 +55,11 @@ Permission is granted to copy, distribute and/or modify this document ...@@ -55,11 +55,11 @@ Permission is granted to copy, distribute and/or modify this document
55 under the terms of the GNU Free Documentation License, Version 1.2 or 55 under the terms of the GNU Free Documentation License, Version 1.2 or
56 any later version published by the Free Software Foundation; with no 56 any later version published by the Free Software Foundation; with no
57 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', 57 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
58 and with the Back-Cover Texts as in (a) below. A copy of the license 58 and with the Back-Cover Texts as in (a) below. A copy of the license
59 is included in the section entitled ``GNU Free Documentation License''. 59 is included in the section entitled ``GNU Free Documentation License''.
60 60
61 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify 61 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
62 this GNU Manual, like GNU software. Copies published by the Free 62 this GNU Manual, like GNU software. Copies published by the Free
63 Software Foundation raise funds for GNU development.'' 63 Software Foundation raise funds for GNU development.''
64 @end copying 64 @end copying
65 65
...@@ -97,6 +97,7 @@ This edition of the @cite{GNU Mailutils Manual}, last updated on ...@@ -97,6 +97,7 @@ This edition of the @cite{GNU Mailutils Manual}, last updated on
97 Appendices 97 Appendices
98 98
99 * References:: References. 99 * References:: References.
100 * Date Input Formats::
100 * Usage Vars:: Configuring Help Summary 101 * Usage Vars:: Configuring Help Summary
101 * GNU FDL:: This manual is under the GNU Free 102 * GNU FDL:: This manual is under the GNU Free
102 Documentation License. 103 Documentation License.
...@@ -388,6 +389,29 @@ Preprocessor ...@@ -388,6 +389,29 @@ Preprocessor
388 * #include:: Include the contents of a file. 389 * #include:: Include the contents of a file.
389 * #searchpath:: Modify the current search path. 390 * #searchpath:: Modify the current search path.
390 391
392 Tests
393
394 * Built-in Tests::
395 * External Tests::
396
397 Actions
398
399 * Built-in Actions::
400 * External Actions::
401
402 Date Input Formats
403
404 * General date syntax:: Common rules.
405 * Calendar date items:: 19 Dec 1994.
406 * Time of day items:: 9:20pm.
407 * Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}.
408 * Day of week items:: Monday and others.
409 * Relative items in date strings:: next tuesday, 2 years ago.
410 * Pure numbers in date strings:: 19931219, 1440.
411 * Seconds since the Epoch:: @@1078100502.
412 * Specifying time zone rules:: TZ="America/New_York", TZ="UTC0".
413 * Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al.
414
391 @end detailmenu 415 @end detailmenu
392 @end menu 416 @end menu
393 417
...@@ -395,10 +419,10 @@ Preprocessor ...@@ -395,10 +419,10 @@ Preprocessor
395 @chapter Introduction 419 @chapter Introduction
396 420
397 GNU Mailutils contains a series of useful mail clients, servers, 421 GNU Mailutils contains a series of useful mail clients, servers,
398 and libraries. These are the primary mail utilities of the GNU system. 422 and libraries. These are the primary mail utilities of the GNU system.
399 Specifically, this package contains a POP3 server, an IMAP4 server, 423 Specifically, this package contains a POP3 server, an IMAP4 server,
400 and a Sieve mail filter. It also provides a POSIX `mailx' client, 424 and a Sieve mail filter. It also provides a POSIX `mailx' client,
401 and a collection of other tools. All utilities can manipulate the 425 and a collection of other tools. All utilities can manipulate the
402 mailboxes of various formats, both local, stored on the hard disk, 426 mailboxes of various formats, both local, stored on the hard disk,
403 and remote, accessed via network protocols, such as POP3 or IMAP4. 427 and remote, accessed via network protocols, such as POP3 or IMAP4.
404 428
...@@ -406,7 +430,7 @@ The GNU Mailutils libraries supply a rich set of primitives for ...@@ -406,7 +430,7 @@ The GNU Mailutils libraries supply a rich set of primitives for
406 handling electronic mail in programs written in C, C++ or Scheme. 430 handling electronic mail in programs written in C, C++ or Scheme.
407 431
408 This software is part of the GNU Project and belongs to the Free 432 This software is part of the GNU Project and belongs to the Free
409 Software Foundation. All libraries are licensed using the GNU LGPL. 433 Software Foundation. All libraries are licensed using the GNU LGPL.
410 The documentation is licensed under the GNU FDL, and everything 434 The documentation is licensed under the GNU FDL, and everything
411 else is licensed using the GNU GPL. 435 else is licensed using the GNU GPL.
412 436
...@@ -420,17 +444,17 @@ else is licensed using the GNU GPL. ...@@ -420,17 +444,17 @@ else is licensed using the GNU GPL.
420 @UNREVISED 444 @UNREVISED
421 445
422 @FIXME{This is more a plan on how the document should be structured, 446 @FIXME{This is more a plan on how the document should be structured,
423 than a description of its actual structure. However it is:} 447 than a description of its actual structure. However it is:}
424 448
425 This book addresses a wide audience of both system administrators 449 This book addresses a wide audience of both system administrators
426 and users that aim to use Mailutils programs, and programmers who wish 450 and users that aim to use Mailutils programs, and programmers who wish
427 to use Mailutils libraries in their programs. Given this audience, 451 to use Mailutils libraries in their programs. Given this audience,
428 the book is divided in three major parts. 452 the book is divided in three major parts.
429 453
430 The first part provides a detailed description of each Mailutils 454 The first part provides a detailed description of each Mailutils
431 utility, and advices on how to use them in various situations. This 455 utility, and advices on how to use them in various situations. This
432 part is intended for users and system administrators who are using 456 part is intended for users and system administrators who are using
433 Mailutils programs. If you are not interested in programming using 457 Mailutils programs. If you are not interested in programming using
434 Mailutils, this is the only part you need to read. 458 Mailutils, this is the only part you need to read.
435 459
436 Subsequent parts address programmers. 460 Subsequent parts address programmers.
...@@ -447,9 +471,9 @@ reference. ...@@ -447,9 +471,9 @@ reference.
447 @UNREVISED 471 @UNREVISED
448 472
449 This package started off to try and handle large mailbox files more 473 This package started off to try and handle large mailbox files more
450 gracefully then current POP3 servers did. While it handles this task, 474 gracefully then current POP3 servers did. While it handles this task,
451 it also allows you to support a variety of different mailbox formats 475 it also allows you to support a variety of different mailbox formats
452 without any real effort on your part. Also, if a new format is added 476 without any real effort on your part. Also, if a new format is added
453 at a later date, your program will support that new format 477 at a later date, your program will support that new format
454 automatically as soon as it is compiled against the new library. 478 automatically as soon as it is compiled against the new library.
455 479
...@@ -673,6 +697,10 @@ Notifications} ...@@ -673,6 +697,10 @@ Notifications}
673 @end itemize 697 @end itemize
674 @end itemize 698 @end itemize
675 699
700 @node Date Input Formats
701 @appendix Date Input Formats
702 @include getdate.texi
703
676 @include usage.texi 704 @include usage.texi
677 705
678 @include fdl.texi 706 @include fdl.texi
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
10 10
11 @end smallexample 11 @end smallexample
12 12
13 The most common mailbox format on UNIX platform is @emph{mbox}. Mbox is a 13 The most common mailbox format on UNIX platform is @emph{mbox}. Mbox is a
14 text file that contains messages separated by a special format string. 14 text file that contains messages separated by a special format string.
15 15
16 @smallexample 16 @smallexample
...@@ -34,7 +34,7 @@ check to see if the format is a valid format or an empty file. The scanning ...@@ -34,7 +34,7 @@ check to see if the format is a valid format or an empty file. The scanning
34 of the mailbox is done by @code{mu_mbox_scan ()}, the function, takes callback 34 of the mailbox is done by @code{mu_mbox_scan ()}, the function, takes callback
35 functions called during the scanning to provide information on progress and 35 functions called during the scanning to provide information on progress and
36 new messages found. The scanning will cache some of the headers fields for 36 new messages found. The scanning will cache some of the headers fields for
37 speed, new fields could be add with @code{mu_mbox_add_hcache ()}. On Closing 37 speed, new fields could be add with @code{mu_mbox_add_hcache ()}. On Closing
38 the @var{mu_mbox_t}, @code{mu_mbox_close ()} will free any resources like, headers 38 the @var{mu_mbox_t}, @code{mu_mbox_close ()} will free any resources like, headers
39 cache, locks etc ... The messages with attributes marked deleted will only 39 cache, locks etc ... The messages with attributes marked deleted will only
40 be removed on @code{mu_mbox_expunge ()}, if there is a need to save the 40 be removed on @code{mu_mbox_expunge ()}, if there is a need to save the
...@@ -68,8 +68,8 @@ reclaim memory. ...@@ -68,8 +68,8 @@ reclaim memory.
68 @deftypefun int mu_mbox_set_carrier (mu_mbox_t, stream_t @var{carrier}); 68 @deftypefun int mu_mbox_set_carrier (mu_mbox_t, stream_t @var{carrier});
69 69
70 Another type of stream can be provided, the @var{carrier} 70 Another type of stream can be provided, the @var{carrier}
71 is set in the @var{mu_mbox_t} handle. Any previous @var{carrier} stream in 71 is set in the @var{mu_mbox_t} handle. Any previous @var{carrier} stream in
72 the handle, will be close and destroy. Since the parsing code 72 the handle, will be close and destroy. Since the parsing code
73 maintain only the offsets off the message the @var{carrier} stream must be 73 maintain only the offsets off the message the @var{carrier} stream must be
74 seekable. 74 seekable.
75 75
...@@ -80,7 +80,7 @@ seekable. ...@@ -80,7 +80,7 @@ seekable.
80 80
81 @deftypefun int mu_mbox_get_carrier (mu_mbox_t, stream_t *@var{carrier}); 81 @deftypefun int mu_mbox_get_carrier (mu_mbox_t, stream_t *@var{carrier});
82 82
83 Return the @var{mu_mbox_t} carrier. If none was set, a new file stream will be 83 Return the @var{mu_mbox_t} carrier. If none was set, a new file stream will be
84 created. 84 created.
85 85
86 @table @code 86 @table @code
...@@ -91,7 +91,7 @@ created. ...@@ -91,7 +91,7 @@ created.
91 91
92 @deftypefun int mu_mbox_open (mu_mbox_t, const char *@var{filename}, int @var{flags}) 92 @deftypefun int mu_mbox_open (mu_mbox_t, const char *@var{filename}, int @var{flags})
93 93
94 Open carrier stream with @var{filename} and @var{flags}. The stream will be 94 Open carrier stream with @var{filename} and @var{flags}. The stream will be
95 quickly examine to see if it is a mbox format. 95 quickly examine to see if it is a mbox format.
96 96
97 @table @code 97 @table @code
...@@ -285,7 +285,7 @@ Add to the current cache for the scan, the fields in @var{array}. ...@@ -285,7 +285,7 @@ Add to the current cache for the scan, the fields in @var{array}.
285 285
286 @deftypefun int mu_mbox_value_hcache (mu_mbox_t, unsigned int @var{msgno}, const char *@var{field}, char *@var{buffer}, size_t @var{buflen}, size_t *@var{writen}) 286 @deftypefun int mu_mbox_value_hcache (mu_mbox_t, unsigned int @var{msgno}, const char *@var{field}, char *@var{buffer}, size_t @var{buflen}, size_t *@var{writen})
287 287
288 Get the value of @var{field} in the header cache for @var{msgno}. The 288 Get the value of @var{field} in the header cache for @var{msgno}. The
289 result is copied in a @var{buffer} of @var{buflen} and @var{writen} is set 289 result is copied in a @var{buffer} of @var{buflen} and @var{writen} is set
290 to the number of byte put in @var{buffer}. 290 to the number of byte put in @var{buffer}.
291 291
...@@ -329,7 +329,7 @@ NULL to get the default. ...@@ -329,7 +329,7 @@ NULL to get the default.
329 @deftypefun int mu_mbox_append_hb (mu_mbox_t, const char *@var{sep}, stream_t @var{hstream}, stream_t @var{bstream}) 329 @deftypefun int mu_mbox_append_hb (mu_mbox_t, const char *@var{sep}, stream_t @var{hstream}, stream_t @var{bstream})
330 330
331 Append to the mailbox an rfc822 message represented by a header, @var{hstream}, 331 Append to the mailbox an rfc822 message represented by a header, @var{hstream},
332 and a body, @var{bstream}. The variable @var{sep} should contain a valid 332 and a body, @var{bstream}. The variable @var{sep} should contain a valid
333 "From " separator or NULL to get the default. 333 "From " separator or NULL to get the default.
334 334
335 @table @code 335 @table @code
...@@ -339,11 +339,11 @@ and a body, @var{bstream}. The variable @var{sep} should contain a valid ...@@ -339,11 +339,11 @@ and a body, @var{bstream}. The variable @var{sep} should contain a valid
339 339
340 @deftypefun int mu_mbox_scan (mu_mbox_t, unsigned int @var{start}, unsigned int *@var{count}) 340 @deftypefun int mu_mbox_scan (mu_mbox_t, unsigned int @var{start}, unsigned int *@var{count})
341 341
342 Start scanning the mailbox for new messages. The variable @var{start} can be 342 Start scanning the mailbox for new messages. The variable @var{start} can be
343 a message number starting point. The result of the scanning will be in 343 a message number starting point. The result of the scanning will be in
344 @var{count}. The scanning will trigger the @code{mu_mbox_newmsg_cb()} callback 344 @var{count}. The scanning will trigger the @code{mu_mbox_newmsg_cb()} callback
345 for each new message and @code{mu_mbox_progress_cb ()} at different interval 345 for each new message and @code{mu_mbox_progress_cb ()} at different interval
346 to notify progression. The return values of the those callback should be 346 to notify progression. The return values of the those callback should be
347 0 is different then 0 the scanning will be stop an the function returns 347 0 is different then 0 the scanning will be stop an the function returns
348 MU_ERROR_INTERRUPTED. 348 MU_ERROR_INTERRUPTED.
349 349
...@@ -361,8 +361,8 @@ Same as @code{mu_mbox_scan ()} but does not call the callbacks. ...@@ -361,8 +361,8 @@ Same as @code{mu_mbox_scan ()} but does not call the callbacks.
361 @end deftypefun 361 @end deftypefun
362 @deftypefun int mu_mbox_set_progress_cb (mu_mbox_t, int (*@var{callback}) (int @var{percentage}, void *)), void *@var{arg}) 362 @deftypefun int mu_mbox_set_progress_cb (mu_mbox_t, int (*@var{callback}) (int @var{percentage}, void *)), void *@var{arg})
363 363
364 Set the callback function for progress. The variable @var{arg} will be pass 364 Set the callback function for progress. The variable @var{arg} will be pass
365 back in the callback as the second argument. The first argument of the 365 back in the callback as the second argument. The first argument of the
366 callback represents a @var{percentage} of the scanning progress. 366 callback represents a @var{percentage} of the scanning progress.
367 367
368 @table @code 368 @table @code
...@@ -372,8 +372,8 @@ callback represents a @var{percentage} of the scanning progress. ...@@ -372,8 +372,8 @@ callback represents a @var{percentage} of the scanning progress.
372 372
373 @deftypefun int mu_mbox_set_newmsg_cb (mu_mbox_t, int (*@var{callback}) (int @var{count}, void *)), void *@var{arg}) 373 @deftypefun int mu_mbox_set_newmsg_cb (mu_mbox_t, int (*@var{callback}) (int @var{count}, void *)), void *@var{arg})
374 374
375 Set the callback function for new messages. The variable @var{arg} will be 375 Set the callback function for new messages. The variable @var{arg} will be
376 pass back in the callback as the second argument. The first argument 376 pass back in the callback as the second argument. The first argument
377 is the total of messages found. 377 is the total of messages found.
378 378
379 @table @code 379 @table @code
...@@ -383,7 +383,7 @@ is the total of messages found. ...@@ -383,7 +383,7 @@ is the total of messages found.
383 383
384 @deftypefun int mu_mbox_set_error_cb (mu_mbox_t, int (*@var{callback}) (int, void *)), void *@var{arg}) 384 @deftypefun int mu_mbox_set_error_cb (mu_mbox_t, int (*@var{callback}) (int, void *)), void *@var{arg})
385 385
386 Set the callback function for errors. The variable @var{arg} will be 386 Set the callback function for errors. The variable @var{arg} will be
387 pass back in the callback as the second argument. 387 pass back in the callback as the second argument.
388 388
389 @table @code 389 @table @code
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
10 10
11 @end smallexample 11 @end smallexample
12 12
13 The @code{mu_message_t} object is a convenient way to manipulate messages. It 13 The @code{mu_message_t} object is a convenient way to manipulate messages. It
14 encapsulates the @code{envelope_t}, the @code{header_t} and the @code{body_t}. 14 encapsulates the @code{envelope_t}, the @code{header_t} and the @code{body_t}.
15 15
16 @smallexample 16 @smallexample
......
...@@ -14,7 +14,7 @@ but by using structures and pointers to function, it is possible to provide ...@@ -14,7 +14,7 @@ but by using structures and pointers to function, it is possible to provide
14 a simple framework. 14 a simple framework.
15 15
16 Every Mailutils object has a corresponding C structure holding its interface 16 Every Mailutils object has a corresponding C structure holding its interface
17 and specific data. For example mu_object_t, is the root object and all mailutils objects 17 and specific data. For example mu_object_t, is the root object and all mailutils objects
18 extends it: 18 extends it:
19 19
20 @smallexample 20 @smallexample
...@@ -37,7 +37,7 @@ struct _mu_object ...@@ -37,7 +37,7 @@ struct _mu_object
37 @end smallexample 37 @end smallexample
38 38
39 The @var{vtable} is an array of pointers to function, it provides the interface 39 The @var{vtable} is an array of pointers to function, it provides the interface
40 or the list of function for this object. The library provides wrapper to 40 or the list of function for this object. The library provides wrapper to
41 access the functions instead using the @var{vtable} directly. 41 access the functions instead using the @var{vtable} directly.
42 42
43 @smallexample 43 @smallexample
......
...@@ -57,7 +57,7 @@ Returns the list of headers in the message @var{mesg}. Optional argument ...@@ -57,7 +57,7 @@ Returns the list of headers in the message @var{mesg}. Optional argument
57 @c snarfed from "mu_message.c":510 57 @c snarfed from "mu_message.c":510
58 @deffn {Scheme procedure} mu-message-set-header-fields mesg list replace 58 @deffn {Scheme procedure} mu-message-set-header-fields mesg list replace
59 Set the headers in the message @var{mesg} from @var{list} 59 Set the headers in the message @var{mesg} from @var{list}
60 @var{list} is a list of conses (cons HEADER VALUE). The function sets 60 @var{list} is a list of conses (cons HEADER VALUE). The function sets
61 these headers in the message @var{mesg}. 61 these headers in the message @var{mesg}.
62 Optional parameter @var{replace} specifies whether the new header 62 Optional parameter @var{replace} specifies whether the new header
63 values should replace the headers already present in the 63 values should replace the headers already present in the
......
1 @c snarfed from "mu_mime.c":95 1 @c snarfed from "mu_mime.c":95
2 @deffn {Scheme procedure} mu-mime-create flags mesg 2 @deffn {Scheme procedure} mu-mime-create flags mesg
3 Creates a new @acronym{MIME} object. Both arguments are optional. 3 Creates a new @acronym{MIME} object. Both arguments are optional.
4 @var{flags} specifies the type of the object to create (@samp{0} is a reasonable 4 @var{flags} specifies the type of the object to create (@samp{0} is a reasonable
5 value). @var{mesg} gives the message to create the @acronym{MIME} object from. 5 value). @var{mesg} gives the message to create the @acronym{MIME} object from.
6 @end deffn 6 @end deffn
7 7
8 @c snarfed from "mu_mime.c":131 8 @c snarfed from "mu_mime.c":131
......
1 @c snarfed from "mu_scm.c":130 1 @c snarfed from "mu_scm.c":130
2 @deffn {Scheme procedure} mu-register-format rest 2 @deffn {Scheme procedure} mu-register-format rest
3 Registers desired mailutils formats. Any number of arguments can be given. 3 Registers desired mailutils formats. Any number of arguments can be given.
4 Each argument must be one of the following strings: 4 Each argument must be one of the following strings:
5 5
6 @multitable @columnfractions 0.3 0.6 6 @multitable @columnfractions 0.3 0.6
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
11 @ifinfo 11 @ifinfo
12 @dircategory GNU libraries 12 @dircategory GNU libraries
13 @direntry 13 @direntry
14 * mailutils-int: (muint). The internals of GNU Mailutils. 14 * mailutils-int: (muint). The internals of GNU Mailutils.
15 @end direntry 15 @end direntry
16 @end ifinfo 16 @end ifinfo
17 17
...@@ -26,11 +26,11 @@ Permission is granted to copy, distribute and/or modify this document ...@@ -26,11 +26,11 @@ Permission is granted to copy, distribute and/or modify this document
26 under the terms of the GNU Free Documentation License, Version 1.2 or 26 under the terms of the GNU Free Documentation License, Version 1.2 or
27 any later version published by the Free Software Foundation; with no 27 any later version published by the Free Software Foundation; with no
28 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', 28 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
29 and with the Back-Cover Texts as in (a) below. A copy of the license 29 and with the Back-Cover Texts as in (a) below. A copy of the license
30 is included in the section entitled ``GNU Free Documentation License''. 30 is included in the section entitled ``GNU Free Documentation License''.
31 31
32 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify 32 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
33 this GNU Manual, like GNU software. Copies published by the Free 33 this GNU Manual, like GNU software. Copies published by the Free
34 Software Foundation raise funds for GNU development.'' 34 Software Foundation raise funds for GNU development.''
35 @end copying 35 @end copying
36 36
...@@ -51,7 +51,7 @@ Software Foundation raise funds for GNU development.'' ...@@ -51,7 +51,7 @@ Software Foundation raise funds for GNU development.''
51 51
52 @chapter Scope of this Document 52 @chapter Scope of this Document
53 53
54 This document describes the internals of the GNU Mailutils. It 54 This document describes the internals of the GNU Mailutils. It
55 includes description of Mailutils' architecture, algorithms and 55 includes description of Mailutils' architecture, algorithms and
56 data structures. It is intended primarily for Mailutils developers 56 data structures. It is intended primarily for Mailutils developers
57 and those who wish to participate in the development of the package. 57 and those who wish to participate in the development of the package.
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
17 17
18 The purpose of the Post Office Protocol Version 3 (POP3) is to permit a client 18 The purpose of the Post Office Protocol Version 3 (POP3) is to permit a client
19 to download a maildrop from a remote server, the protocol does not provide 19 to download a maildrop from a remote server, the protocol does not provide
20 complex or extensive operation on the maildrop. When the client successfully 20 complex or extensive operation on the maildrop. When the client successfully
21 authenticates, the server acquires an exclusive access lock on the mailbox 21 authenticates, the server acquires an exclusive access lock on the mailbox
22 and holds it the entire duration of the session. After the authentication, 22 and holds it the entire duration of the session. After the authentication,
23 the session enters transaction state and the client may issues commands to 23 the session enters transaction state and the client may issues commands to
24 access messages in the mailbox. 24 access messages in the mailbox.
25 25
...@@ -72,16 +72,16 @@ and closes the TCP connection. ...@@ -72,16 +72,16 @@ and closes the TCP connection.
72 @cindex mu_pop3_t 72 @cindex mu_pop3_t
73 73
74 An opaque structure @code{mu_pop3_t} is use as a handle for the session, it is allocated and initialize by 74 An opaque structure @code{mu_pop3_t} is use as a handle for the session, it is allocated and initialize by
75 calling @code{mu_pop3_create()}. All Functions will wait for a reply from the POP3 server before returning. 75 calling @code{mu_pop3_create()}. All Functions will wait for a reply from the POP3 server before returning.
76 The duration of the wait can be set by calling @code{mu_pop3_set_timeout()}, the default is 2 minutes. 76 The duration of the wait can be set by calling @code{mu_pop3_set_timeout()}, the default is 2 minutes.
77 On the server side, there is also an idle timeout of 10 minutes before the POP3 server closes the connection, 77 On the server side, there is also an idle timeout of 10 minutes before the POP3 server closes the connection,
78 although the @cite{RFC 1939} specifies that the minimum 78 although the @cite{RFC 1939} specifies that the minimum
79 default timeout to be ten minutes, many servers have shorter idle period, care should be taken to at least send a 79 default timeout to be ten minutes, many servers have shorter idle period, care should be taken to at least send a
80 @code{mu_pop3_noop()} between lengthy period of idle time. Once a successful connection is established with 80 @code{mu_pop3_noop()} between lengthy period of idle time. Once a successful connection is established with
81 @code{mu_pop3_connect()}, two built-ins authentications are provided @code{mu_pop3_apop ()} or 81 @code{mu_pop3_connect()}, two built-ins authentications are provided @code{mu_pop3_apop ()} or
82 @code{mu_pop3_user()}/@code{mu_pop3_pass()}. The @code{mu_pop3_stat()} and @code{mu_pop3_list ()} functions can be use to 82 @code{mu_pop3_user()}/@code{mu_pop3_pass()}. The @code{mu_pop3_stat()} and @code{mu_pop3_list ()} functions can be use to
83 get the number and size of messages. The functions @code{mu_pop3_list_all()}, @code{mu_pop3_uidl_all ()} and 83 get the number and size of messages. The functions @code{mu_pop3_list_all()}, @code{mu_pop3_uidl_all ()} and
84 @code{mu_pop3_capa()} save the information in an @code{mu_iterator_t}. Downloading of messages is done 84 @code{mu_pop3_capa()} save the information in an @code{mu_iterator_t}. Downloading of messages is done
85 via a two methods @code{mu_pop3_retr()} or @code{mu_pop3_top()}; 85 via a two methods @code{mu_pop3_retr()} or @code{mu_pop3_top()};
86 @strong{Caution: Some Internet Service Providers do not permit to leave mail on server and the message will be 86 @strong{Caution: Some Internet Service Providers do not permit to leave mail on server and the message will be
87 deleted once downloaded}. 87 deleted once downloaded}.
...@@ -91,7 +91,7 @@ all the functions will return @code{EINPROGRESS} if an other operation is in pro ...@@ -91,7 +91,7 @@ all the functions will return @code{EINPROGRESS} if an other operation is in pro
91 91
92 @subsubsection Callbacks 92 @subsubsection Callbacks
93 The POP3 library does not provide any callbacks, the approach is to leave flow control and policy outside of the 93 The POP3 library does not provide any callbacks, the approach is to leave flow control and policy outside of the
94 library. The functions do minimal state checking, for example when sending RETR with @code{mu_pop3_retr()} 94 library. The functions do minimal state checking, for example when sending RETR with @code{mu_pop3_retr()}
95 it is the responsibility of the user to go through the entire buffer of the stream to terminate the RETR command, 95 it is the responsibility of the user to go through the entire buffer of the stream to terminate the RETR command,
96 any other operation will fail, while the RETR is in progress. 96 any other operation will fail, while the RETR is in progress.
97 To reset the state or break the downloading, the user should disconnect @code{mu_pop3_disconnect()} and reconnect 97 To reset the state or break the downloading, the user should disconnect @code{mu_pop3_disconnect()} and reconnect
...@@ -136,7 +136,7 @@ When a POP3 session is finished, any data use by the library is release. ...@@ -136,7 +136,7 @@ When a POP3 session is finished, any data use by the library is release.
136 136
137 @deftypefun int mu_pop3_connect (mu_pop3_t @var{pop3}) 137 @deftypefun int mu_pop3_connect (mu_pop3_t @var{pop3})
138 138
139 A connection is established on the carrier, if there was any previous connection it is close first. If non-blocking the 139 A connection is established on the carrier, if there was any previous connection it is close first. If non-blocking the
140 function should be recall until the return value is not EAGAIN or EINPROGRESS. 140 function should be recall until the return value is not EAGAIN or EINPROGRESS.
141 141
142 Errors: 142 Errors:
...@@ -191,8 +191,8 @@ Errors: ...@@ -191,8 +191,8 @@ Errors:
191 191
192 @deftypefun int mu_pop3_apop (mu_pop3_t @var{pop3}, const char *@var{user}, const char *@var{secret}) 192 @deftypefun int mu_pop3_apop (mu_pop3_t @var{pop3}, const char *@var{user}, const char *@var{secret})
193 193
194 APOP offers an alternative to USER/PASS authentication. For intermittent use of POP3, like checking for new mail, it is the 194 APOP offers an alternative to USER/PASS authentication. For intermittent use of POP3, like checking for new mail, it is the
195 preferred way to authenticate. It reduces the risk of password capture. The @var{user} and the shared @var{secret} are pass 195 preferred way to authenticate. It reduces the risk of password capture. The @var{user} and the shared @var{secret} are pass
196 to @code{mu_pop3_apop()}, the MD5 digest is calculated by applying the time-stamp given by the server in the greeting 196 to @code{mu_pop3_apop()}, the MD5 digest is calculated by applying the time-stamp given by the server in the greeting
197 followed by the @var{secret}. 197 followed by the @var{secret}.
198 198
...@@ -331,7 +331,7 @@ print_message (mu_pop3_t pop3, unsigned int msgno) ...@@ -331,7 +331,7 @@ print_message (mu_pop3_t pop3, unsigned int msgno)
331 @deftypefun int mu_pop3_top (mu_pop3_t @var{pop3}, unsigned int @var{msgno}, unsigned int @var{lines}, mu_stream_t *@var{stream}) 331 @deftypefun int mu_pop3_top (mu_pop3_t @var{pop3}, unsigned int @var{msgno}, unsigned int @var{lines}, mu_stream_t *@var{stream})
332 332
333 If successful @code{stream} should be call to download the header, byte-stuff lines or handle internally, CRLFs are 333 If successful @code{stream} should be call to download the header, byte-stuff lines or handle internally, CRLFs are
334 converted to LF. All other operations will failed until the operation is completed by the caller. 334 converted to LF. All other operations will failed until the operation is completed by the caller.
335 335
336 Errors: 336 Errors:
337 @table @code 337 @table @code
...@@ -410,7 +410,7 @@ Errors: ...@@ -410,7 +410,7 @@ Errors:
410 410
411 @deftypefun int mu_pop3_uidl_all (mu_pop3_t @var{pop3}, mu_iterator_t *@var{iterator}) 411 @deftypefun int mu_pop3_uidl_all (mu_pop3_t @var{pop3}, mu_iterator_t *@var{iterator})
412 412
413 A UIDL command is executed. The call should iterate through the @code{iterator} to fetch the response. 413 A UIDL command is executed. The call should iterate through the @code{iterator} to fetch the response.
414 414
415 Errors: 415 Errors:
416 @table @code 416 @table @code
...@@ -517,7 +517,7 @@ Errors: ...@@ -517,7 +517,7 @@ Errors:
517 517
518 @deftypefun int mu_pop3_set_timeout (mu_pop3_t @var{pop3}, int @var{timeout}) 518 @deftypefun int mu_pop3_set_timeout (mu_pop3_t @var{pop3}, int @var{timeout})
519 519
520 Set the timeout time for I/O on the carrier. The default is 10 minutes. The @var{timeout} is given in milliseconds. 520 Set the timeout time for I/O on the carrier. The default is 10 minutes. The @var{timeout} is given in milliseconds.
521 521
522 Errors: 522 Errors:
523 @table @code 523 @table @code
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
5 5
6 @c ====================================================================== 6 @c ======================================================================
7 @c This document has three levels of rendition: PUBLISH, DISTRIB or PROOF, 7 @c This document has three levels of rendition: PUBLISH, DISTRIB or PROOF,
8 @c as decided by @set symbols. The PUBLISH rendition does not show 8 @c as decided by @set symbols. The PUBLISH rendition does not show
9 @c notes or marks asking for revision. Most users will prefer having more 9 @c notes or marks asking for revision. Most users will prefer having more
10 @c information, even if this information is not fully revised for adequacy, 10 @c information, even if this information is not fully revised for adequacy,
11 @c so DISTRIB is the default for distributions. The PROOF rendition 11 @c so DISTRIB is the default for distributions. The PROOF rendition
12 @c show all marks to the point of ugliness, but is nevertheless useful to 12 @c show all marks to the point of ugliness, but is nevertheless useful to
13 @c those working on the manual itself. 13 @c those working on the manual itself.
14 @c ====================================================================== 14 @c ======================================================================
......
...@@ -11,7 +11,7 @@ properly. ...@@ -11,7 +11,7 @@ properly.
11 11
12 @subsubheading POP3 12 @subsubheading POP3
13 The POP URL scheme contains a POP server, optional port number 13 The POP URL scheme contains a POP server, optional port number
14 and the authentication mechanism. The general form is 14 and the authentication mechanism. The general form is
15 15
16 @smallexample 16 @smallexample
17 @group 17 @group
...@@ -91,7 +91,7 @@ If @emph{:port} is omitted the default value is 993. ...@@ -91,7 +91,7 @@ If @emph{:port} is omitted the default value is 993.
91 91
92 @subsubheading File 92 @subsubheading File
93 93
94 Local folder should be handle by this URL. It is preferable to let 94 Local folder should be handle by this URL. It is preferable to let
95 the mailbox recognize the type of mailbox and take the appropriate 95 the mailbox recognize the type of mailbox and take the appropriate
96 action. 96 action.
97 97
......
...@@ -124,9 +124,9 @@ $ @kbd{ARGP_HELP_FMT=long-opt-col=16 sieve --help|grep ADDRESS} ...@@ -124,9 +124,9 @@ $ @kbd{ARGP_HELP_FMT=long-opt-col=16 sieve --help|grep ADDRESS}
124 @end deftypevr 124 @end deftypevr
125 125
126 @deftypevr {Help Output} offset doc-opt-col 126 @deftypevr {Help Output} offset doc-opt-col
127 Column in which @dfn{doc options} start. A doc option isn't actually 127 Column in which @dfn{doc options} start. A doc option isn't actually
128 an option, but rather an arbitrary piece of documentation that is 128 an option, but rather an arbitrary piece of documentation that is
129 displayed in much the same manner as the options. For example, in 129 displayed in much the same manner as the options. For example, in
130 the output of @command{folder --help}: 130 the output of @command{folder --help}:
131 131
132 @verbatim 132 @verbatim
...@@ -138,7 +138,7 @@ GNU MH folder ...@@ -138,7 +138,7 @@ GNU MH folder
138 @end verbatim 138 @end verbatim
139 139
140 @noindent 140 @noindent
141 the string @samp{Actions are:} is a doc option. Thus, if you set 141 the string @samp{Actions are:} is a doc option. Thus, if you set
142 @kbd{ARGP_HELP_FMT=doc-opt-col=6} the above part of the help output 142 @kbd{ARGP_HELP_FMT=doc-opt-col=6} the above part of the help output
143 will look as follows: 143 will look as follows:
144 144
...@@ -172,8 +172,8 @@ Notice, that the description starts on a separate line if ...@@ -172,8 +172,8 @@ Notice, that the description starts on a separate line if
172 @end deftypevr 172 @end deftypevr
173 173
174 @deftypevr {Help Output} offset header-col 174 @deftypevr {Help Output} offset header-col
175 Column in which @dfn{group headers} are printed. A group header is a 175 Column in which @dfn{group headers} are printed. A group header is a
176 descriptive text preceding an option group. For example, in the 176 descriptive text preceding an option group. For example, in the
177 following text: 177 following text:
178 178
179 @verbatim 179 @verbatim
......
...@@ -80,9 +80,9 @@ main (int argc, char **argv) ...@@ -80,9 +80,9 @@ main (int argc, char **argv)
80 80
81 /* Registration. */ 81 /* Registration. */
82 mu_registrar_record (mu_imap_record); 82 mu_registrar_record (mu_imap_record);
83 mu_registrar_record (mu_mbox_record);
84 mu_registrar_record (mu_path_record);
85 mu_registrar_record (mu_pop_record); 83 mu_registrar_record (mu_pop_record);
84 mu_registrar_record (mu_mbox_record);
85 mu_registrar_set_default_record (mu_mbox_record);
86 86
87 MU_ASSERT (mu_mailbox_create_default (&mbox, mailbox_name)); 87 MU_ASSERT (mu_mailbox_create_default (&mbox, mailbox_name));
88 88
......
...@@ -250,9 +250,10 @@ make_tmp (FILE *input, const char *from, char **tempfile) ...@@ -250,9 +250,10 @@ make_tmp (FILE *input, const char *from, char **tempfile)
250 void 250 void
251 register_handlers () 251 register_handlers ()
252 { 252 {
253 mu_registrar_record (mu_path_record); 253 mu_registrar_record (mu_mbox_record);
254 mu_registrar_record (mu_sendmail_record); 254 mu_registrar_record (mu_sendmail_record);
255 mu_registrar_record (mu_smtp_record); 255 mu_registrar_record (mu_smtp_record);
256 mu_registrar_set_default_record (mu_mbox_record);
256 } 257 }
257 258
258 int 259 int
......
...@@ -27,7 +27,7 @@ debug.h: $(top_srcdir)/scripts/debugdef.m4 debug.hm4 ...@@ -27,7 +27,7 @@ debug.h: $(top_srcdir)/scripts/debugdef.m4 debug.hm4
27 m4 $(top_srcdir)/scripts/debugdef.m4 debug.hm4 > debug.h 27 m4 $(top_srcdir)/scripts/debugdef.m4 debug.hm4 > debug.h
28 28
29 types.h: $(top_srcdir)/include/mailutils/types.hin Makefile 29 types.h: $(top_srcdir)/include/mailutils/types.hin Makefile
30 sed 's/MU_OFF_TYPE/$(MU_OFF_TYPE)/' $(top_srcdir)/include/mailutils/types.hin > $@ 30 sed 's/_MU_OFF_TYPE_/$(MU_OFF_TYPE)/;s/_MU_DEFAULT_RECORD_/$(MU_DEFAULT_RECORD)/' $(top_srcdir)/include/mailutils/types.hin > $@
31 DISTCLEANFILES = types.h 31 DISTCLEANFILES = types.h
32 32
33 pkginclude_DATA = types.h 33 pkginclude_DATA = types.h
......
...@@ -35,10 +35,6 @@ const char *mu_mailbox_url (void); ...@@ -35,10 +35,6 @@ const char *mu_mailbox_url (void);
35 const char *mu_folder_directory (void); 35 const char *mu_folder_directory (void);
36 int mu_construct_user_mailbox_url (char **pout, const char *name); 36 int mu_construct_user_mailbox_url (char **pout, const char *name);
37 37
38 /* Default mailbox protocol */
39 int mu_mailbox_set_default_proto (const char *proto);
40 const char *mu_mailbox_get_default_proto (void);
41
42 /* Constructor/destructor and possible types. */ 38 /* Constructor/destructor and possible types. */
43 extern int mu_mailbox_create (mu_mailbox_t *, const char *); 39 extern int mu_mailbox_create (mu_mailbox_t *, const char *);
44 extern int mu_mailbox_create_from_url (mu_mailbox_t *, mu_url_t); 40 extern int mu_mailbox_create_from_url (mu_mailbox_t *, mu_url_t);
......
...@@ -47,9 +47,18 @@ struct _mu_record ...@@ -47,9 +47,18 @@ struct _mu_record
47 int (*_list_p) (mu_record_t, const char *, int); 47 int (*_list_p) (mu_record_t, const char *, int);
48 }; 48 };
49 49
50 /* Defaults */
51 extern int mu_registrar_set_default_scheme (const char *scheme);
52 extern const char *mu_registrar_get_default_scheme (void);
53 extern int mu_registrar_get_default_record (mu_record_t *prec);
54 extern void mu_registrar_set_default_record (mu_record_t record);
55
50 /* Registration. */ 56 /* Registration. */
51 extern int mu_registrar_get_iterator (mu_iterator_t *); 57 extern int mu_registrar_get_iterator (mu_iterator_t *);
52 extern int mu_registrar_get_list (mu_list_t *) __attribute__ ((deprecated)); 58 extern int mu_registrar_get_list (mu_list_t *) __attribute__ ((deprecated));
59
60 extern int mu_registrar_lookup_scheme (const char *scheme,
61 mu_record_t *precord);
53 62
54 extern int mu_registrar_lookup (const char *name, int flags, 63 extern int mu_registrar_lookup (const char *name, int flags,
55 mu_record_t *precord, int *pflags); 64 mu_record_t *precord, int *pflags);
...@@ -101,8 +110,6 @@ extern mu_record_t mu_nntp_record; ...@@ -101,8 +110,6 @@ extern mu_record_t mu_nntp_record;
101 110
102 /* Local Mailbox Unix Mailbox, "mbox:" */ 111 /* Local Mailbox Unix Mailbox, "mbox:" */
103 extern mu_record_t mu_mbox_record; 112 extern mu_record_t mu_mbox_record;
104 /* Local Folder/Mailbox, / */
105 extern mu_record_t mu_path_record;
106 /* Local MH, "mh:" */ 113 /* Local MH, "mh:" */
107 extern mu_record_t mu_mh_record; 114 extern mu_record_t mu_mh_record;
108 /* Maildir, "maildir:" */ 115 /* Maildir, "maildir:" */
...@@ -131,7 +138,6 @@ extern mu_record_t mu_sendmail_record; ...@@ -131,7 +138,6 @@ extern mu_record_t mu_sendmail_record;
131 extern mu_record_t mu_prog_record; 138 extern mu_record_t mu_prog_record;
132 139
133 #define mu_register_all_mbox_formats() do {\ 140 #define mu_register_all_mbox_formats() do {\
134 mu_registrar_record (mu_path_record);\
135 mu_registrar_record (mu_mbox_record);\ 141 mu_registrar_record (mu_mbox_record);\
136 mu_registrar_record (mu_pop_record);\ 142 mu_registrar_record (mu_pop_record);\
137 mu_registrar_record (mu_pops_record);\ 143 mu_registrar_record (mu_pops_record);\
...@@ -139,13 +145,14 @@ extern mu_record_t mu_prog_record; ...@@ -139,13 +145,14 @@ extern mu_record_t mu_prog_record;
139 mu_registrar_record (mu_imaps_record);\ 145 mu_registrar_record (mu_imaps_record);\
140 mu_registrar_record (mu_mh_record);\ 146 mu_registrar_record (mu_mh_record);\
141 mu_registrar_record (mu_maildir_record);\ 147 mu_registrar_record (mu_maildir_record);\
148 mu_registrar_set_default_record (MU_DEFAULT_RECORD);\
142 } while (0) 149 } while (0)
143 150
144 #define mu_register_local_mbox_formats() do {\ 151 #define mu_register_local_mbox_formats() do {\
145 mu_registrar_record (mu_path_record);\
146 mu_registrar_record (mu_mbox_record);\ 152 mu_registrar_record (mu_mbox_record);\
147 mu_registrar_record (mu_mh_record);\ 153 mu_registrar_record (mu_mh_record);\
148 mu_registrar_record (mu_maildir_record);\ 154 mu_registrar_record (mu_maildir_record);\
155 mu_registrar_set_default_record (MU_DEFAULT_RECORD);\
149 } while (0) 156 } while (0)
150 157
151 #define mu_register_remote_mbox_formats() do {\ 158 #define mu_register_remote_mbox_formats() do {\
......
...@@ -71,7 +71,7 @@ struct _mu_acl; ...@@ -71,7 +71,7 @@ struct _mu_acl;
71 struct _mu_server; 71 struct _mu_server;
72 struct _mu_tcp_server; 72 struct _mu_tcp_server;
73 73
74 typedef MU_OFF_TYPE mu_off_t; 74 typedef _MU_OFF_TYPE_ mu_off_t;
75 75
76 typedef struct _mu_address *mu_address_t; 76 typedef struct _mu_address *mu_address_t;
77 typedef struct _mu_attribute *mu_attribute_t; 77 typedef struct _mu_attribute *mu_attribute_t;
...@@ -121,6 +121,8 @@ typedef struct _mu_progmailer *mu_progmailer_t; ...@@ -121,6 +121,8 @@ typedef struct _mu_progmailer *mu_progmailer_t;
121 121
122 #define mu_offsetof(s,f) ((size_t)&((s*)0)->f) 122 #define mu_offsetof(s,f) ((size_t)&((s*)0)->f)
123 #define MU_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) 123 #define MU_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
124
125 #define MU_DEFAULT_RECORD _MU_DEFAULT_RECORD_
124 126
125 #ifdef __cplusplus 127 #ifdef __cplusplus
126 } 128 }
......
...@@ -219,5 +219,6 @@ mu_scm_init () ...@@ -219,5 +219,6 @@ mu_scm_init ()
219 mu_scm_mime_init (); 219 mu_scm_mime_init ();
220 #include "mu_scm.x" 220 #include "mu_scm.x"
221 221
222 mu_registrar_record (mu_path_record); 222 mu_registrar_record (MU_DEFAULT_RECORD);
223 mu_registrar_set_default_record (MU_DEFAULT_RECORD);
223 } 224 }
......
...@@ -46,94 +46,73 @@ ...@@ -46,94 +46,73 @@
46 /* We export url parsing and the initialisation of 46 /* We export url parsing and the initialisation of
47 the mailbox, via the register entry/record. */ 47 the mailbox, via the register entry/record. */
48 48
49 static struct _mu_record _mbox_record =
50 {
51 MU_MBOX_PRIO,
52 MU_MBOX_SCHEME,
53 mu_url_expand_path, /* URL init. */
54 _mailbox_mbox_init, /* Mailbox init. */
55 NULL, /* Mailer init. */
56 _folder_mbox_init, /* Folder init. */
57 NULL, /* No need for an back pointer. */
58 NULL, /* _is_scheme method. */
59 NULL, /* _get_url method. */
60 NULL, /* _get_mailbox method. */
61 NULL, /* _get_mailer method. */
62 NULL /* _get_folder method. */
63 };
64 mu_record_t mu_mbox_record = &_mbox_record;
65
66 static int 49 static int
67 _path_is_scheme (mu_record_t record, mu_url_t url, int flags) 50 _mbox_is_scheme (mu_record_t record, mu_url_t url, int flags)
68 { 51 {
69 int rc = 0; 52 int rc = 0;
70 53
71 if (url && record->scheme) 54 if (mu_url_is_scheme (url, record->scheme))
55 return MU_FOLDER_ATTRIBUTE_FILE & flags;
56
57 if (mu_scheme_autodetect_p (url))
72 { 58 {
73 if (mu_scheme_autodetect_p (url)) 59 struct stat st;
74 { 60 const char *path;
75 struct stat st;
76 const char *path;
77 61
78 mu_url_sget_path (url, &path); 62 mu_url_sget_path (url, &path);
79 if (stat (path, &st) < 0) 63 if (stat (path, &st) < 0)
64 return 0;
65
66 if (S_ISREG (st.st_mode) || S_ISCHR (st.st_mode))
67 {
68 if (st.st_size == 0)
80 { 69 {
81 if (errno == ENOENT) 70 rc |= MU_FOLDER_ATTRIBUTE_FILE;
82 rc |= MU_FOLDER_ATTRIBUTE_FILE;
83 return rc;
84 } 71 }
85 72 else if (flags & MU_FOLDER_ATTRIBUTE_FILE)
86 if (S_ISREG (st.st_mode) || S_ISCHR (st.st_mode))
87 { 73 {
88 if (st.st_size == 0) 74 #if 0
75 /* This effectively sieves out all non-mailbox files,
76 but it makes mu_folder_enumerate crawl, which is
77 intolerable for imap4d LIST command. */
78 int fd = open (path, O_RDONLY);
79 if (fd != -1)
89 { 80 {
90 rc |= MU_FOLDER_ATTRIBUTE_FILE; 81 char buf[5];
82 if (read (fd, buf, 5) == 5)
83 if (memcmp (buf, "From ", 5) == 0)
84 rc |= MU_FOLDER_ATTRIBUTE_FILE;
85 close (fd);
91 } 86 }
92 else if (flags & MU_FOLDER_ATTRIBUTE_FILE)
93 {
94 #if 0
95 /* This effectively sieves out all non-mailbox files,
96 but it makes mu_folder_enumerate crawl, which is
97 intolerable for imap4d LIST command. */
98 int fd = open (path, O_RDONLY);
99 if (fd != -1)
100 {
101 char buf[5];
102 if (read (fd, buf, 5) == 5)
103 if (memcmp (buf, "From ", 5) == 0)
104 rc |= MU_FOLDER_ATTRIBUTE_FILE;
105 close (fd);
106 }
107 #else 87 #else
108 rc |= MU_FOLDER_ATTRIBUTE_FILE; 88 rc |= MU_FOLDER_ATTRIBUTE_FILE;
109 #endif 89 #endif
110 }
111 } 90 }
112
113 if ((flags & MU_FOLDER_ATTRIBUTE_DIRECTORY)
114 && S_ISDIR (st.st_mode))
115 rc |= MU_FOLDER_ATTRIBUTE_DIRECTORY;
116 } 91 }
92
93 if ((flags & MU_FOLDER_ATTRIBUTE_DIRECTORY)
94 && S_ISDIR (st.st_mode))
95 rc |= MU_FOLDER_ATTRIBUTE_DIRECTORY;
117 } 96 }
118 return rc; 97 return rc;
119 } 98 }
120 99
121 static struct _mu_record _path_record = 100 static struct _mu_record _mbox_record =
122 { 101 {
123 MU_PATH_PRIO, 102 MU_MBOX_PRIO,
124 MU_PATH_SCHEME, 103 MU_MBOX_SCHEME,
125 NULL, /* URL init. */ 104 mu_url_expand_path, /* URL init. */
126 _mailbox_mbox_init, /* Mailbox init. */ 105 _mailbox_mbox_init, /* Mailbox init. */
127 NULL, /* Mailer init. */ 106 NULL, /* Mailer init. */
128 _folder_mbox_init, /* Folder init. */ 107 _folder_mbox_init, /* Folder init. */
129 NULL, /* No need for an owner. */ 108 NULL, /* No need for an back pointer. */
130 _path_is_scheme, /* is_scheme method. */ 109 _mbox_is_scheme, /* _is_scheme method. */
131 NULL, /* get_url method. */ 110 NULL, /* _get_url method. */
132 NULL, /* get_mailbox method. */ 111 NULL, /* _get_mailbox method. */
133 NULL, /* get_mailer method. */ 112 NULL, /* _get_mailer method. */
134 NULL /* get_folder method. */ 113 NULL /* _get_folder method. */
135 }; 114 };
136 mu_record_t mu_path_record = &_path_record; 115 mu_record_t mu_mbox_record = &_mbox_record;
137 116
138 /* lsub/subscribe/unsubscribe are not needed. */ 117 /* lsub/subscribe/unsubscribe are not needed. */
139 static void folder_mbox_destroy (mu_folder_t); 118 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) ...@@ -533,7 +533,7 @@ perms_tag_checker (const char *name, mu_list_t tags, mu_list_t args)
533 mu_iterator_next (itr)) 533 mu_iterator_next (itr))
534 { 534 {
535 int flag; 535 int flag;
536 char *p; 536 const char *p;
537 mu_sieve_runtime_tag_t *t; 537 mu_sieve_runtime_tag_t *t;
538 mu_iterator_current (itr, (void **)&t); 538 mu_iterator_current (itr, (void **)&t);
539 if (strcmp (t->tag, "permissions") == 0) 539 if (strcmp (t->tag, "permissions") == 0)
......
...@@ -16,8 +16,12 @@ ...@@ -16,8 +16,12 @@
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */ 17 Boston, MA 02110-1301 USA */
18 18
19 /* Syntax: pipe [:envelope] <program call: string> 19 /* Syntax: pipe [:envelope] <program: string>
20 20
21 The pipe action executes a shell command specified by its
22 argument and pipes the entire message to its standard input.
23 The envelope of the message is included, if the :envelope tag is given.
24
21 Notes/FIXME: 1. it would be nice to implement meta-variables in 25 Notes/FIXME: 1. it would be nice to implement meta-variables in
22 <program call> which would expand to various 26 <program call> which would expand to various
23 items from the message being handled. 27 items from the message being handled.
......
...@@ -232,7 +232,7 @@ sigpipe_handler (int sig MU_ARG_UNUSED) ...@@ -232,7 +232,7 @@ sigpipe_handler (int sig MU_ARG_UNUSED)
232 232
233 /* The test proper */ 233 /* The test proper */
234 234
235 /* Syntax: spamd [":host" <tcp-host: string] 235 /* Syntax: spamd [":host" <tcp-host: string>]
236 [":port" <tcp-port: number> / 236 [":port" <tcp-port: number> /
237 ":socket" <unix-socket: string>] 237 ":socket" <unix-socket: string>]
238 [":user" <name: string>] 238 [":user" <name: string>]
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
23 [:reply_regex <expr: string>] 23 [:reply_regex <expr: string>]
24 [:reply_prefix <prefix: string>] 24 [:reply_prefix <prefix: string>]
25 <reply text: string> 25 <reply text: string>
26 */ 26 */
27 27
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 # include <config.h> 29 # include <config.h>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
32 #include <mailutils/nls.h> 32 #include <mailutils/nls.h>
33 #include <mailutils/debug.h> 33 #include <mailutils/debug.h>
34 #include <mailutils/syslog.h> 34 #include <mailutils/syslog.h>
35 #include <mailutils/registrar.h>
35 #include <syslog.h> 36 #include <syslog.h>
36 37
37 int mu_load_user_rcfile = 1; 38 int mu_load_user_rcfile = 1;
...@@ -73,7 +74,7 @@ mu_gocs_mailbox_init (void *data) ...@@ -73,7 +74,7 @@ mu_gocs_mailbox_init (void *data)
73 } 74 }
74 if (p->mailbox_type) 75 if (p->mailbox_type)
75 { 76 {
76 if (mu_mailbox_set_default_proto (p->mailbox_type)) 77 if (mu_registrar_set_default_scheme (p->mailbox_type))
77 mu_error (_("Invalid mailbox type: %s"), p->mailbox_type); 78 mu_error (_("Invalid mailbox type: %s"), p->mailbox_type);
78 free (p->mailbox_type); 79 free (p->mailbox_type);
79 p->mailbox_type = NULL; 80 p->mailbox_type = NULL;
......
...@@ -77,44 +77,6 @@ mailbox_folder_create (mu_mailbox_t mbox, const char *name, ...@@ -77,44 +77,6 @@ mailbox_folder_create (mu_mailbox_t mbox, const char *name,
77 return rc; 77 return rc;
78 } 78 }
79 79
80 static char *default_proto;
81
82 int
83 mu_mailbox_set_default_proto (const char *proto)
84 {
85 char *p;
86 size_t len = strlen (proto);
87
88 if (proto [len - 1] == ':')
89 {
90 p = strdup (proto);
91 if (!p)
92 return ENOMEM;
93 }
94 else
95 {
96 p = malloc (len + 2);
97 if (!p)
98 return ENOMEM;
99 strcpy (p, proto);
100 p[len] = ':';
101 p[len+1] = 0;
102 }
103
104 if (mu_registrar_lookup (p, MU_FOLDER_ATTRIBUTE_FILE, NULL, NULL))
105 return MU_ERR_NO_HANDLER;
106 if (default_proto)
107 free (default_proto);
108 default_proto = p;
109 return 0;
110 }
111
112 const char *
113 mu_mailbox_get_default_proto ()
114 {
115 return default_proto ? default_proto : "/";
116 }
117
118 static int 80 static int
119 _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name) 81 _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name)
120 { 82 {
...@@ -235,22 +197,10 @@ _create_mailbox (mu_mailbox_t *pmbox, const char *name) ...@@ -235,22 +197,10 @@ _create_mailbox (mu_mailbox_t *pmbox, const char *name)
235 int 197 int
236 mu_mailbox_create (mu_mailbox_t *pmbox, const char *name) 198 mu_mailbox_create (mu_mailbox_t *pmbox, const char *name)
237 { 199 {
238 int rc;
239
240 if (pmbox == NULL) 200 if (pmbox == NULL)
241 return MU_ERR_OUT_PTR_NULL; 201 return MU_ERR_OUT_PTR_NULL;
242 202
243 if (!mu_is_proto (name) && default_proto) 203 return _create_mailbox (pmbox, name);
244 {
245 char *tmp_name = malloc (strlen (default_proto) + strlen (name) + 1);
246 strcpy (tmp_name, default_proto);
247 strcat (tmp_name, name);
248 rc = _create_mailbox (pmbox, tmp_name);
249 free (tmp_name);
250 }
251 else
252 rc = _create_mailbox (pmbox, name);
253 return rc;
254 } 204 }
255 205
256 int 206 int
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
35 #include <mailutils/nls.h> 35 #include <mailutils/nls.h>
36 #include <mailutils/error.h> 36 #include <mailutils/error.h>
37 #include <mailutils/url.h> 37 #include <mailutils/url.h>
38 38 #include <mailutils/mutil.h>
39 #include <registrar0.h> 39 #include <registrar0.h>
40 40
41 /* NOTE: We will leak here since the monitor and the registrar will never 41 /* NOTE: We will leak here since the monitor and the registrar will never
...@@ -43,6 +43,44 @@ ...@@ -43,6 +43,44 @@
43 static mu_list_t registrar_list; 43 static mu_list_t registrar_list;
44 struct mu_monitor registrar_monitor = MU_MONITOR_INITIALIZER; 44 struct mu_monitor registrar_monitor = MU_MONITOR_INITIALIZER;
45 45
46 static mu_record_t mu_default_record;
47
48 void
49 mu_registrar_set_default_record (mu_record_t record)
50 {
51 mu_default_record = record;
52 }
53
54 int
55 mu_registrar_get_default_record (mu_record_t *prec)
56 {
57 if (mu_default_record)
58 {
59 if (prec)
60 *prec = mu_default_record;
61 return 0;
62 }
63 return MU_ERR_NOENT;
64 }
65
66 int
67 mu_registrar_set_default_scheme (const char *scheme)
68 {
69 int status;
70 mu_record_t rec;
71
72 status = mu_registrar_lookup_scheme (scheme, &rec);
73 if (status == 0)
74 mu_default_record = rec;
75 return status;
76 }
77
78 const char *
79 mu_registrar_get_default_scheme ()
80 {
81 return mu_default_record ? mu_default_record->scheme : NULL;
82 }
83
46 static int 84 static int
47 _registrar_get_list (mu_list_t *plist) 85 _registrar_get_list (mu_list_t *plist)
48 { 86 {
...@@ -91,6 +129,34 @@ mu_registrar_get_iterator (mu_iterator_t *pitr) ...@@ -91,6 +129,34 @@ mu_registrar_get_iterator (mu_iterator_t *pitr)
91 } 129 }
92 130
93 int 131 int
132 mu_registrar_lookup_scheme (const char *scheme, mu_record_t *precord)
133 {
134 size_t len;
135 mu_iterator_t iterator;
136 int status = mu_registrar_get_iterator (&iterator);
137 if (status != 0)
138 return status;
139 status = MU_ERR_NOENT;
140 len = strcspn (scheme, ":");
141 for (mu_iterator_first (iterator); !mu_iterator_is_done (iterator);
142 mu_iterator_next (iterator))
143 {
144 mu_record_t record;
145 mu_iterator_current (iterator, (void **)&record);
146 if (strlen (record->scheme) == len
147 && memcmp (record->scheme, scheme, len) == 0)
148 {
149 if (precord)
150 *precord = record;
151 status = 0;
152 break;
153 }
154 }
155 mu_iterator_destroy (&iterator);
156 return status;
157 }
158
159 int
94 mu_registrar_lookup_url (mu_url_t url, int flags, 160 mu_registrar_lookup_url (mu_url_t url, int flags,
95 mu_record_t *precord, int *pflags) 161 mu_record_t *precord, int *pflags)
96 { 162 {
...@@ -116,6 +182,17 @@ mu_registrar_lookup_url (mu_url_t url, int flags, ...@@ -116,6 +182,17 @@ mu_registrar_lookup_url (mu_url_t url, int flags,
116 } 182 }
117 } 183 }
118 mu_iterator_destroy (&iterator); 184 mu_iterator_destroy (&iterator);
185
186 if (status &&
187 /*s FIXME: This check is not enough. */
188 !mu_is_proto (mu_url_to_string (url))
189 && mu_registrar_get_default_record (precord) == 0)
190 {
191 status = 0;
192 if (pflags)
193 *pflags = flags & MU_FOLDER_ATTRIBUTE_FILE; /* FIXME? */
194 }
195
119 return status; 196 return status;
120 } 197 }
121 198
......
...@@ -47,6 +47,7 @@ static struct mu_conf_option mu_conf_option[] = { ...@@ -47,6 +47,7 @@ static struct mu_conf_option mu_conf_option[] = {
47 { "VERSION=" VERSION, N_("Version of this package") }, 47 { "VERSION=" VERSION, N_("Version of this package") },
48 { "SYSCONFDIR=" SYSCONFDIR, N_("System configuration directory") }, 48 { "SYSCONFDIR=" SYSCONFDIR, N_("System configuration directory") },
49 { "MAILSPOOLDIR=" MU_PATH_MAILDIR, N_("Default mail spool directory") }, 49 { "MAILSPOOLDIR=" MU_PATH_MAILDIR, N_("Default mail spool directory") },
50 { "SCHEME=" MU_DEFAULT_SCHEME, N_("Default mailbox type") },
50 { "LOG_FACILITY=" LOG_FACILITY_STRING, N_("Default syslog facility") }, 51 { "LOG_FACILITY=" LOG_FACILITY_STRING, N_("Default syslog facility") },
51 #ifdef USE_LIBPAM 52 #ifdef USE_LIBPAM
52 { "USE_LIBPAM", N_("PAM support") }, 53 { "USE_LIBPAM", N_("PAM support") },
......