Commit 808ca0c2 808ca0c2fc93de54dab7465ec5a11b73d60ce385 by Alain Magloire

implementing sendmail.

1 parent 0d65dd09
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _ATTRIBUTE_H 18 #ifndef _MAILUTILS_ATTRIBUTE_H
19 #define _ATTRIBUTE_H 19 #define _MAILUTILS_ATTRIBUTE_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
...@@ -45,7 +45,9 @@ typedef struct _attribute * attribute_t; ...@@ -45,7 +45,9 @@ typedef struct _attribute * attribute_t;
45 45
46 extern int attribute_create __P ((attribute_t *, void *)); 46 extern int attribute_create __P ((attribute_t *, void *));
47 extern void attribute_destroy __P ((attribute_t *, void *)); 47 extern void attribute_destroy __P ((attribute_t *, void *));
48 extern void * attribute_get_owner __P ((attribute_t));
48 49
50 extern int attribute_is_userflag __P ((attribute_t, int));
49 extern int attribute_is_seen __P ((attribute_t)); 51 extern int attribute_is_seen __P ((attribute_t));
50 extern int attribute_is_answered __P ((attribute_t)); 52 extern int attribute_is_answered __P ((attribute_t));
51 extern int attribute_is_flagged __P ((attribute_t)); 53 extern int attribute_is_flagged __P ((attribute_t));
...@@ -54,6 +56,7 @@ extern int attribute_is_draft __P ((attribute_t)); ...@@ -54,6 +56,7 @@ extern int attribute_is_draft __P ((attribute_t));
54 extern int attribute_is_recent __P ((attribute_t)); 56 extern int attribute_is_recent __P ((attribute_t));
55 extern int attribute_is_read __P ((attribute_t)); 57 extern int attribute_is_read __P ((attribute_t));
56 58
59 extern int attribute_set_userflag __P ((attribute_t, int));
57 extern int attribute_set_seen __P ((attribute_t)); 60 extern int attribute_set_seen __P ((attribute_t));
58 extern int attribute_set_answered __P ((attribute_t)); 61 extern int attribute_set_answered __P ((attribute_t));
59 extern int attribute_set_flagged __P ((attribute_t)); 62 extern int attribute_set_flagged __P ((attribute_t));
...@@ -62,6 +65,7 @@ extern int attribute_set_draft __P ((attribute_t)); ...@@ -62,6 +65,7 @@ extern int attribute_set_draft __P ((attribute_t));
62 extern int attribute_set_recent __P ((attribute_t)); 65 extern int attribute_set_recent __P ((attribute_t));
63 extern int attribute_set_read __P ((attribute_t)); 66 extern int attribute_set_read __P ((attribute_t));
64 67
68 extern int attribute_unset_userflag __P ((attribute_t, int));
65 extern int attribute_unset_seen __P ((attribute_t)); 69 extern int attribute_unset_seen __P ((attribute_t));
66 extern int attribute_unset_answered __P ((attribute_t)); 70 extern int attribute_unset_answered __P ((attribute_t));
67 extern int attribute_unset_flagged __P ((attribute_t)); 71 extern int attribute_unset_flagged __P ((attribute_t));
...@@ -92,4 +96,4 @@ extern int flags_to_string __P ((int flags, char *buf, ...@@ -92,4 +96,4 @@ extern int flags_to_string __P ((int flags, char *buf,
92 } 96 }
93 #endif 97 #endif
94 98
95 #endif /* _ATTRIBUTE_H */ 99 #endif /* _MAILUTILS_ATTRIBUTE_H */
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _AUTH_H 18 #ifndef _MAILUTILS_AUTH_H
19 #define _AUTH_H 19 #define _MAILUTILS_AUTH_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
...@@ -33,30 +33,31 @@ extern "C" { ...@@ -33,30 +33,31 @@ extern "C" {
33 #endif 33 #endif
34 34
35 /* forward declaration */ 35 /* forward declaration */
36 struct _auth; 36 struct _ticket;
37 typedef struct _auth *auth_t; 37 typedef struct _ticket *ticket_t;
38 38
39 extern int auth_create __P ((auth_t *, void *owner)); 39 extern int ticket_create __P ((ticket_t *, void *owner));
40 extern void auth_destroy __P ((auth_t *, void *owner)); 40 extern void ticket_destroy __P ((ticket_t *, void *owner));
41 extern void * ticket_get_owner __P ((ticket_t));
41 42
42 extern int auth_prologue __P ((auth_t)); 43 extern int ticket_pop __P ((ticket_t, const char *, char **));
43 extern int auth_set_prologue __P ((auth_t auth,
44 int (*_prologue) __P ((auth_t)),
45 void *owner));
46 44
47 extern int auth_authenticate __P ((auth_t, char **, char **)); 45 extern int ticket_get_type __P ((ticket_t, char *, size_t, size_t *));
48 extern int auth_set_authenticate __P ((auth_t auth, 46 extern int ticket_set_type __P ((ticket_t, char *));
49 int (*_authenticate)
50 __P ((auth_t, char **, char **)),
51 void *owner));
52 47
53 extern int auth_epilogue __P ((auth_t)); 48 struct _authority;
54 extern int auth_set_epilogue __P ((auth_t auth, 49 typedef struct _authority *authority_t;
55 int (*_epilogue) __P ((auth_t)), 50
56 void *owner)); 51 extern int authority_create __P ((authority_t *, ticket_t, void *));
52 extern void authority_destroy __P ((authority_t *, void *));
53 extern void *authority_get_owner __P ((authority_t));
54 extern int authority_set_ticket __P ((authority_t, ticket_t));
55 extern int authority_get_ticket __P ((authority_t, ticket_t *));
56 extern int authority_authenticate __P ((authority_t));
57 extern int authority_set_authenticate __P ((authority_t, int (*_authenticate) __P ((authority_t)), void *));
57 58
58 #ifdef _cplusplus 59 #ifdef _cplusplus
59 } 60 }
60 #endif 61 #endif
61 62
62 #endif /* _AUTH_H */ 63 #endif /* _MAILUTILS_AUTH_H */
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _BODY_H 18 #ifndef _MAILUTILS_BODY_H
19 #define _BODY_H 19 #define _MAILUTILS_BODY_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 #include <mailutils/stream.h> 22 #include <mailutils/stream.h>
...@@ -39,6 +39,7 @@ typedef struct _body *body_t; ...@@ -39,6 +39,7 @@ typedef struct _body *body_t;
39 39
40 extern int body_create __P ((body_t *, void *owner)); 40 extern int body_create __P ((body_t *, void *owner));
41 extern void body_destroy __P ((body_t *, void *owner)); 41 extern void body_destroy __P ((body_t *, void *owner));
42 extern void * body_get_owner __P ((body_t));
42 43
43 extern int body_get_stream __P ((body_t, stream_t *)); 44 extern int body_get_stream __P ((body_t, stream_t *));
44 extern int body_set_stream __P ((body_t, stream_t, void *owner)); 45 extern int body_set_stream __P ((body_t, stream_t, void *owner));
...@@ -57,4 +58,4 @@ extern int body_set_lines __P ((body_t, int (*_lines) ...@@ -57,4 +58,4 @@ extern int body_set_lines __P ((body_t, int (*_lines)
57 } 58 }
58 #endif 59 #endif
59 60
60 #endif /* _BODY_H */ 61 #endif /* _MAILUTILS_BODY_H */
......
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MAILUTILS_DEBUG_H
19 #define _MAILUTILS_DEBUG_H
20
21 #include <sys/types.h>
22 #include <stdarg.h>
23
24 #ifndef __P
25 #ifdef __STDC__
26 #define __P(args) args
27 #else
28 #define __P(args) ()
29 #endif
30 #endif /*__P */
31
32 #ifdef _cplusplus
33 extern "C" {
34 #endif
35
36 struct _debug;
37 typedef struct _debug* debug_t;
38
39 #define MU_DEBUG_TRACE 1
40 #define MU_DEBUG_PROT 2
41 extern int debug_create __P ((debug_t *, void *owner));
42 extern void debug_destroy __P ((debug_t *, void *owner));
43 extern void * debug_get_owner __P ((debug_t));
44 extern int debug_set_level __P ((debug_t, size_t level));
45 extern int debug_get_level __P ((debug_t, size_t *plevel));
46 extern int debug_print __P ((debug_t debug, size_t level,
47 const char *format, ...));
48 extern int debug_set_print __P ((debug_t, int (*_print) __P ((debug_t, const char *, va_list)), void *owner));
49
50 #ifdef _cplusplus
51 }
52 #endif
53
54 #endif /* _MAILUTILS_DEBUG_H */
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _HEADER_H 18 #ifndef _MAILUTILS_HEADER_H
19 #define _HEADER_H 19 #define _MAILUTILS_HEADER_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 #include <mailutils/stream.h> 22 #include <mailutils/stream.h>
...@@ -70,6 +70,7 @@ typedef struct _header * header_t; ...@@ -70,6 +70,7 @@ typedef struct _header * header_t;
70 extern int header_create __P ((header_t *, const char *, 70 extern int header_create __P ((header_t *, const char *,
71 size_t, void *)); 71 size_t, void *));
72 extern void header_destroy __P ((header_t *, void *)); 72 extern void header_destroy __P ((header_t *, void *));
73 extern void * header_get_owner __P ((header_t));
73 74
74 extern int header_set_value __P ((header_t, const char *, 75 extern int header_set_value __P ((header_t, const char *,
75 const char *, int)); 76 const char *, int));
...@@ -98,4 +99,4 @@ extern int header_set_lines __P ((header_t, int (*_lines) ...@@ -98,4 +99,4 @@ extern int header_set_lines __P ((header_t, int (*_lines)
98 } 99 }
99 #endif 100 #endif
100 101
101 #endif /* HEADER_H */ 102 #endif /* _MAILUTILS_HEADER_H */
......
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MAILUTILS_ITERATOR_H
19 #define _MAILUTILS_ITERATOR_H
20
21 #include <mailutils/list.h>
22 #include <sys/types.h>
23
24 #ifndef __P
25 #ifdef __STDC__
26 #define __P(args) args
27 #else
28 #define __P(args) ()
29 #endif
30 #endif /*__P */
31
32 #ifdef _cplusplus
33 extern "C" {
34 #endif
35
36 struct _iterator;
37 typedef struct _iterator *iterator_t;
38
39 extern int iterator_create __P ((iterator_t *, list_t));
40 extern void iterator_destroy __P ((iterator_t *));
41 extern int iterator_first __P ((iterator_t));
42 extern int iterator_next __P ((iterator_t));
43 extern int iterator_current __P ((iterator_t, void **pitem));
44 extern int iterator_is_done __P ((iterator_t));
45
46 #ifdef _cplusplus
47 }
48 #endif
49
50 #endif /* _MAILUTILS_ITERATOR_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MAILUTILS_LIST_H
19 #define _MAILUTILS_LIST_H
20
21 #include <sys/types.h>
22
23 #ifndef __P
24 # ifdef __STDC__
25 # define __P(args) args
26 # else
27 # define __P(args) ()
28 # endif
29 #endif /*__P */
30
31 #ifdef _cplusplus
32 extern "C" {
33 #endif
34
35 struct _list;
36 typedef struct _list *list_t;
37
38 extern int list_create __P ((list_t *));
39 extern void list_destroy __P ((list_t *));
40 extern int list_append __P ((list_t, void *item));
41 extern int list_prepend __P ((list_t, void *item));
42 extern int list_count __P ((list_t, size_t *pcount));
43 extern int list_remove __P ((list_t, void *item));
44 extern int list_get __P ((list_t, size_t _index, void **pitem));
45
46 #ifdef _cplusplus
47 }
48 #endif
49
50 #endif /* _MAILUTILS_LIST_H */
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _LOCKER_H 18 #ifndef _MAILUTILS_LOCKER_H
19 #define _LOCKER_H 19 #define _MAILUTILS_LOCKER_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
...@@ -55,4 +55,4 @@ extern int locker_unlock __P ((locker_t)); ...@@ -55,4 +55,4 @@ extern int locker_unlock __P ((locker_t));
55 } 55 }
56 #endif 56 #endif
57 57
58 #endif /* _MAILBOX_H */ 58 #endif /* _MAILUTILS_MAILBOX_H */
......
...@@ -15,14 +15,15 @@ ...@@ -15,14 +15,15 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _MAILBOX_H 18 #ifndef _MAILUTILS_MAILBOX_H
19 # define _MAILBOX_H 19 # define _MAILUTILS_MAILBOX_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
23 #include <mailutils/url.h> 23 #include <mailutils/url.h>
24 #include <mailutils/observer.h>
25 #include <mailutils/debug.h>
24 #include <mailutils/message.h> 26 #include <mailutils/message.h>
25 #include <mailutils/attribute.h>
26 #include <mailutils/auth.h> 27 #include <mailutils/auth.h>
27 #include <mailutils/locker.h> 28 #include <mailutils/locker.h>
28 #include <mailutils/stream.h> 29 #include <mailutils/stream.h>
...@@ -40,78 +41,54 @@ extern "C" { ...@@ -40,78 +41,54 @@ extern "C" {
40 # endif 41 # endif
41 #endif /*__P */ 42 #endif /*__P */
42 43
43 /* forward declaration */ 44 /* Forward declaration. */
44 struct _mailbox; 45 struct _mailbox;
45 typedef struct _mailbox *mailbox_t; 46 typedef struct _mailbox *mailbox_t;
46 47
47 /* constructor/destructor and possible types */ 48 /* Constructor/destructor and possible types. */
48 extern int mailbox_create __P ((mailbox_t *, const char *, int id)); 49 extern int mailbox_create __P ((mailbox_t *, const char *, int));
49 extern void mailbox_destroy __P ((mailbox_t *)); 50 extern void mailbox_destroy __P ((mailbox_t *));
50
51 extern int mailbox_create_default __P ((mailbox_t *, const char *)); 51 extern int mailbox_create_default __P ((mailbox_t *, const char *));
52 52
53 /* flags for mailbox_open () */
54 #define MU_MAILBOX_RDONLY MU_STREAM_READ
55 #define MU_MAILBOX_WRONLY MU_STREAM_WRITE
56 #define MU_MAILBOX_RDWR MU_STREAM_RDWR
57 #define MU_MAILBOX_APPEND MU_STREAM_APPEND
58 #define MU_MAILBOX_CREAT MU_STREAM_CREAT
59 #define MU_MAILBOX_NONBLOCK MU_STREAM_NONBLOCK
60
61 extern int mailbox_open __P ((mailbox_t, int flag)); 53 extern int mailbox_open __P ((mailbox_t, int flag));
62 extern int mailbox_close __P ((mailbox_t)); 54 extern int mailbox_close __P ((mailbox_t));
63 55
64 /* messages */ 56 /* Messages. */
65 extern int mailbox_get_message __P ((mailbox_t, size_t msgno, message_t *msg)); 57 extern int mailbox_get_message __P ((mailbox_t, size_t msgno, message_t *));
66 extern int mailbox_append_message __P ((mailbox_t, message_t msg)); 58 extern int mailbox_append_message __P ((mailbox_t, message_t));
67 extern int mailbox_messages_count __P ((mailbox_t, size_t *num)); 59 extern int mailbox_messages_count __P ((mailbox_t, size_t *));
68 extern int mailbox_expunge __P ((mailbox_t)); 60 extern int mailbox_expunge __P ((mailbox_t));
69 61
70 /* stream settings */ 62 /* Update and scanning. */
71 extern int mailbox_get_stream __P ((mailbox_t, stream_t *pstream)); 63 extern int mailbox_size __P ((mailbox_t, off_t *size));
72 extern int mailbox_set_stream __P ((mailbox_t, stream_t stream));
73
74 /* Lock settings */
75 extern int mailbox_get_locker __P ((mailbox_t, locker_t *locker));
76 extern int mailbox_set_locker __P ((mailbox_t, locker_t locker));
77
78 /* Authentication */
79 extern int mailbox_get_auth __P ((mailbox_t, auth_t *auth));
80 extern int mailbox_set_auth __P ((mailbox_t, auth_t auth));
81
82 /* update and scanning*/
83 extern int mailbox_is_updated __P ((mailbox_t)); 64 extern int mailbox_is_updated __P ((mailbox_t));
84 extern int mailbox_scan __P ((mailbox_t, size_t msgno, size_t *count)); 65 extern int mailbox_scan __P ((mailbox_t, size_t no, size_t *count));
85 66
86 /* mailbox size ? */ 67 /* Stream settings. */
87 extern int mailbox_size __P ((mailbox_t, off_t *size)); 68 extern int mailbox_get_stream __P ((mailbox_t, stream_t *));
69 extern int mailbox_set_stream __P ((mailbox_t, stream_t));
88 70
89 extern int mailbox_get_url __P ((mailbox_t, url_t *)); 71 /* Lock settings. */
72 extern int mailbox_get_locker __P ((mailbox_t, locker_t *));
73 extern int mailbox_set_locker __P ((mailbox_t, locker_t));
90 74
91 /* events */ 75 /* Authentication. */
92 #define MU_EVT_MBX_DESTROY 1 76 extern int mailbox_get_ticket __P ((mailbox_t, ticket_t *));
93 #define MU_EVT_MBX_CORRUPTED 2 77 extern int mailbox_set_ticket __P ((mailbox_t, ticket_t));
94 #define MU_EVT_MBX_MSG_ADD 4
95 #define MU_EVT_MBX_PROGRESS 8
96 78
97 extern int mailbox_register __P ((mailbox_t mbox, size_t type, 79 /* URL. */
98 int (*action) (size_t type, void *arg), 80 extern int mailbox_get_url __P ((mailbox_t, url_t *));
99 void *arg)); 81 extern int mailbox_set_url __P ((mailbox_t, url_t));
100 extern int mailbox_deregister __P ((mailbox_t mbox, void *action));
101 82
102 /* trace */ 83 /* For any debuging */
103 #define MU_MAILBOX_DEBUG_TRACE 1 84 extern int mailbox_get_debug __P ((mailbox_t, debug_t *));
104 #define MU_MAILBOX_DEBUG_PROT 2 85 extern int mailbox_set_debug __P ((mailbox_t, debug_t));
105 extern int mailbox_set_debug_level __P ((mailbox_t mbox, size_t level));
106 extern int mailbox_get_debug_level __P ((mailbox_t mbox, size_t *plevel));
107 extern int mailbox_set_debug_print __P ((mailbox_t mbox, int (*debug_print)
108 __P ((void *arg, const char *,
109 size_t)),
110 void *arg));
111 86
87 /* Events. */
88 extern int mailbox_get_observable __P ((mailbox_t, observable_t *));
112 89
113 #ifdef __cplusplus 90 #ifdef __cplusplus
114 } 91 }
115 #endif 92 #endif
116 93
117 #endif /* _MAILBOX_H */ 94 #endif /* _MAILUTILS_MAILBOX_H */
......
...@@ -15,10 +15,14 @@ ...@@ -15,10 +15,14 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _MAILER_H 18 #ifndef _MAILUTILS_MAILER_H
19 #define _MAILER_H 19 #define _MAILUTILS_MAILER_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 #include <mailutils/stream.h>
23 #include <mailutils/observer.h>
24 #include <mailutils/debug.h>
25 #include <mailutils/url.h>
22 #include <mailutils/message.h> 26 #include <mailutils/message.h>
23 27
24 #ifndef __P 28 #ifndef __P
...@@ -37,15 +41,29 @@ extern "C" { ...@@ -37,15 +41,29 @@ extern "C" {
37 struct _mailer; 41 struct _mailer;
38 typedef struct _mailer *mailer_t; 42 typedef struct _mailer *mailer_t;
39 43
40 extern int mailer_create __P ((mailer_t *, message_t)); 44 extern int mailer_create __P ((mailer_t *, const char *, int));
41 extern int mailer_destroy __P ((mailer_t *)); 45 extern void mailer_destroy __P ((mailer_t *));
42 extern int mailer_connect __P ((mailer_t, char *host)); 46
43 extern int mailer_disconnect __P ((mailer_t)); 47 extern int mailer_open __P ((mailer_t, int flags));
44 extern int mailer_send_header __P ((mailer_t, message_t)); 48 extern int mailer_close __P ((mailer_t));
45 extern int mailer_send_message __P ((mailer_t, message_t)); 49
50 extern int mailer_send_message __P ((mailer_t, const char *from,
51 const char *rcpt, int dsn, message_t));
52 /* stream settings */
53 extern int mailer_get_stream __P ((mailer_t, stream_t *));
54 extern int mailer_set_stream __P ((mailer_t, stream_t));
55
56 /* stream settings */
57 extern int mailer_get_debug __P ((mailer_t, debug_t *));
58 extern int mailer_set_debug __P ((mailer_t, debug_t));
59
60 extern int mailer_attach __P ((mailer_t, observer_t));
61 extern int mailer_detach __P ((mailer_t, observer_t));
62
63 extern int mailer_get_url __P ((mailer_t, url_t *));
46 64
47 #ifdef _cplusplus 65 #ifdef _cplusplus
48 } 66 }
49 #endif 67 #endif
50 68
51 #endif /* _MAILER_H */ 69 #endif /* _MAILUTILS_MAILER_H */
......
...@@ -15,14 +15,15 @@ ...@@ -15,14 +15,15 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _MESSAGE_H 18 #ifndef _MAILUTILS_MESSAGE_H
19 #define _MESSAGE_H 19 #define _MAILUTILS_MESSAGE_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 #include <mailutils/stream.h>
22 #include <mailutils/header.h> 23 #include <mailutils/header.h>
23 #include <mailutils/body.h> 24 #include <mailutils/body.h>
25 #include <mailutils/observer.h>
24 #include <mailutils/attribute.h> 26 #include <mailutils/attribute.h>
25 #include <mailutils/stream.h>
26 27
27 28
28 #ifndef __P 29 #ifndef __P
...@@ -47,6 +48,7 @@ typedef struct _message *message_t; ...@@ -47,6 +48,7 @@ typedef struct _message *message_t;
47 48
48 extern int message_create __P ((message_t *, void *owner)); 49 extern int message_create __P ((message_t *, void *owner));
49 extern void message_destroy __P ((message_t *, void *owner)); 50 extern void message_destroy __P ((message_t *, void *owner));
51 extern void * message_get_owner __P ((message_t));
50 52
51 extern int message_get_header __P ((message_t, header_t *)); 53 extern int message_get_header __P ((message_t, header_t *));
52 extern int message_set_header __P ((message_t, header_t, void *owner)); 54 extern int message_set_header __P ((message_t, header_t, void *owner));
...@@ -57,6 +59,11 @@ extern int message_set_body __P ((message_t, body_t, void *owner)); ...@@ -57,6 +59,11 @@ extern int message_set_body __P ((message_t, body_t, void *owner));
57 extern int message_get_stream __P ((message_t, stream_t *)); 59 extern int message_get_stream __P ((message_t, stream_t *));
58 extern int message_set_stream __P ((message_t, stream_t, void *owner)); 60 extern int message_set_stream __P ((message_t, stream_t, void *owner));
59 61
62 extern int message_get_attribute __P ((message_t, attribute_t *));
63 extern int message_set_attribute __P ((message_t, attribute_t, void *));
64
65 extern int message_get_observable __P ((message_t, observable_t *));
66
60 extern int message_is_multipart __P ((message_t, int *)); 67 extern int message_is_multipart __P ((message_t, int *));
61 extern int message_set_is_multipart __P ((message_t, int (*_is_multipart) 68 extern int message_set_is_multipart __P ((message_t, int (*_is_multipart)
62 __P ((message_t, int *)), void *)); 69 __P ((message_t, int *)), void *));
...@@ -81,9 +88,6 @@ extern int message_set_received __P ((message_t, int (*_received) ...@@ -81,9 +88,6 @@ extern int message_set_received __P ((message_t, int (*_received)
81 __P ((message_t, char *, size_t, 88 __P ((message_t, char *, size_t,
82 size_t *)), void *owner)); 89 size_t *)), void *owner));
83 90
84 extern int message_get_attribute __P ((message_t, attribute_t *));
85 extern int message_set_attribute __P ((message_t, attribute_t, void *));
86
87 extern int message_get_num_parts __P ((message_t, size_t *nparts)); 91 extern int message_get_num_parts __P ((message_t, size_t *nparts));
88 extern int message_set_get_num_parts __P ((message_t, int (*_get_num_parts) 92 extern int message_set_get_num_parts __P ((message_t, int (*_get_num_parts)
89 __P ((message_t, size_t *)), 93 __P ((message_t, size_t *)),
...@@ -99,12 +103,6 @@ extern int message_set_uidl __P ((message_t, int (*_get_uidl) ...@@ -99,12 +103,6 @@ extern int message_set_uidl __P ((message_t, int (*_get_uidl)
99 __P ((message_t, char *, size_t, 103 __P ((message_t, char *, size_t,
100 size_t *)), void *owner)); 104 size_t *)), void *owner));
101 105
102 /* events */
103 #define MU_EVT_MSG_DESTROY 32
104 extern int message_register __P ((message_t msg, size_t type, int (*action)
105 __P ((size_t typ, void *arg)), void *arg));
106 extern int message_deregister __P ((message_t msg, void *action));
107
108 /* misc functions */ 106 /* misc functions */
109 extern int message_create_attachment __P ((const char *content_type, 107 extern int message_create_attachment __P ((const char *content_type,
110 const char *encoding, 108 const char *encoding,
...@@ -121,4 +119,4 @@ extern int message_unencapsulate __P ((message_t msg, message_t *newmsg, ...@@ -121,4 +119,4 @@ extern int message_unencapsulate __P ((message_t msg, message_t *newmsg,
121 } 119 }
122 #endif 120 #endif
123 121
124 #endif /* _MESSAGE_H */ 122 #endif /* _MAILUTILS_MESSAGE_H */
......
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
31 #endif /* __P */ 31 #endif /* __P */
32 32
33 /* mime flags */ 33 /* mime flags */
34 #define MIME_INCREAMENTAL_PARSER 0x00000001 34 #define MIME_INCREAMENTAL_PARSER 0x1
35
36 #define MIME_MULTIPART_MIXED 0x1
37 #define MIME_MULTIPART_ALT 0x2
35 38
36 #ifdef _cplusplus 39 #ifdef _cplusplus
37 extern "C" { 40 extern "C" {
......
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _OBSERVER_H
19 #define _OBSERVER_H
20
21 #include <sys/types.h>
22
23 #ifndef __P
24 #ifdef __STDC__
25 #define __P(args) args
26 #else
27 #define __P(args) ()
28 #endif
29 #endif /*__P */
30
31 #ifdef _cplusplus
32 extern "C" {
33 #endif
34
35 struct _observer;
36 struct _observable;
37 typedef struct _observer* observer_t;
38 typedef struct _observable* observable_t;
39
40 #define MU_EVT_MAILBOX_DESTROY 0x001
41 #define MU_EVT_MAILER_DESTROY 0x002
42 #define MU_EVT_MESSAGE_DESTROY 0x004
43 #define MU_EVT_MESSAGE_ADD 0x008
44 #define MU_EVT_MAILBOX_PROGRESS 0x010
45 #define MU_EVT_AUTHORITY_FAILED 0x020
46
47 #define MU_OBSERVER_NO_CHECK 1
48
49 extern int observer_create __P ((observer_t *, void *owner));
50 extern void observer_destroy __P ((observer_t *, void *owner));
51 extern void * observer_get_owner __P ((observer_t));
52 extern int observer_action __P ((observer_t, size_t type));
53 extern int observer_set_action __P ((observer_t, int (*_action) __P ((observer_t, size_t)), void *owner));
54 extern int observer_set_destroy __P ((observer_t, int (*_destroy) __P((observer_t)), void *owner));
55 extern int observer_set_flags __P ((observer_t, int flags));
56
57 extern int observable_create __P ((observable_t *, void *owner));
58 extern void observable_destroy __P ((observable_t *, void *owner));
59 extern void * observable_get_owner __P ((observable_t));
60 extern int observable_attach __P ((observable_t, observer_t observer));
61 extern int observable_detach __P ((observable_t, observer_t observer));
62 extern int observable_notify __P ((observable_t, int type));
63
64 #ifdef _cplusplus
65 }
66 #endif
67
68 #endif /* _OBSERVER_H */
...@@ -15,13 +15,15 @@ ...@@ -15,13 +15,15 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _REGISTRAR_H 18 #ifndef _MAILUTILS_REGISTRAR_H
19 #define _REGISTRAR_H 19 #define _MAILUTILS_REGISTRAR_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
23 #include <mailutils/url.h> 23 #include <mailutils/url.h>
24 #include <mailutils/mailbox.h> 24 #include <mailutils/mailbox.h>
25 #include <mailutils/mailer.h>
26 #include <mailutils/list.h>
25 27
26 #ifndef __P 28 #ifndef __P
27 # ifdef __STDC__ 29 # ifdef __STDC__
...@@ -35,39 +37,87 @@ ...@@ -35,39 +37,87 @@
35 extern "C" { 37 extern "C" {
36 #endif 38 #endif
37 39
38 struct url_registrar 40 struct mailbox_entry;
41 typedef struct mailbox_entry* mailbox_entry_t;
42 struct mailer_entry;
43 typedef struct mailer_entry* mailer_entry_t;
44 struct _registrar_record;
45 typedef struct _registrar_record* registrar_record_t;
46
47 struct mailbox_entry
39 { 48 {
40 const char *scheme; 49 int (*_url_init) __P ((url_t));
41 int (*_create) __P ((url_t *, const char * name)); 50 int (*_mailbox_init) __P ((mailbox_t));
42 void (*_destroy) __P ((url_t *));
43 }; 51 };
44 52 struct mailer_entry
45 struct mailbox_registrar
46 { 53 {
47 const char *name; 54 int (*_url_init) __P ((url_t));
48 int (*_create) __P ((mailbox_t *, const char *name)); 55 int (*_mailer_init) __P ((mailer_t));
49 void (*_destroy) __P ((mailbox_t *));
50 }; 56 };
51 57
52 struct _registrar; 58 struct _record;
53 59 typedef struct _record* record_t;
54 typedef struct _registrar* registrar_t; 60
55 61 /* Registration. */
56 /* mailbox registration */ 62 extern int registrar_get_list __P ((list_t *));
57 extern int registrar_add __P ((struct url_registrar *ureg, 63
58 struct mailbox_registrar *mreg, int *id)); 64 /* Record. */
59 extern int registrar_remove __P ((int id)); 65 extern int record_create __P ((record_t *, void *owner));
60 extern int registrar_get __P ((int id, struct url_registrar **ureg, 66 extern void record_destroy __P ((record_t *));
61 struct mailbox_registrar **mreg)); 67
62 extern int registrar_num __P ((size_t *num)); 68 extern int record_is_scheme __P ((record_t, const char *));
63 extern int registrar_get_entry __P ((size_t num, struct url_registrar **ureg, 69 extern int record_set_scheme __P ((record_t, const char *));
64 struct mailbox_registrar **mreg, 70 extern int record_set_is_scheme __P ((record_t, int (*_is_scheme)
65 int *id)); 71 __P ((const char *))));
66 extern int registrar_list __P ((struct url_registrar **ureg, 72 extern int record_get_mailbox __P ((record_t, mailbox_entry_t *));
67 struct mailbox_registrar **mreg, 73 extern int record_set_mailbox __P ((record_t, mailbox_entry_t));
68 int *id, registrar_t *reg)); 74 extern int record_set_get_mailbox __P ((record_t, int (*_get_mailbox)
75 __P ((mailbox_entry_t *))));
76 extern int record_get_mailer __P ((record_t, mailer_entry_t *));
77 extern int record_set_mailer __P ((record_t, mailer_entry_t));
78 extern int record_set_get_mailer __P ((record_t, int (*_get_mailer)
79 __P ((mailer_entry_t *))));
80
81 #define MU_POP_PORT 110
82 #define MU_POP_SCHEME "pop://"
83 #define MU_POP_SCHEME_LEN 6
84 extern int url_pop_init __P ((url_t));
85 extern mailbox_entry_t pop_entry;
86 extern record_t pop_record;
87
88 #define MU_MBOX_SCHEME "mbox:"
89 #define MU_MBOX_SCHEME_LEN 5
90 extern int url_mbox_init __P ((url_t));
91 extern mailbox_entry_t mbox_entry;
92 extern record_t mbox_record;
93
94 #define MU_FILE_SCHEME "file:"
95 #define MU_FILE_SCHEME_LEN 5
96 extern int url_file_init __P ((url_t));
97 extern mailbox_entry_t file_entry;
98 extern record_t file_record;
99
100 #define MU_PATH_SCHEME "/"
101 #define MU_PATH_SCHEME_LEN 1
102 extern int url_path_init __P ((url_t));
103 extern mailbox_entry_t path_entry;
104 extern record_t path_record;
105
106 #define MU_SMTP_SCHEME "smtp://"
107 #define MU_SMTP_SCHEME_LEN 7
108 #define MU_SMTP_PORT 25
109 extern int url_smtp_init __P ((url_t));
110 extern mailer_entry_t smtp_entry;
111 extern record_t smtp_record;
112
113 #define MU_SENDMAIL_SCHEME "sendmail:"
114 #define MU_SENDMAIL_SCHEME_LEN 9
115 extern int url_sendmail_init __P ((url_t));
116 extern mailer_entry_t sendmail_entry;
117 extern record_t sendmail_record;
118
69 #ifdef _cplusplus 119 #ifdef _cplusplus
70 } 120 }
71 #endif 121 #endif
72 122
73 #endif /* _REGISTRAR_H */ 123 #endif /* _MAILUTILS_REGISTRAR_H */
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _STREAM_H 18 #ifndef _MAILUTILS_STREAM_H
19 # define _STREAM_H 19 # define _MAILUTILS_STREAM_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
...@@ -44,11 +44,17 @@ typedef struct _stream *stream_t; ...@@ -44,11 +44,17 @@ typedef struct _stream *stream_t;
44 /* stream will be destroy on stream_destroy */ 44 /* stream will be destroy on stream_destroy */
45 #define MU_STREAM_NO_CHECK 0x00000040 45 #define MU_STREAM_NO_CHECK 0x00000040
46 46
47 extern int stream_create __P ((stream_t *, int flags, void *owner)); 47 /* Identity of the stream. */
48 #define MU_STREAM_POP 0x00001000
49 #define MU_STREAM_IMAP 0x00002000
50 #define MU_STREAM_FILE 0x00004000
51 #define MU_STREAM_SMTP 0x00008000
52 #define MU_STREAM_SENDMAIL 0x00010000
48 53
54 extern int stream_create __P ((stream_t *, int flags, void *owner));
49 extern void stream_destroy __P ((stream_t *, void *owner)); 55 extern void stream_destroy __P ((stream_t *, void *owner));
50 extern int stream_set_destroy __P ((stream_t, void (*_destroy) 56 extern int stream_set_destroy __P ((stream_t, void (*_destroy) __P ((stream_t)), void *owner));
51 __P ((stream_t)), void *owner)); 57 extern void * stream_get_owner __P ((stream_t));
52 58
53 extern int stream_open __P ((stream_t, const char *, int, int)); 59 extern int stream_open __P ((stream_t, const char *, int, int));
54 extern int stream_set_open __P ((stream_t, int (*_open) 60 extern int stream_set_open __P ((stream_t, int (*_open)
...@@ -97,7 +103,7 @@ extern int stream_set_flush __P ((stream_t, int (*_flush) ...@@ -97,7 +103,7 @@ extern int stream_set_flush __P ((stream_t, int (*_flush)
97 __P ((stream_t)), void *owner)); 103 __P ((stream_t)), void *owner));
98 104
99 extern int stream_get_flags __P ((stream_t, int *pflags)); 105 extern int stream_get_flags __P ((stream_t, int *pflags));
100 extern int stream_set_flags __P ((stream_t, int flags, void *owner)); 106 extern int stream_set_flags __P ((stream_t, int flags));
101 107
102 #define MU_STREAM_STATE_OPEN 1 108 #define MU_STREAM_STATE_OPEN 1
103 #define MU_STREAM_STATE_READ 2 109 #define MU_STREAM_STATE_READ 2
...@@ -118,4 +124,4 @@ extern int tcp_stream_create __P ((stream_t *stream)); ...@@ -118,4 +124,4 @@ extern int tcp_stream_create __P ((stream_t *stream));
118 } 124 }
119 #endif 125 #endif
120 126
121 #endif /* _STREAM_H */ 127 #endif /* _MAILUTILS_STREAM_H */
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _TRANSCODE_H 18 #ifndef _MAILUTILS_TRANSCODE_H
19 #define _TRANSCODE_H 19 #define _MAILUTILS_TRANSCODE_H
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
...@@ -53,4 +53,4 @@ extern int transcode_set_stream __P ((transcoder_t tc, stream_t is)); ...@@ -53,4 +53,4 @@ extern int transcode_set_stream __P ((transcoder_t tc, stream_t is));
53 } 53 }
54 #endif 54 #endif
55 55
56 #endif /* _TRANSCODE_H */ 56 #endif /* _MAILUTILS_TRANSCODE_H */
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #ifndef _URL_H 18 #ifndef _MAILUTILS_URL_H
19 #define _URL_H 1 19 #define _MAILUTILS_URL_H 1
20 20
21 #include <sys/types.h> 21 #include <sys/types.h>
22 22
...@@ -37,32 +37,20 @@ struct _url; ...@@ -37,32 +37,20 @@ struct _url;
37 typedef struct _url * url_t; 37 typedef struct _url * url_t;
38 38
39 extern int url_create __P ((url_t *, const char *name)); 39 extern int url_create __P ((url_t *, const char *name));
40 extern void url_destroy __P ((url_t *)); 40 extern void url_destroy __P ((url_t *));
41 41
42 extern int url_get_id __P ((const url_t, int *id)); 42 extern int url_get_scheme __P ((const url_t, char *, size_t, size_t *));
43 43 extern int url_get_user __P ((const url_t, char *, size_t, size_t *));
44 extern int url_get_scheme __P ((const url_t, char *sch, 44 extern int url_get_passwd __P ((const url_t, char *, size_t, size_t *));
45 size_t, size_t *)); 45 extern int url_get_auth __P ((const url_t, char *, size_t, size_t *));
46 46 extern int url_get_host __P ((const url_t, char *, size_t, size_t *));
47 extern int url_get_user __P ((const url_t, char *usr, 47 extern int url_get_port __P ((const url_t, long *));
48 size_t, size_t *)); 48 extern int url_get_path __P ((const url_t, char *, size_t, size_t *));
49 49 extern int url_get_query __P ((const url_t, char *, size_t, size_t *));
50 extern int url_get_passwd __P ((const url_t, char *passwd, 50 extern const char* url_to_string __P ((const url_t));
51 size_t, size_t *));
52
53 extern int url_get_host __P ((const url_t, char *host,
54 size_t, size_t *));
55
56 extern int url_get_port __P ((const url_t, long *port));
57
58 extern int url_get_path __P ((const url_t, char *path,
59 size_t, size_t *));
60
61 extern int url_get_query __P ((const url_t, char *qeury,
62 size_t, size_t *));
63 51
64 #ifdef __cplusplus 52 #ifdef __cplusplus
65 } 53 }
66 #endif 54 #endif
67 55
68 #endif /* URL_H */ 56 #endif /* _MAILUTILS_URL_H */
......