Commit 9b9fbddc 9b9fbddceb63fb10af572298fc0404f90384c7de by Jeff Bailey

More libsrc/ to lib/ updates. Add doc/, add mailutils.texi, THANKS

1 parent bc54c260
1 1999-10-10 Jeff Bailey <jbailey@cr499794-a.crdva1.bc.wave.home.com> 1 1999-10-10 Jeff Bailey <jbailey@cr499794-a.crdva1.bc.wave.home.com>
2 2
3 * THANKS: New file
4
5 * doc/mailutils.texi: New File
6 Provided by Alain Magloire <alainm@rcsm.ece.mcgill.ca> with some
7 changes so that Makeinfo reports no errors.
8
9 * doc/Makefile.am: New file
10
11 * configure.in: Deal with libsrc to lib rename
12
3 * pop3d/Makefile.am: Deal with libsrc to lib rename 13 * pop3d/Makefile.am: Deal with libsrc to lib rename
4 14
5 * Makefile.am: Deal with libsrc to lib rename 15 * Makefile.am: Deal with libsrc to lib rename.
16 Add reference to doc/ subdirectory.
6 17
7 * libsrc/: Rename to lib/ 18 * libsrc/: Rename to lib/
8 19
......
1 AUTOMAKE_OPTIONS = gnu 1.4 1 AUTOMAKE_OPTIONS = gnu 1.4
2 2
3 SUBDIRS = lib libmailbox mail pop3d 3 SUBDIRS = lib libmailbox mail pop3d doc
......
1 GNU mailutils THANKS file
2
3 GNU mailutils has originally been written by Jakob Kaivo, Jeff Bailey and
4 Sean 'Shaleh' Perry. Many people further contributed to GNU mailutils by
5 reporting problems, suggesting various improvements or submitting actual
6 code. Here is a list of these people. Help us keep it complete and exempt
7 of errors.
8
9 Alain Magloire <alainm@rcsm.ece.mcgill.ca>
...\ No newline at end of file ...\ No newline at end of file
...@@ -52,5 +52,5 @@ AC_SUBST(AUTHLIBS) ...@@ -52,5 +52,5 @@ AC_SUBST(AUTHLIBS)
52 52
53 dnl Output Makefiles 53 dnl Output Makefiles
54 AC_OUTPUT(Makefile libmailbox/Makefile mail/Makefile pop3d/Makefile 54 AC_OUTPUT(Makefile libmailbox/Makefile mail/Makefile pop3d/Makefile
55 libsrc/Makefile) 55 lib/Makefile doc/Makefile)
56 56
......
1 info_TEXINFOS = mailutils.texi
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename mailutils.info
4 @settitle mailutils, Programming Manual
5 @c %**end of header
6
7 @c This file has the new style title page commands.
8 @c Run `makeinfo' rather than `texinfo-format-buffer'.
9
10 @c smallbook
11
12 @c tex
13 @c \overfullrule=0pt
14 @c end tex
15
16 @include version.texi
17
18 @c Combine indices.
19 @syncodeindex ky cp
20 @syncodeindex pg cp
21 @syncodeindex tp cp
22
23 @defcodeindex op
24 @syncodeindex op fn
25 @syncodeindex vr fn
26
27 @ifinfo
28 @direntry
29 * mailutils: (libmailutils). The GNU mailutils library API.
30 @end direntry
31 This file documents @sc{mailutils}, library API.
32
33
34 Published by the Free Software Foundation,
35 59 Temple Place - Suite 330
36 Boston, MA 02111-1307, USA
37
38 Copyright 1999 Free Software Foundation, Inc.
39
40 Permission is granted to make and distribute verbatim copies of
41 this manual provided the copyright notice and this permission notice
42 are preserved on all copies.
43
44 @ignore
45 Permission is granted to process this file through TeX and print the
46 results, provided the printed document carries copying permission
47 notice identical to this one except for the removal of this paragraph
48 (this paragraph not being relevant to the printed manual).
49
50 @end ignore
51 Permission is granted to copy and distribute modified versions of this
52 manual under the conditions for verbatim copying, provided that the entire
53 resulting derived work is distributed under the terms of a permission
54 notice identical to this one.
55
56 Permission is granted to copy and distribute translations of this manual
57 into another language, under the above conditions for modified versions,
58 except that this permission notice may be stated in a translation approved
59 by the Foundation.
60 @end ifinfo
61
62 @setchapternewpage off
63
64 @titlepage
65 @title mailutils, librairy API.
66 @subtitle version @value{VERSION}, @value{UPDATED}
67 @author Alain Magloire et al.
68
69 @page
70 @vskip 0pt plus 1filll
71 Copyright @copyright{} 1999 Free Software Foundation, Inc.
72
73 @sp 2
74 Published by the Free Software Foundation, @*
75 59 Temple Place - Suite 330, @*
76 Boston, MA 02111-1307, USA
77
78 Permission is granted to make and distribute verbatim copies of
79 this manual provided the copyright notice and this permission notice
80 are preserved on all copies.
81
82 Permission is granted to copy and distribute modified versions of this
83 manual under the conditions for verbatim copying, provided that the entire
84 resulting derived work is distributed under the terms of a permission
85 notice identical to this one.
86
87 Permission is granted to copy and distribute translations of this manual
88 into another language, under the above conditions for modified versions,
89 except that this permission notice may be stated in a translation approved
90 by the Foundation.
91
92 @end titlepage
93 @page
94
95
96 @node Top, Introduction, (dir), (dir)
97 @comment node-name, next, previous, up
98
99 @ifinfo
100 This document was produced for version @value{VERSION} of @sc{gnu}
101 @sc{mailutils}.
102 @end ifinfo
103
104 @menu
105 * Introduction:: GNU @sc{Mailutils} Programmer's manual.
106 * Maildrop:: Creating a maildrop.
107 * URL:: Unified Ressource Locator.
108 * Maildrop Macros:: Maildrop Helper Macros.
109 * Mailbox:: Mailbox API.
110 * Mailbox Macros:: Mailbox Helper Macros.
111 * Headers:: Headers API.
112 * Headers Macros:: Header helper Macros.
113 * Headers Parsed:: Alternatives for Headers.
114 * Headers Regex:: ERE with Headers.
115 * Mime:: Mime API.
116 * Encoding:: Encoding API.
117 * RFC1522:: RFC1522
118 * Quoted Printable:: QP Encoding
119 * Base64:: B64 Encoding
120 * Reporting Bugs:: Reporting Bugs.
121 * Acknowledgement:: Thanks and Credits.
122 * Concept Index:: Topics in this manual.
123 * Index:: All @sc{Mailutils} functions.
124 @end menu
125
126 @node Introduction, Maildrop, Top, Top
127 @comment node-name, next, previous, up
128 @chapter Introduction
129 @cindex Introduction
130
131 @sc{gnu} @sc{Mailutils} offers a general purpose library aimed to provide
132 a rich set of functions for accessing different mail formats and maildrops.
133 For example writing a simple from command that will list @var{From} and
134 @var{Subject} of a folder.
135
136 @example
137 /* sfrom, Simple From */
138 #include <stdio.h>
139 #include <unistd.h>
140 #include <string.h>
141 #include <mailutils.h>
142
143 #define MAILDIR "/usr/spool/mail"
144 #define DATA_SIZE 4096
145
146 int main (int argc, char ** argv)
147 @{
148 char buffer[DATA_SIZE];
149 char * data;
150 maildrop_t mdrop;
151 mailbox_t mbox;
152 header_t rfc822;
153 int status, id, msg_no;
154 int size = DATA_SIZE;
155
156 if (argc == 2)
157 strncpy (buffer, argv[1], sizeof(buffer);
158 else
159 @{
160 char * maildir = getenv ("MAILDIR");
161 char * logname = getlogin();
162 snprintf (buffer, sizeof (buffer), "%s/%s",
163 (maildir) ? maildir : MAILDIR,
164 (logname) ? logname : "nobody");
165 @}
166
167 status = maildrop_create (&mdrop, NULL, buffer, 0);
168 if (status != 0)
169 @{
170 fprintf (stderr, "maildrop_create(%s), %s\n",
171 buffer, strerror(status));
172 exit (EXIT_FAILURE);
173 @}
174
175 maildrop_get_mailbox (mdrop, &mbox);
176
177 status = mailbox_open (mbox);
178 if (status != 0)
179 @{
180 fprintf (stderr, "mailbox_open(%s), %s\n",
181 buffer, strerror(status));
182 exit (EXIT_FAILURE);
183 @}
184
185 header_create (HEADER_RFC822 | HEADER_RFC1522, &rfc822);
186
187 data = xmalloc (size);
188
189 mailbox_stat (mbox, &msg_no, NULL);
190
191 for (id = 0; id < msg_no; id++)
192 @{
193 mailbox_get_header_size (mbox, id, &hd_size));
194 if (hd_size > size)
195 @{
196 data = xrealloc (data, hd_size);
197 size = hd_size;
198 @}
199 mailbox_get_header (mbox, id, data, size);
200 header_get_value(rfc822, "From", buffer, sizeof (buffer);
201 printf ("%s \t", buffer);
202 header_get_value(rfc822, "Subject", buffer, sizeof (buffer);
203 printf ("%s\n", buffer);
204 @}
205
206 free (data);
207 header_destroy (rfc822);
208 return maildrop_destroy (mdrop);
209 @}
210 @end example
211
212 @node Maildrop, URL, Introduction, Top
213 @comment node-name, next, previous, up
214 @chapter Maildrop
215 @cindex Maildrop
216
217 For sending or receiving mail you must create a maildrop indicating the
218 address/folder, this is done by calling @code{maildrop_create} and
219 giving it an @var{url}.
220
221 @findex maildrop_create
222 @findex maildrop_destroy
223 @example
224
225 int maildrop_create (maildrop_t * @var{mid}, const char * @var{url}
226 char * @var{address}, int @var{flags})
227 int maildrop_destroy (maildrop_t * @var{mid})
228
229 @end example
230
231 @noindent
232 @var{mid} will contain maildrop id,
233 @var{url} a url object,
234 @var{addr} is a string that contains the maildrop address,
235 @var{flags} specify execution flags.
236
237 @example
238 struct _maildrop
239 @{
240 /* PRIVATE */
241 url_t url;
242 mailbox_t mbox;
243
244 /* PUBLIC */
245 int (*_get_mailbox) (maildrop_t, mailbox_t *);
246 int (*_get_url) (maildrop_t, url_t *);
247 @};
248
249 typedef struct _maildrop * maildrop_t;
250
251 @end example
252
253 @node URL, Maildrop Macros, Maildrop, Top
254 @comment node-name, next, previous, up
255 @subsection URL
256 @cindex URL
257
258 See rfc2368, rfc2369, rfc2384
259
260 @node Maildrop Macros, Mailbox, URL, Top
261 @comment node-name, next, previous, up
262 @subsection Maildrop Macros
263 @cindex Maildrop Macros
264
265 The predefined macros --taken directly from @file{mailutils.h}--are:
266 @findex maildrop_get_mailbox
267 @findex maildrop_get_url
268 @example
269
270 __inline__ int maildrop_get_mailbox (maildrop_t mdrop, mailbox_t * mbox)
271 @{ *mbox = mdrop->mbox; return (*mbox) 0 : EINVAL; @}
272
273 __inline__ int maildrop_get_url (maildrop_t mdrop, url_t * url)
274 @{ *url = mdrop->url; return (*url) 0 : EINVAL; @}
275
276 @end example
277
278 @node Mailbox, Mailbox Macros, Maildrop Macros, Top
279 @comment node-name, next, previous, up
280 @chapter Mailbox
281 @cindex Mailbox
282
283 Those are different formats to access a folder.
284
285 @table @samp
286 @item POP3
287 Post Office Protocol, Not Implemented.
288 @item IMAP
289 Not Implemented
290 @item QMAIL
291 Not Implemented
292 @item UNIX
293 Sketchy
294 @end table
295
296 @findex mailbox_create
297 @findex mailbox_destroy
298 @example
299
300 int mailbox_create (mailbox_t * @var{mailbox}, int @var{flags})
301
302 int maildrop_destroy (mailbox_t * @var{mailbox})
303
304 @end example
305
306 All implementation shall provide the minimum set of the API :
307
308 @example
309
310 struct _mailbox
311 @{
312 /* Private Data */
313 .....
314 /* Public API */
315 int (*_open) (url_t);
316 int (*_close) (mailbox_t);
317 int (*_set_header) (mailbox_t, size_t *, char *, size_t);
318 int (*_get_header) (mailbox_t, size_t, char *, size_t);
319 int (*_get_header_size) (mailbox_t, size_t, size_t *);
320 int (*_delete) (mailbox_t, size_t);
321 int (*_undelete) (mailbox_t, size_t);
322 int (*_set_body) (mailbox_t, size_t, char *, size_t);
323 int (*_get_body) (mailbox_t, size_t, char *, size_t);
324 int (*_get_body_size) (mailbox_t, size_t, size_t *);
325 int (*_set_timeout) (mailbox_t, size_t);
326 int (*_get_timeout) (mailbox_t, size_t *);
327 int (*_send_envelop) (mailbox_t, size_t, size_t);
328 int (*_stat) (mailbox_t, size_t *, size_t *);
329 int (*_update) (mailbox_t);
330 @};
331
332 typedef struct _mailbox * mailbox_t;
333 @end example
334
335 @node Mailbox Macros, Headers, Mailbox, Top
336 @comment node-name, next, previous, up
337 @subsection Mailbox Macros
338 @cindex Mailbox Macros
339
340 @findex maildrop_get_header
341 @findex maildrop_get_header_size
342 @example
343
344 __inline__ int mailbox_get_header (mailbox_t mbox, int id, char * hdr, int sz)
345 @{ return mbox->_get_header (mbox, id, hdr, sz); @}
346
347 __inline__ int mailbox_get_header_size (mailbox_t mbox, int id, int * sz)
348 @{ return mbox->_get_header_size (mbox, id, sz); @}
349
350 @end example
351
352 @node Headers, Headers Macros, Mailbox Macros, Top
353 @comment node-name, next, previous, up
354 @chapter Headers
355 @cindex Headers
356
357 So far we plan support for RFC822 and RFC1522;
358
359 @example
360 int header_create (int flags, header_t * header);
361
362 int header_destroy (header_t header);
363
364 struct _header
365 @{
366 /* Private */
367 ...
368 /* Public */
369 char * (*_get_value) (header_t, char *);
370 @};
371
372 typedef struct _header * header_t;
373 @end example
374
375 @node Headers Macros, Headers Parsed, Headers, Top
376 @comment node-name, next, previous, up
377 @subsection Headers Macros
378 @cindex Headers Macros
379
380 @example
381 __inline__ int header_get_value (header_t hdr, char * h, char buf, size_t sz)
382 @{ return hdr->_get_value (hdr, h, buf, sz); @}
383 @end example
384
385 @node Headers Parsed, Headers Regex, Headers Macros, Top
386 @comment node-name, next, previous, up
387 @subsection Headers Parsed
388 @cindex Headers Parsed
389
390 Return a hash table, a dictionnary, ???
391
392 @node Headers Regex, Mime, Headers Parsed, Top
393 @comment node-name, next, previous, up
394 @subsection Headers Parsed
395 @cindex Headers Parsed
396
397 Using regular expression ?
398
399 @node Mime, Encoding, Headers Regex, Top
400 @comment node-name, next, previous, up
401 @chapter Mime
402 @cindex Mime
403
404 Mime stuff in the Body.
405
406 @node Encoding, RFC1522, Mime, Top
407 @comment node-name, next, previous, up
408 @chapter Encoding
409 @cindex Encoding
410
411 @node RFC1522, Quoted Printable, Encoding, Top
412 @comment node-name, next, previous, up
413 @subsection RFC1522
414 @cindex RFC1522
415
416 @node Quoted Printable, Base64, RFC1522, Top
417 @comment node-name, next, previous, up
418 @subsection Quoted Printable
419 @cindex Quoted Printable
420
421 @node Base64, Reporting Bugs, Quoted Printable, Top
422 @comment node-name, next, previous, up
423 @subsection Base64
424 @cindex Base64
425
426 @node Reporting Bugs, Acknowledgement, Base64, Top
427 @comment node-name, next, previous, up
428 @chapter Reporting Bugs
429 @cindex Reporting Bugs
430
431 Email bug reports to @email{bug-mailutils@@gnu.org}.
432 Be sure to include the word ``mailutils'' somewhere in the ``Subject:'' field.
433
434 @node Acknowledgement, Concept Index, Reporting Bugs, Top
435 @comment node-name, next, previous, up
436 @chapter Acknowledgement
437 @cindex Acknowledgement
438
439 Jakob Kaivo @email{jkaivo@@ndn.net},
440 Jeff Bailey @email{jbailey@@gnu.org},
441 Sean Perry @email{shaleh@@debian.org},
442
443 @page
444 @node Concept Index , Index, Acknowledgement, Top
445 @comment node-name, next, previous, up
446 @unnumbered Concept Index
447
448 This is a general index of all issues discussed in this manual
449
450 @printindex cp
451 @page
452
453 @node Index, , Concept Index, Top
454 @unnumbered Index
455
456 This is an alphabetical list of all @sc{mailutils} functions.
457
458 @printindex fn
459
460 @contents
461
462 @bye
...@@ -7,4 +7,4 @@ pop3d_DEPENDENDENCIES = ../libmailbox/libmailbox.la ../lib/libgetopt.la\ ...@@ -7,4 +7,4 @@ pop3d_DEPENDENDENCIES = ../libmailbox/libmailbox.la ../lib/libgetopt.la\
7 pop3d_SOURCES = apop.c auth.c capa.c dele.c extra.c pop3d.c pop3d.h\ 7 pop3d_SOURCES = apop.c auth.c capa.c dele.c extra.c pop3d.c pop3d.h\
8 list.c noop.c quit.c retr.c rset.c stat.c top.c uidl.c user.c signal.c 8 list.c noop.c quit.c retr.c rset.c stat.c top.c uidl.c user.c signal.c
9 9
10 pop3d_LDADD = ../libmailbox/libmailbox.la ../libsrc/libmailutils.a @AUTHLIBS@ 10 pop3d_LDADD = ../libmailbox/libmailbox.la ../lib/libmailutils.a @AUTHLIBS@
......