attribute.c auth.c header.c io.c locker.c mailbox.c mbx_imap.c
mbx_mbox.c mbx_mdir.c mbx_mh.c mbx_mmdf.c mbx_pop.c mbx_unix.c message.c mime.c registrar.c url.c url_file.c url_imap.c url_mail.c url_mbox.c url_mdir.c url_mh.c url_mmdf.c url_pop.c url_unix.c include/private/mailbox0.h include/private/mbx_imap.h include/private/mbx_mbox.h include/private/mbx_mdir.h include/private/mbx_mmdf.h include/private/mbx_pop.h include/private/mbx_unix.h include/private/message0.h include/private/mime0.h include/private/url0.h include/public/attribute.h include/public/auth.h include/public/event.h include/public/header.h include/public/io.h include/public/locker.h include/public/mailbox.h include/public/message.h include/public/mime.h include/public/registrar.h include/public/transcode.h include/public/url.h changed all the *_init to *_create(). added *_lines() functions optimisation of the parsing.
Showing
47 changed files
with
176 additions
and
153 deletions
... | @@ -15,29 +15,15 @@ | ... | @@ -15,29 +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 | #include <attribute.h> | 18 | #include <attribute0.h> |
19 | 19 | ||
20 | #include <sys/types.h> | 20 | #include <sys/types.h> |
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <string.h> | 22 | #include <string.h> |
23 | #include <errno.h> | 23 | #include <errno.h> |
24 | 24 | ||
25 | #define MU_ATTRIBUTE_SEEN ((int)1) | ||
26 | #define MU_ATTRIBUTE_ANSWERED (MU_ATTRIBUTE_SEEN << 1) | ||
27 | #define MU_ATTRIBUTE_FLAGGED (MU_ATTRIBUTE_ANSWERED << 1) | ||
28 | #define MU_ATTRIBUTE_DELETED (MU_ATTRIBUTE_FLAGGED << 1) | ||
29 | #define MU_ATTRIBUTE_DRAFT (MU_ATTRIBUTE_DELETED << 1) | ||
30 | #define MU_ATTRIBUTE_RECENT (MU_ATTRIBUTE_DRAFT << 1) | ||
31 | #define MU_ATTRIBUTE_READ (MU_ATTRIBUTE_RECENT << 1) | ||
32 | |||
33 | struct _attribute | ||
34 | { | ||
35 | size_t flag; | ||
36 | void *owner; | ||
37 | }; | ||
38 | |||
39 | int | 25 | int |
40 | attribute_init (attribute_t *pattr, void *owner) | 26 | attribute_create (attribute_t *pattr, void *owner) |
41 | { | 27 | { |
42 | attribute_t attr; | 28 | attribute_t attr; |
43 | if (pattr == NULL || owner == NULL) | 29 | if (pattr == NULL || owner == NULL) |
... | @@ -274,7 +260,7 @@ string_to_attribute (const char *buffer, size_t len, | ... | @@ -274,7 +260,7 @@ string_to_attribute (const char *buffer, size_t len, |
274 | char *sep; | 260 | char *sep; |
275 | int status; | 261 | int status; |
276 | 262 | ||
277 | status = attribute_init (pattr, owner); | 263 | status = attribute_create (pattr, owner); |
278 | if (status != 0) | 264 | if (status != 0) |
279 | return status; | 265 | return status; |
280 | 266 | ... | ... |
... | @@ -57,7 +57,7 @@ struct _header | ... | @@ -57,7 +57,7 @@ struct _header |
57 | }; | 57 | }; |
58 | 58 | ||
59 | int | 59 | int |
60 | header_init (header_t *ph, const char *blurb, size_t len, void *owner) | 60 | header_create (header_t *ph, const char *blurb, size_t len, void *owner) |
61 | { | 61 | { |
62 | header_t h; | 62 | header_t h; |
63 | int status; | 63 | int status; |
... | @@ -66,14 +66,9 @@ header_init (header_t *ph, const char *blurb, size_t len, void *owner) | ... | @@ -66,14 +66,9 @@ header_init (header_t *ph, const char *blurb, size_t len, void *owner) |
66 | return ENOMEM; | 66 | return ENOMEM; |
67 | h->owner = owner; | 67 | h->owner = owner; |
68 | 68 | ||
69 | status = header_parse (h, (char *)blurb, len); | 69 | header_parse (h, (char *)blurb, len); |
70 | if (status != 0) | ||
71 | { | ||
72 | free (h); | ||
73 | return status; | ||
74 | } | ||
75 | 70 | ||
76 | status = stream_init (&(h->stream), h); | 71 | status = stream_create (&(h->stream), h); |
77 | if (status != 0) | 72 | if (status != 0) |
78 | return status; | 73 | return status; |
79 | 74 | ||
... | @@ -132,7 +127,7 @@ header_parse (header_t header, char *blurb, int len) | ... | @@ -132,7 +127,7 @@ header_parse (header_t header, char *blurb, int len) |
132 | return 0; | 127 | return 0; |
133 | 128 | ||
134 | header->blurb_len = len; | 129 | header->blurb_len = len; |
135 | header->blurb = calloc (1, header->blurb_len); | 130 | header->blurb = calloc (1, header->blurb_len + 1); |
136 | if (header->blurb == NULL) | 131 | if (header->blurb == NULL) |
137 | return ENOMEM; | 132 | return ENOMEM; |
138 | memcpy (header->blurb, blurb, header->blurb_len); | 133 | memcpy (header->blurb, blurb, header->blurb_len); |
... | @@ -214,6 +209,7 @@ header_parse (header_t header, char *blurb, int len) | ... | @@ -214,6 +209,7 @@ header_parse (header_t header, char *blurb, int len) |
214 | header->hdr_count++; | 209 | header->hdr_count++; |
215 | } /* for (header_start ...) */ | 210 | } /* for (header_start ...) */ |
216 | 211 | ||
212 | #if 0 | ||
217 | header->blurb_len -= len; | 213 | header->blurb_len -= len; |
218 | if (header->blurb_len <= 0) | 214 | if (header->blurb_len <= 0) |
219 | { | 215 | { |
... | @@ -221,6 +217,10 @@ header_parse (header_t header, char *blurb, int len) | ... | @@ -221,6 +217,10 @@ header_parse (header_t header, char *blurb, int len) |
221 | free (header->hdr); | 217 | free (header->hdr); |
222 | return EINVAL; | 218 | return EINVAL; |
223 | } | 219 | } |
220 | /* always add the separtor LF */ | ||
221 | header->blurb [header->blurb_len] = '\n'; | ||
222 | header->blurb_len++; | ||
223 | #endif | ||
224 | return 0; | 224 | return 0; |
225 | } | 225 | } |
226 | 226 | ||
... | @@ -305,7 +305,24 @@ header_entry_count (header_t header, size_t *pnum) | ... | @@ -305,7 +305,24 @@ header_entry_count (header_t header, size_t *pnum) |
305 | } | 305 | } |
306 | 306 | ||
307 | int | 307 | int |
308 | header_get_size (header_t header, size_t *pnum) | 308 | header_lines (header_t header, size_t *plines) |
309 | { | ||
310 | int n; | ||
311 | size_t t = 0; | ||
312 | if (header == NULL) | ||
313 | return EINVAL; | ||
314 | for (n = header->blurb_len - 1; n >= 0; n--) | ||
315 | { | ||
316 | if (header->blurb[n] == '\n') | ||
317 | t++; | ||
318 | } | ||
319 | if (plines) | ||
320 | *plines = t; | ||
321 | return 0; | ||
322 | } | ||
323 | |||
324 | int | ||
325 | header_size (header_t header, size_t *pnum) | ||
309 | { | 326 | { |
310 | if (header == NULL) | 327 | if (header == NULL) |
311 | return EINVAL; | 328 | return EINVAL; | ... | ... |
... | @@ -42,6 +42,7 @@ struct _mailbox | ... | @@ -42,6 +42,7 @@ struct _mailbox |
42 | char *name; | 42 | char *name; |
43 | auth_t auth; | 43 | auth_t auth; |
44 | locker_t locker; | 44 | locker_t locker; |
45 | netinstance_t netinstance; | ||
45 | url_t url; | 46 | url_t url; |
46 | 47 | ||
47 | /* register events */ | 48 | /* register events */ |
... | @@ -53,7 +54,7 @@ struct _mailbox | ... | @@ -53,7 +54,7 @@ struct _mailbox |
53 | 54 | ||
54 | /* Public methods */ | 55 | /* Public methods */ |
55 | 56 | ||
56 | int (*_init) __P ((mailbox_t *, const char *)); | 57 | int (*_create) __P ((mailbox_t *, const char *)); |
57 | void (*_destroy) __P ((mailbox_t *)); | 58 | void (*_destroy) __P ((mailbox_t *)); |
58 | 59 | ||
59 | int (*_open) __P ((mailbox_t, int flag)); | 60 | int (*_open) __P ((mailbox_t, int flag)); |
... | @@ -75,19 +76,8 @@ struct _mailbox | ... | @@ -75,19 +76,8 @@ struct _mailbox |
75 | }; | 76 | }; |
76 | 77 | ||
77 | /* private */ | 78 | /* private */ |
78 | extern int mailbox_delete __P ((mailbox_t, size_t msgno)); | ||
79 | extern int mailbox_undelete __P ((mailbox_t, size_t msgno)); | ||
80 | extern int mailbox_is_deleted __P ((mailbox_t, size_t msgno)); | ||
81 | extern int mailbox_num_deleted __P ((mailbox_t, size_t *)); | 79 | extern int mailbox_num_deleted __P ((mailbox_t, size_t *)); |
82 | 80 | ||
83 | extern int mailbox_get_auth __P ((mailbox_t mbox, auth_t *auth)); | ||
84 | extern int mailbox_set_auth __P ((mailbox_t mbox, auth_t auth)); | ||
85 | extern int mailbox_get_locker __P ((mailbox_t mbox, locker_t *locker)); | ||
86 | extern int mailbox_set_locker __P ((mailbox_t mbox, locker_t locker)); | ||
87 | extern int mailbox_get_attribute __P ((mailbox_t mbox, size_t msgno, | ||
88 | attribute_t *attr)); | ||
89 | extern int mailbox_set_attribute __P ((mailbox_t mbox, size_t msgno, | ||
90 | attribute_t attr)); | ||
91 | extern int mailbox_notification __P ((mailbox_t mbox, size_t type)); | 81 | extern int mailbox_notification __P ((mailbox_t mbox, size_t type)); |
92 | 82 | ||
93 | 83 | ... | ... |
... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
20 | 20 | ||
21 | #include <mailbox0.h> | 21 | #include <mailbox0.h> |
22 | 22 | ||
23 | extern int mailbox_imap_init __P ((mailbox_t *mbox, const char *name)); | 23 | extern int mailbox_imap_create __P ((mailbox_t *mbox, const char *name)); |
24 | extern void mailbox_imap_destroy __P ((mailbox_t *mbox)); | 24 | extern void mailbox_imap_destroy __P ((mailbox_t *mbox)); |
25 | 25 | ||
26 | extern struct mailbox_type _mailbox_imap_type; | 26 | extern struct mailbox_type _mailbox_imap_type; | ... | ... |
... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
20 | 20 | ||
21 | #include <mailbox.h> | 21 | #include <mailbox.h> |
22 | 22 | ||
23 | extern int mailbox_mbox_init __P ((mailbox_t *mbox, const char *name)); | 23 | extern int mailbox_mbox_create __P ((mailbox_t *mbox, const char *name)); |
24 | extern void mailbox_mbox_destroy __P ((mailbox_t *mbox)); | 24 | extern void mailbox_mbox_destroy __P ((mailbox_t *mbox)); |
25 | 25 | ||
26 | extern struct mailbox_type _mailbox_mbox_type; | 26 | extern struct mailbox_type _mailbox_mbox_type; | ... | ... |
... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
20 | 20 | ||
21 | #include <mailbox0.h> | 21 | #include <mailbox0.h> |
22 | 22 | ||
23 | extern int mailbox_maildir_init __P ((mailbox_t *mbox, const char *name)); | 23 | extern int mailbox_maildir_create __P ((mailbox_t *mbox, const char *name)); |
24 | extern void mailbox_maildir_destroy __P ((mailbox_t *mbox)); | 24 | extern void mailbox_maildir_destroy __P ((mailbox_t *mbox)); |
25 | 25 | ||
26 | extern struct mailbox_type _mailbox_maildir_type; | 26 | extern struct mailbox_type _mailbox_maildir_type; | ... | ... |
... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
20 | 20 | ||
21 | #include <mailbox0.h> | 21 | #include <mailbox0.h> |
22 | 22 | ||
23 | extern int mailbox_mmdf_init __P ((mailbox_t *mbox, const char *name)); | 23 | extern int mailbox_mmdf_create __P ((mailbox_t *mbox, const char *name)); |
24 | extern void mailbox_mmdf_destroy __P ((mailbox_t *mbox)); | 24 | extern void mailbox_mmdf_destroy __P ((mailbox_t *mbox)); |
25 | 25 | ||
26 | extern struct mailbox_type _mailbox_mmdf_type; | 26 | extern struct mailbox_type _mailbox_mmdf_type; | ... | ... |
... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
20 | 20 | ||
21 | #include <mailbox0.h> | 21 | #include <mailbox0.h> |
22 | 22 | ||
23 | extern int mailbox_pop_init __P ((mailbox_t *mbox, const char *name)); | 23 | extern int mailbox_pop_create __P ((mailbox_t *mbox, const char *name)); |
24 | extern void mailbox_pop_destroy __P ((mailbox_t *mbox)); | 24 | extern void mailbox_pop_destroy __P ((mailbox_t *mbox)); |
25 | 25 | ||
26 | extern struct mailbox_type _mailbox_pop_type; | 26 | extern struct mailbox_type _mailbox_pop_type; | ... | ... |
... | @@ -24,7 +24,7 @@ | ... | @@ -24,7 +24,7 @@ |
24 | extern "C" { | 24 | extern "C" { |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | extern int mailbox_unix_init __P ((mailbox_t *mbox, const char *name)); | 27 | extern int mailbox_unix_create __P ((mailbox_t *mbox, const char *name)); |
28 | extern void mailbox_unix_destroy __P ((mailbox_t *mbox)); | 28 | extern void mailbox_unix_destroy __P ((mailbox_t *mbox)); |
29 | 29 | ||
30 | extern struct mailbox_type _mailbox_unix_type; | 30 | extern struct mailbox_type _mailbox_unix_type; | ... | ... |
... | @@ -39,20 +39,6 @@ extern "C" { | ... | @@ -39,20 +39,6 @@ extern "C" { |
39 | # endif | 39 | # endif |
40 | #endif /*__P */ | 40 | #endif /*__P */ |
41 | 41 | ||
42 | /* The notion of body_t is not exported outside, | ||
43 | * there was no need for yet another object. | ||
44 | * since only floating messages need them. The functions | ||
45 | * that manipulate those objects are static to message.c | ||
46 | * | ||
47 | */ | ||
48 | struct _body | ||
49 | { | ||
50 | FILE *file; | ||
51 | void *owner; | ||
52 | }; | ||
53 | |||
54 | typedef struct _body * body_t; | ||
55 | |||
56 | /* forward declaration */ | 42 | /* forward declaration */ |
57 | struct _message | 43 | struct _message |
58 | { | 44 | { |
... | @@ -79,9 +65,9 @@ struct _message | ... | @@ -79,9 +65,9 @@ struct _message |
79 | int (*_get_stream) __P ((message_t msg, stream_t *)); | 65 | int (*_get_stream) __P ((message_t msg, stream_t *)); |
80 | int (*_set_stream) __P ((message_t msg, stream_t, void *owner)); | 66 | int (*_set_stream) __P ((message_t msg, stream_t, void *owner)); |
81 | 67 | ||
82 | int (*_size) __P ((message_t msg, size_t *size)); | 68 | int (*_from) __P ((message_t msg, char *, size_t, size_t *)); |
69 | int (*_received) __P ((message_t msg, char *, size_t, size_t *)); | ||
83 | 70 | ||
84 | int (*_clone) __P ((message_t msg, message_t *cmsg)); | ||
85 | }; | 71 | }; |
86 | 72 | ||
87 | #ifdef _cplusplus | 73 | #ifdef _cplusplus | ... | ... |
... | @@ -47,7 +47,7 @@ struct _url | ... | @@ -47,7 +47,7 @@ struct _url |
47 | 47 | ||
48 | void *data; | 48 | void *data; |
49 | 49 | ||
50 | int (*_init) __P ((url_t *url, const char *name)); | 50 | int (*_create) __P ((url_t *url, const char *name)); |
51 | void (*_destroy) __P ((url_t *url)); | 51 | void (*_destroy) __P ((url_t *url)); |
52 | 52 | ||
53 | /* Methods */ | 53 | /* Methods */ | ... | ... |
... | @@ -35,7 +35,7 @@ extern "C" { | ... | @@ -35,7 +35,7 @@ extern "C" { |
35 | struct _attribute; | 35 | struct _attribute; |
36 | typedef struct _attribute * attribute_t; | 36 | typedef struct _attribute * attribute_t; |
37 | 37 | ||
38 | extern int attribute_init __P ((attribute_t *, void *owner)); | 38 | extern int attribute_create __P ((attribute_t *, void *owner)); |
39 | extern void attribute_destroy __P ((attribute_t *, void *owner)); | 39 | extern void attribute_destroy __P ((attribute_t *, void *owner)); |
40 | 40 | ||
41 | extern int attribute_is_seen __P ((attribute_t)); | 41 | extern int attribute_is_seen __P ((attribute_t)); | ... | ... |
... | @@ -36,7 +36,7 @@ extern "C" { | ... | @@ -36,7 +36,7 @@ extern "C" { |
36 | struct _auth; | 36 | struct _auth; |
37 | typedef struct _auth *auth_t; | 37 | typedef struct _auth *auth_t; |
38 | 38 | ||
39 | extern int auth_init __P ((auth_t *, void *owner)); | 39 | extern int auth_create __P ((auth_t *, void *owner)); |
40 | extern void auth_destroy __P ((auth_t *, void *owner)); | 40 | extern void auth_destroy __P ((auth_t *, void *owner)); |
41 | 41 | ||
42 | extern int auth_prologue __P ((auth_t)); | 42 | extern int auth_prologue __P ((auth_t)); | ... | ... |
... | @@ -67,7 +67,7 @@ extern "C" { | ... | @@ -67,7 +67,7 @@ extern "C" { |
67 | struct _header; | 67 | struct _header; |
68 | typedef struct _header * header_t; | 68 | typedef struct _header * header_t; |
69 | 69 | ||
70 | extern int header_init __P ((header_t *, const char *blurb, | 70 | extern int header_create __P ((header_t *, const char *blurb, |
71 | size_t ln, void *owner)); | 71 | size_t ln, void *owner)); |
72 | extern void header_destroy __P ((header_t *, void *owner)); | 72 | extern void header_destroy __P ((header_t *, void *owner)); |
73 | 73 | ||
... | @@ -81,7 +81,8 @@ extern int header_entry_name __P ((header_t, size_t num, char *buf, | ... | @@ -81,7 +81,8 @@ extern int header_entry_name __P ((header_t, size_t num, char *buf, |
81 | extern int header_entry_value __P ((header_t, size_t num, char *buf, | 81 | extern int header_entry_value __P ((header_t, size_t num, char *buf, |
82 | size_t buflen, size_t *total)); | 82 | size_t buflen, size_t *total)); |
83 | extern int header_get_stream __P ((header_t, stream_t *stream)); | 83 | extern int header_get_stream __P ((header_t, stream_t *stream)); |
84 | extern int header_get_size __P ((header_t, size_t *size)); | 84 | extern int header_size __P ((header_t, size_t *size)); |
85 | extern int header_lines __P ((header_t, size_t *lines)); | ||
85 | 86 | ||
86 | #ifdef _cplusplus | 87 | #ifdef _cplusplus |
87 | } | 88 | } | ... | ... |
... | @@ -35,7 +35,7 @@ extern "C" { /*}*/ | ... | @@ -35,7 +35,7 @@ extern "C" { /*}*/ |
35 | struct _stream; | 35 | struct _stream; |
36 | typedef struct _stream *stream_t; | 36 | typedef struct _stream *stream_t; |
37 | 37 | ||
38 | extern int stream_init __P ((stream_t *, void *owner)); | 38 | extern int stream_create __P ((stream_t *, void *owner)); |
39 | extern void stream_destroy __P ((stream_t *, void *owner)); | 39 | extern void stream_destroy __P ((stream_t *, void *owner)); |
40 | 40 | ||
41 | extern int stream_set_fd __P ((stream_t, | 41 | extern int stream_set_fd __P ((stream_t, | ... | ... |
... | @@ -35,7 +35,7 @@ extern "C" { | ... | @@ -35,7 +35,7 @@ extern "C" { |
35 | struct _locker; | 35 | struct _locker; |
36 | typedef struct _locker *locker_t; | 36 | typedef struct _locker *locker_t; |
37 | 37 | ||
38 | extern int locker_init __P ((locker_t *, char *filename, | 38 | extern int locker_create __P ((locker_t *, char *filename, |
39 | size_t len, int flags)); | 39 | size_t len, int flags)); |
40 | extern void locker_destroy __P ((locker_t *)); | 40 | extern void locker_destroy __P ((locker_t *)); |
41 | 41 | ... | ... |
... | @@ -18,13 +18,14 @@ | ... | @@ -18,13 +18,14 @@ |
18 | #ifndef _MAILBOX_H | 18 | #ifndef _MAILBOX_H |
19 | # define _MAILBOX_H | 19 | # define _MAILBOX_H |
20 | 20 | ||
21 | #include <sys/types.h> | ||
22 | |||
23 | #include <url.h> | 21 | #include <url.h> |
24 | #include <message.h> | 22 | #include <message.h> |
25 | #include <attribute.h> | 23 | #include <attribute.h> |
26 | #include <auth.h> | 24 | #include <auth.h> |
27 | #include <locker.h> | 25 | #include <locker.h> |
26 | #include <net.h> | ||
27 | |||
28 | #include <sys/types.h> | ||
28 | 29 | ||
29 | #ifdef __cplusplus | 30 | #ifdef __cplusplus |
30 | extern "C" { | 31 | extern "C" { |
... | @@ -43,7 +44,7 @@ struct _mailbox; | ... | @@ -43,7 +44,7 @@ struct _mailbox; |
43 | typedef struct _mailbox *mailbox_t; | 44 | typedef struct _mailbox *mailbox_t; |
44 | 45 | ||
45 | /* constructor/destructor and possible types */ | 46 | /* constructor/destructor and possible types */ |
46 | extern int mailbox_init __P ((mailbox_t *, const char *, int id)); | 47 | extern int mailbox_create __P ((mailbox_t *, const char *, int id)); |
47 | extern void mailbox_destroy __P ((mailbox_t *)); | 48 | extern void mailbox_destroy __P ((mailbox_t *)); |
48 | 49 | ||
49 | /* flags for mailbox_open () */ | 50 | /* flags for mailbox_open () */ |
... | @@ -63,6 +64,10 @@ extern int mailbox_append_message __P ((mailbox_t, message_t msg)); | ... | @@ -63,6 +64,10 @@ extern int mailbox_append_message __P ((mailbox_t, message_t msg)); |
63 | extern int mailbox_messages_count __P ((mailbox_t, size_t *num)); | 64 | extern int mailbox_messages_count __P ((mailbox_t, size_t *num)); |
64 | extern int mailbox_expunge __P ((mailbox_t)); | 65 | extern int mailbox_expunge __P ((mailbox_t)); |
65 | 66 | ||
67 | /* netinstance settings */ | ||
68 | extern int mailbox_get_netinstance __P ((mailbox_t, netinstance_t *net)); | ||
69 | extern int mailbox_set_netinstance __P ((mailbox_t, netinstance_t net)); | ||
70 | |||
66 | /* Lock settings */ | 71 | /* Lock settings */ |
67 | extern int mailbox_get_locker __P ((mailbox_t, locker_t *locker)); | 72 | extern int mailbox_get_locker __P ((mailbox_t, locker_t *locker)); |
68 | extern int mailbox_set_locker __P ((mailbox_t, locker_t locker)); | 73 | extern int mailbox_set_locker __P ((mailbox_t, locker_t locker)); | ... | ... |
... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
19 | #define _MESSAGE_H | 19 | #define _MESSAGE_H |
20 | 20 | ||
21 | #include <header.h> | 21 | #include <header.h> |
22 | #include <body.h> | ||
22 | #include <attribute.h> | 23 | #include <attribute.h> |
23 | #include <io.h> | 24 | #include <io.h> |
24 | 25 | ||
... | @@ -48,24 +49,38 @@ typedef struct _message *message_t; | ... | @@ -48,24 +49,38 @@ typedef struct _message *message_t; |
48 | * was enough. | 49 | * was enough. |
49 | */ | 50 | */ |
50 | 51 | ||
51 | extern int message_init __P ((message_t *, void *owner)); | 52 | extern int message_create __P ((message_t *, void *owner)); |
52 | extern void message_destroy __P ((message_t *, void *owner)); | 53 | extern void message_destroy __P ((message_t *, void *owner)); |
53 | 54 | ||
54 | extern int message_get_header __P ((message_t, header_t *)); | 55 | extern int message_get_header __P ((message_t, header_t *)); |
55 | extern int message_set_header __P ((message_t, header_t, void *owner)); | 56 | extern int message_set_header __P ((message_t, header_t, void *owner)); |
56 | 57 | ||
58 | extern int message_get_body __P ((message_t, body_t *)); | ||
59 | extern int message_set_body __P ((message_t, body_t, void *owner)); | ||
60 | |||
57 | extern int message_get_stream __P ((message_t, stream_t *)); | 61 | extern int message_get_stream __P ((message_t, stream_t *)); |
58 | extern int message_set_stream __P ((message_t, stream_t, void *owner)); | ||
59 | 62 | ||
60 | extern int message_is_multipart __P ((message_t)); | 63 | extern int message_is_multipart __P ((message_t)); |
61 | 64 | ||
62 | extern int message_get_size __P ((message_t, size_t *)); | 65 | extern int message_size __P ((message_t, size_t *)); |
63 | extern int message_set_size __P ((message_t, size_t, void *owner)); | 66 | extern int message_lines __P ((message_t, size_t *)); |
67 | |||
68 | extern int message_from __P ((message_t, char *, size_t, size_t *)); | ||
69 | extern int message_set_from __P ((message_t, | ||
70 | int (*_from) __P ((message_t, char *, | ||
71 | size_t, size_t *)), | ||
72 | void *owner)); | ||
73 | extern int message_received __P ((message_t, char *, size_t, size_t *)); | ||
74 | extern int message_set_received __P ((message_t, | ||
75 | int (*_received) __P ((message_t, | ||
76 | char *, size_t, | ||
77 | size_t *)), | ||
78 | void *owner)); | ||
64 | 79 | ||
65 | extern int message_get_attribute __P ((message_t, attribute_t *)); | 80 | extern int message_get_attribute __P ((message_t, attribute_t *)); |
66 | extern int message_set_attribute __P ((message_t, attribute_t, void *owner)); | 81 | extern int message_set_attribute __P ((message_t, attribute_t, void *owner)); |
67 | 82 | ||
68 | extern int message_clone __P ((message_t)); | 83 | //extern int message_clone __P ((message_t)); |
69 | 84 | ||
70 | /* events */ | 85 | /* events */ |
71 | #define MU_EVT_MSG_DESTROY 32 | 86 | #define MU_EVT_MSG_DESTROY 32 | ... | ... |
... | @@ -41,7 +41,7 @@ extern "C" { | ... | @@ -41,7 +41,7 @@ extern "C" { |
41 | struct _mime; | 41 | struct _mime; |
42 | typedef struct _mime *mime_t; | 42 | typedef struct _mime *mime_t; |
43 | 43 | ||
44 | int mime_init __P ((mime_t *pmime, message_t msg, int flags)); | 44 | int mime_create __P ((mime_t *pmime, message_t msg, int flags)); |
45 | void mime_destroy __P ((mime_t *pmime)); | 45 | void mime_destroy __P ((mime_t *pmime)); |
46 | int mime_is_multi_part __P ((mime_t mime)); | 46 | int mime_is_multi_part __P ((mime_t mime)); |
47 | int mime_get_part __P ((mime_t mime, int part, message_t *msg)); | 47 | int mime_get_part __P ((mime_t mime, int part, message_t *msg)); | ... | ... |
... | @@ -38,14 +38,14 @@ extern "C" { | ... | @@ -38,14 +38,14 @@ extern "C" { |
38 | struct url_registrar | 38 | struct url_registrar |
39 | { | 39 | { |
40 | const char *scheme; | 40 | const char *scheme; |
41 | int (*_init) __P ((url_t *, const char * name)); | 41 | int (*_create) __P ((url_t *, const char * name)); |
42 | void (*_destroy) __P ((url_t *)); | 42 | void (*_destroy) __P ((url_t *)); |
43 | }; | 43 | }; |
44 | 44 | ||
45 | struct mailbox_registrar | 45 | struct mailbox_registrar |
46 | { | 46 | { |
47 | const char *name; | 47 | const char *name; |
48 | int (*_init) __P ((mailbox_t *, const char *name)); | 48 | int (*_create) __P ((mailbox_t *, const char *name)); |
49 | void (*_destroy) __P ((mailbox_t *)); | 49 | void (*_destroy) __P ((mailbox_t *)); |
50 | }; | 50 | }; |
51 | 51 | ... | ... |
... | @@ -44,7 +44,7 @@ struct _transcoder | ... | @@ -44,7 +44,7 @@ struct _transcoder |
44 | void *tcdata; | 44 | void *tcdata; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | extern int transcode_init __P ((transcoder_t *, char *encoding)); | 47 | extern int transcode_create __P ((transcoder_t *, char *encoding)); |
48 | extern void transcode_destroy __P ((transcoder_t *)); | 48 | extern void transcode_destroy __P ((transcoder_t *)); |
49 | extern int transcode_get_stream __P ((transcoder_t tc, stream_t *pis)); | 49 | extern int transcode_get_stream __P ((transcoder_t tc, stream_t *pis)); |
50 | extern int transcode_set_stream __P ((transcoder_t tc, stream_t is)); | 50 | extern int transcode_set_stream __P ((transcoder_t tc, stream_t is)); | ... | ... |
... | @@ -36,7 +36,7 @@ extern "C" { | ... | @@ -36,7 +36,7 @@ extern "C" { |
36 | struct _url; | 36 | struct _url; |
37 | typedef struct _url * url_t; | 37 | typedef struct _url * url_t; |
38 | 38 | ||
39 | extern int url_init __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_id __P ((const url_t, int *id)); | ... | ... |
... | @@ -22,7 +22,7 @@ | ... | @@ -22,7 +22,7 @@ |
22 | #include <stdio.h> | 22 | #include <stdio.h> |
23 | 23 | ||
24 | int | 24 | int |
25 | stream_init (stream_t *pstream, void *owner) | 25 | stream_create (stream_t *pstream, void *owner) |
26 | { | 26 | { |
27 | stream_t stream; | 27 | stream_t stream; |
28 | if (pstream == NULL || owner == NULL) | 28 | if (pstream == NULL || owner == NULL) | ... | ... |
... | @@ -45,7 +45,7 @@ struct _locker | ... | @@ -45,7 +45,7 @@ struct _locker |
45 | }; | 45 | }; |
46 | 46 | ||
47 | int | 47 | int |
48 | locker_init (locker_t *plocker, char *filename, size_t len, int flags) | 48 | locker_create (locker_t *plocker, char *filename, size_t len, int flags) |
49 | { | 49 | { |
50 | locker_t l; | 50 | locker_t l; |
51 | 51 | ... | ... |
... | @@ -23,6 +23,7 @@ | ... | @@ -23,6 +23,7 @@ |
23 | #include <message0.h> | 23 | #include <message0.h> |
24 | #include <registrar.h> | 24 | #include <registrar.h> |
25 | #include <locker.h> | 25 | #include <locker.h> |
26 | #include <net.h> | ||
26 | 27 | ||
27 | #include <stdlib.h> | 28 | #include <stdlib.h> |
28 | #include <string.h> | 29 | #include <string.h> |
... | @@ -32,23 +33,23 @@ | ... | @@ -32,23 +33,23 @@ |
32 | * Point of entry. | 33 | * Point of entry. |
33 | * Simple, first check if they ask for something specific; with the ID. | 34 | * Simple, first check if they ask for something specific; with the ID. |
34 | * Then try to discover the type of mailbox with the url(name). | 35 | * Then try to discover the type of mailbox with the url(name). |
35 | * Then we call the appropriate mailbox_*type*_init() function. | 36 | * Then we call the appropriate mailbox_*type*_create() function. |
36 | */ | 37 | */ |
37 | int | 38 | int |
38 | mailbox_init (mailbox_t *pmbox, const char *name, int id) | 39 | mailbox_create (mailbox_t *pmbox, const char *name, int id) |
39 | { | 40 | { |
40 | int status = EINVAL; | 41 | int status = EINVAL; |
41 | struct mailbox_registrar *mreg; | 42 | struct mailbox_registrar *mreg; |
42 | url_t url = NULL; | 43 | url_t url = NULL; |
43 | 44 | ||
44 | url_init (&url, name); | 45 | url_create (&url, name); |
45 | 46 | ||
46 | /* 1st guest: if an ID is specify, shortcut */ | 47 | /* 1st guest: if an ID is specify, shortcut */ |
47 | if (id) | 48 | if (id) |
48 | { | 49 | { |
49 | status = registrar_get (id, NULL, &mreg); | 50 | status = registrar_get (id, NULL, &mreg); |
50 | if (status == 0) | 51 | if (status == 0) |
51 | status = mreg->_init (pmbox, name); | 52 | status = mreg->_create (pmbox, name); |
52 | } | 53 | } |
53 | /* 2nd fallback: Use the URL */ | 54 | /* 2nd fallback: Use the URL */ |
54 | else if (url != NULL) | 55 | else if (url != NULL) |
... | @@ -56,7 +57,7 @@ mailbox_init (mailbox_t *pmbox, const char *name, int id) | ... | @@ -56,7 +57,7 @@ mailbox_init (mailbox_t *pmbox, const char *name, int id) |
56 | url_get_id (url, &id); | 57 | url_get_id (url, &id); |
57 | status = registrar_get (id, NULL, &mreg); | 58 | status = registrar_get (id, NULL, &mreg); |
58 | if (status == 0) | 59 | if (status == 0) |
59 | status = mreg->_init (pmbox, name); | 60 | status = mreg->_create (pmbox, name); |
60 | } | 61 | } |
61 | 62 | ||
62 | /* set the URL */ | 63 | /* set the URL */ |
... | @@ -189,6 +190,24 @@ mailbox_get_auth (mailbox_t mbox, auth_t *pauth) | ... | @@ -189,6 +190,24 @@ mailbox_get_auth (mailbox_t mbox, auth_t *pauth) |
189 | } | 190 | } |
190 | 191 | ||
191 | int | 192 | int |
193 | mailbox_set_netinstance (mailbox_t mbox, netinstance_t netinstance) | ||
194 | { | ||
195 | if (mbox == NULL) | ||
196 | return EINVAL; | ||
197 | mbox->netinstance = netinstance; | ||
198 | return 0; | ||
199 | } | ||
200 | |||
201 | int | ||
202 | mailbox_get_netinstance (mailbox_t mbox, netinstance_t *pnetinstance) | ||
203 | { | ||
204 | if (mbox == NULL || pnetinstance == NULL) | ||
205 | return EINVAL; | ||
206 | *pnetinstance = mbox->netinstance; | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | int | ||
192 | mailbox_register (mailbox_t mbox, size_t type, | 211 | mailbox_register (mailbox_t mbox, size_t type, |
193 | int (*action) (size_t type, void *arg), | 212 | int (*action) (size_t type, void *arg), |
194 | void *arg) | 213 | void *arg) | ... | ... |
... | @@ -20,13 +20,13 @@ | ... | @@ -20,13 +20,13 @@ |
20 | #include <errno.h> | 20 | #include <errno.h> |
21 | 21 | ||
22 | 22 | ||
23 | static int mailbox_imap_init (mailbox_t *mbox, const char *name); | 23 | static int mailbox_imap_create (mailbox_t *mbox, const char *name); |
24 | static void mailbox_imap_destroy (mailbox_t *mbox); | 24 | static void mailbox_imap_destroy (mailbox_t *mbox); |
25 | 25 | ||
26 | struct mailbox_registrar _mailbox_imap_registrar = | 26 | struct mailbox_registrar _mailbox_imap_registrar = |
27 | { | 27 | { |
28 | "IMAP4", | 28 | "IMAP4", |
29 | mailbox_imap_init, mailbox_imap_destroy | 29 | mailbox_imap_create, mailbox_imap_destroy |
30 | }; | 30 | }; |
31 | 31 | ||
32 | void | 32 | void |
... | @@ -37,7 +37,7 @@ mailbox_imap_destroy (mailbox_t *mbox) | ... | @@ -37,7 +37,7 @@ mailbox_imap_destroy (mailbox_t *mbox) |
37 | } | 37 | } |
38 | 38 | ||
39 | int | 39 | int |
40 | mailbox_imap_init (mailbox_t *mbox, const char *name) | 40 | mailbox_imap_create (mailbox_t *mbox, const char *name) |
41 | { | 41 | { |
42 | (void)mbox; (void)name; | 42 | (void)mbox; (void)name; |
43 | return ENOSYS; | 43 | return ENOSYS; | ... | ... |
... | @@ -22,13 +22,13 @@ | ... | @@ -22,13 +22,13 @@ |
22 | #include <errno.h> | 22 | #include <errno.h> |
23 | #include <sys/stat.h> | 23 | #include <sys/stat.h> |
24 | 24 | ||
25 | static int mailbox_mbox_init (mailbox_t *mbox, const char *name); | 25 | static int mailbox_mbox_create (mailbox_t *mbox, const char *name); |
26 | static void mailbox_mbox_destroy (mailbox_t *mbox); | 26 | static void mailbox_mbox_destroy (mailbox_t *mbox); |
27 | 27 | ||
28 | struct mailbox_registrar _mailbox_mbox_registrar = | 28 | struct mailbox_registrar _mailbox_mbox_registrar = |
29 | { | 29 | { |
30 | "UNIX_MBOX/Maildir/MMDF", | 30 | "UNIX_MBOX/Maildir/MMDF", |
31 | mailbox_mbox_init, mailbox_mbox_destroy | 31 | mailbox_mbox_create, mailbox_mbox_destroy |
32 | }; | 32 | }; |
33 | 33 | ||
34 | /* | 34 | /* |
... | @@ -45,7 +45,7 @@ struct mailbox_registrar _mailbox_mbox_registrar = | ... | @@ -45,7 +45,7 @@ struct mailbox_registrar _mailbox_mbox_registrar = |
45 | */ | 45 | */ |
46 | 46 | ||
47 | static int | 47 | static int |
48 | mailbox_mbox_init (mailbox_t *mbox, const char *name) | 48 | mailbox_mbox_create (mailbox_t *mbox, const char *name) |
49 | { | 49 | { |
50 | struct stat st; | 50 | struct stat st; |
51 | size_t len; | 51 | size_t len; |
... | @@ -69,7 +69,7 @@ mailbox_mbox_init (mailbox_t *mbox, const char *name) | ... | @@ -69,7 +69,7 @@ mailbox_mbox_init (mailbox_t *mbox, const char *name) |
69 | * For the default is unix if the file does not exist. | 69 | * For the default is unix if the file does not exist. |
70 | */ | 70 | */ |
71 | if (stat (name, &st) < 0) | 71 | if (stat (name, &st) < 0) |
72 | return _mailbox_unix_registrar._init (mbox, name); | 72 | return _mailbox_unix_registrar._create (mbox, name); |
73 | 73 | ||
74 | if (S_ISREG (st.st_mode)) | 74 | if (S_ISREG (st.st_mode)) |
75 | { | 75 | { |
... | @@ -101,7 +101,7 @@ mailbox_mbox_init (mailbox_t *mbox, const char *name) | ... | @@ -101,7 +101,7 @@ mailbox_mbox_init (mailbox_t *mbox, const char *name) |
101 | if (count == 0) /*empty file*/ | 101 | if (count == 0) /*empty file*/ |
102 | { | 102 | { |
103 | close (fd); | 103 | close (fd); |
104 | return _mailbox_unix_registrar._init (mbox, name); | 104 | return _mailbox_unix_registrar._create (mbox, name); |
105 | } | 105 | } |
106 | 106 | ||
107 | if (count >= 5) | 107 | if (count >= 5) |
... | @@ -110,18 +110,18 @@ mailbox_mbox_init (mailbox_t *mbox, const char *name) | ... | @@ -110,18 +110,18 @@ mailbox_mbox_init (mailbox_t *mbox, const char *name) |
110 | { | 110 | { |
111 | /* This is a Unix Mbox */ | 111 | /* This is a Unix Mbox */ |
112 | close (fd); | 112 | close (fd); |
113 | return _mailbox_unix_registrar._init (mbox, name); | 113 | return _mailbox_unix_registrar._create (mbox, name); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | /* Try MMDF */ | 117 | /* Try MMDF */ |
118 | close (fd); | 118 | close (fd); |
119 | #endif | 119 | #endif |
120 | return _mailbox_unix_registrar._init (mbox, name); | 120 | return _mailbox_unix_registrar._create (mbox, name); |
121 | } | 121 | } |
122 | /* Is that true ? Are all directories Maildir ?? */ | 122 | /* Is that true ? Are all directories Maildir ?? */ |
123 | else if (S_ISDIR (st.st_mode)) | 123 | else if (S_ISDIR (st.st_mode)) |
124 | return _mailbox_maildir_registrar._init (mbox, name); | 124 | return _mailbox_maildir_registrar._create (mbox, name); |
125 | 125 | ||
126 | /* Why can't a mailbox be FIFO ? or a DOOR/Portal ??? */ | 126 | /* Why can't a mailbox be FIFO ? or a DOOR/Portal ??? */ |
127 | return EINVAL; | 127 | return EINVAL; | ... | ... |
... | @@ -19,17 +19,17 @@ | ... | @@ -19,17 +19,17 @@ |
19 | #include <registrar0.h> | 19 | #include <registrar0.h> |
20 | #include <errno.h> | 20 | #include <errno.h> |
21 | 21 | ||
22 | static int mailbox_maildir_init (mailbox_t *mbox, const char *name); | 22 | static int mailbox_maildir_create (mailbox_t *mbox, const char *name); |
23 | static void mailbox_maildir_destroy (mailbox_t *mbox); | 23 | static void mailbox_maildir_destroy (mailbox_t *mbox); |
24 | 24 | ||
25 | struct mailbox_registrar _mailbox_maildir_registrar = | 25 | struct mailbox_registrar _mailbox_maildir_registrar = |
26 | { | 26 | { |
27 | "MAILDIR", | 27 | "MAILDIR", |
28 | mailbox_maildir_init, mailbox_maildir_destroy | 28 | mailbox_maildir_create, mailbox_maildir_destroy |
29 | }; | 29 | }; |
30 | 30 | ||
31 | int | 31 | int |
32 | mailbox_maildir_init (mailbox_t *mbox, const char *name) | 32 | mailbox_maildir_create (mailbox_t *mbox, const char *name) |
33 | { | 33 | { |
34 | (void)mbox; (void)name; | 34 | (void)mbox; (void)name; |
35 | return ENOSYS; | 35 | return ENOSYS; | ... | ... |
... | @@ -27,13 +27,13 @@ | ... | @@ -27,13 +27,13 @@ |
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | #include <ctype.h> | 28 | #include <ctype.h> |
29 | 29 | ||
30 | static int mailbox_mh_init (mailbox_t *pmbox, const char *name); | 30 | static int mailbox_mh_create (mailbox_t *pmbox, const char *name); |
31 | static void mailbox_mh_destroy (mailbox_t *pmbox); | 31 | static void mailbox_mh_destroy (mailbox_t *pmbox); |
32 | 32 | ||
33 | struct mailbox_registrar _mailbox_mh_registrar = | 33 | struct mailbox_registrar _mailbox_mh_registrar = |
34 | { | 34 | { |
35 | "MH", | 35 | "MH", |
36 | mailbox_mh_init, mailbox_mh_destroy | 36 | mailbox_mh_create, mailbox_mh_destroy |
37 | }; | 37 | }; |
38 | 38 | ||
39 | typedef struct _mh_data | 39 | typedef struct _mh_data |
... | @@ -43,11 +43,11 @@ typedef struct _mh_data | ... | @@ -43,11 +43,11 @@ typedef struct _mh_data |
43 | 43 | ||
44 | static int mh_open (mailbox_t mbox, int flags); | 44 | static int mh_open (mailbox_t mbox, int flags); |
45 | static int mh_close (mailbox_t mbox); | 45 | static int mh_close (mailbox_t mbox); |
46 | static int mh_scan (mailbox_t mbox, size_t *msgs); | 46 | static int mh_scan (mailbox_t mbox, size_t msgno, size_t *msgs); |
47 | static int mh_sequence(const char *name); | 47 | static int mh_sequence(const char *name); |
48 | 48 | ||
49 | static int | 49 | static int |
50 | mailbox_mh_init (mailbox_t *pmbox, const char *name) | 50 | mailbox_mh_create (mailbox_t *pmbox, const char *name) |
51 | { | 51 | { |
52 | mailbox_t mbox; | 52 | mailbox_t mbox; |
53 | mh_data *data; | 53 | mh_data *data; |
... | @@ -57,10 +57,11 @@ mailbox_mh_init (mailbox_t *pmbox, const char *name) | ... | @@ -57,10 +57,11 @@ mailbox_mh_init (mailbox_t *pmbox, const char *name) |
57 | mbox->name = malloc(strlen(name) + 1); | 57 | mbox->name = malloc(strlen(name) + 1); |
58 | strcpy(mbox->name, name); | 58 | strcpy(mbox->name, name); |
59 | mbox->data = data; | 59 | mbox->data = data; |
60 | mbox->_init = mailbox_mh_init; | 60 | mbox->_create = mailbox_mh_create; |
61 | mbox->_destroy = mailbox_mh_destroy; | 61 | mbox->_destroy = mailbox_mh_destroy; |
62 | mbox->_open = mh_open; | 62 | mbox->_open = mh_open; |
63 | mbox->_close = mh_close; | 63 | mbox->_close = mh_close; |
64 | mbox->_scan = mh_scan; | ||
64 | *pmbox = mbox; | 65 | *pmbox = mbox; |
65 | 66 | ||
66 | return 0; | 67 | return 0; |
... | @@ -110,7 +111,7 @@ mh_close (mailbox_t mbox) | ... | @@ -110,7 +111,7 @@ mh_close (mailbox_t mbox) |
110 | } | 111 | } |
111 | 112 | ||
112 | static int | 113 | static int |
113 | mh_scan (mailbox_t mbox, size_t *msgs) | 114 | mh_scan (mailbox_t mbox, size_t msgno, size_t *msgs) |
114 | { | 115 | { |
115 | struct stat st; | 116 | struct stat st; |
116 | DIR *maildir; | 117 | DIR *maildir; |
... | @@ -119,6 +120,8 @@ mh_scan (mailbox_t mbox, size_t *msgs) | ... | @@ -119,6 +120,8 @@ mh_scan (mailbox_t mbox, size_t *msgs) |
119 | unsigned int count = 0; | 120 | unsigned int count = 0; |
120 | int parse_sequence_file = 0; | 121 | int parse_sequence_file = 0; |
121 | 122 | ||
123 | (void)msgno; | ||
124 | |||
122 | data = mbox->data; | 125 | data = mbox->data; |
123 | 126 | ||
124 | maildir = opendir(mbox->name); | 127 | maildir = opendir(mbox->name); | ... | ... |
... | @@ -20,17 +20,17 @@ | ... | @@ -20,17 +20,17 @@ |
20 | 20 | ||
21 | #include <errno.h> | 21 | #include <errno.h> |
22 | 22 | ||
23 | static int mailbox_mmdf_init (mailbox_t *mbox, const char *name); | 23 | static int mailbox_mmdf_create (mailbox_t *mbox, const char *name); |
24 | static void mailbox_mmdf_destroy (mailbox_t *mbox); | 24 | static void mailbox_mmdf_destroy (mailbox_t *mbox); |
25 | 25 | ||
26 | struct mailbox_registrar _mailbox_mmdf_registrar = | 26 | struct mailbox_registrar _mailbox_mmdf_registrar = |
27 | { | 27 | { |
28 | "MMDF", | 28 | "MMDF", |
29 | mailbox_mmdf_init, mailbox_mmdf_destroy | 29 | mailbox_mmdf_create, mailbox_mmdf_destroy |
30 | }; | 30 | }; |
31 | 31 | ||
32 | static int | 32 | static int |
33 | mailbox_mmdf_init (mailbox_t *mbox, const char *name) | 33 | mailbox_mmdf_create (mailbox_t *mbox, const char *name) |
34 | { | 34 | { |
35 | (void)mbox; (void)name; | 35 | (void)mbox; (void)name; |
36 | return ENOSYS; | 36 | return ENOSYS; | ... | ... |
... | @@ -20,13 +20,13 @@ | ... | @@ -20,13 +20,13 @@ |
20 | 20 | ||
21 | #include <errno.h> | 21 | #include <errno.h> |
22 | 22 | ||
23 | static int mailbox_pop_init (mailbox_t *mbox, const char *name); | 23 | static int mailbox_pop_create (mailbox_t *mbox, const char *name); |
24 | static void mailbox_pop_destroy (mailbox_t *mbox); | 24 | static void mailbox_pop_destroy (mailbox_t *mbox); |
25 | 25 | ||
26 | struct mailbox_registrar _mailbox_pop_registrar = | 26 | struct mailbox_registrar _mailbox_pop_registrar = |
27 | { | 27 | { |
28 | "POP3", | 28 | "POP3", |
29 | mailbox_pop_init, mailbox_pop_destroy | 29 | mailbox_pop_create, mailbox_pop_destroy |
30 | }; | 30 | }; |
31 | 31 | ||
32 | static void | 32 | static void |
... | @@ -37,7 +37,7 @@ mailbox_pop_destroy (mailbox_t *mbox) | ... | @@ -37,7 +37,7 @@ mailbox_pop_destroy (mailbox_t *mbox) |
37 | } | 37 | } |
38 | 38 | ||
39 | static int | 39 | static int |
40 | mailbox_pop_init (mailbox_t *mbox, const char *name) | 40 | mailbox_pop_create (mailbox_t *mbox, const char *name) |
41 | { | 41 | { |
42 | (void)mbox; (void)name; | 42 | (void)mbox; (void)name; |
43 | return ENOSYS; | 43 | return ENOSYS; | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
... | @@ -88,7 +88,7 @@ registrar_add (struct url_registrar *new_ureg, | ... | @@ -88,7 +88,7 @@ registrar_add (struct url_registrar *new_ureg, |
88 | return ENOMEM; | 88 | return ENOMEM; |
89 | } | 89 | } |
90 | } | 90 | } |
91 | mreg->_init = new_mreg->_init; | 91 | mreg->_create = new_mreg->_create; |
92 | mreg->_destroy = new_mreg->_destroy; | 92 | mreg->_destroy = new_mreg->_destroy; |
93 | 93 | ||
94 | /* URL */ | 94 | /* URL */ |
... | @@ -110,7 +110,7 @@ registrar_add (struct url_registrar *new_ureg, | ... | @@ -110,7 +110,7 @@ registrar_add (struct url_registrar *new_ureg, |
110 | return ENOMEM; | 110 | return ENOMEM; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | ureg->_init = new_ureg->_init; | 113 | ureg->_create = new_ureg->_create; |
114 | ureg->_destroy = new_ureg->_destroy; | 114 | ureg->_destroy = new_ureg->_destroy; |
115 | } | 115 | } |
116 | 116 | ... | ... |
... | @@ -39,7 +39,7 @@ static int get_query (const url_t, char *, size_t, size_t *); | ... | @@ -39,7 +39,7 @@ static int get_query (const url_t, char *, size_t, size_t *); |
39 | static int get_id (const url_t, int *); | 39 | static int get_id (const url_t, int *); |
40 | 40 | ||
41 | int | 41 | int |
42 | url_init (url_t * purl, const char *name) | 42 | url_create (url_t * purl, const char *name) |
43 | { | 43 | { |
44 | int status = EINVAL; | 44 | int status = EINVAL; |
45 | struct url_registrar *ureg; | 45 | struct url_registrar *ureg; |
... | @@ -87,7 +87,7 @@ url_init (url_t * purl, const char *name) | ... | @@ -87,7 +87,7 @@ url_init (url_t * purl, const char *name) |
87 | /* Found one initialize it */ | 87 | /* Found one initialize it */ |
88 | if (status == 0) | 88 | if (status == 0) |
89 | { | 89 | { |
90 | status = ureg->_init (purl, name); | 90 | status = ureg->_create (purl, name); |
91 | if (status == 0) | 91 | if (status == 0) |
92 | { | 92 | { |
93 | url_t url = *purl; | 93 | url_t url = *purl; | ... | ... |
... | @@ -23,12 +23,12 @@ | ... | @@ -23,12 +23,12 @@ |
23 | #include <string.h> | 23 | #include <string.h> |
24 | 24 | ||
25 | static void url_file_destroy (url_t *purl); | 25 | static void url_file_destroy (url_t *purl); |
26 | static int url_file_init (url_t *purl, const char *name); | 26 | static int url_file_create (url_t *purl, const char *name); |
27 | 27 | ||
28 | struct url_registrar _url_file_registrar = | 28 | struct url_registrar _url_file_registrar = |
29 | { | 29 | { |
30 | "file:", | 30 | "file:", |
31 | url_file_init, url_file_destroy | 31 | url_file_create, url_file_destroy |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static void | 34 | static void |
... | @@ -48,7 +48,7 @@ url_file_destroy (url_t *purl) | ... | @@ -48,7 +48,7 @@ url_file_destroy (url_t *purl) |
48 | UNIX box | 48 | UNIX box |
49 | */ | 49 | */ |
50 | static int | 50 | static int |
51 | url_file_init (url_t *purl, const char *name) | 51 | url_file_create (url_t *purl, const char *name) |
52 | { | 52 | { |
53 | url_t url; | 53 | url_t url; |
54 | struct url_registrar *ureg = &_url_mbox_registrar; | 54 | struct url_registrar *ureg = &_url_mbox_registrar; |
... | @@ -64,7 +64,7 @@ url_file_init (url_t *purl, const char *name) | ... | @@ -64,7 +64,7 @@ url_file_init (url_t *purl, const char *name) |
64 | return ENOMEM; | 64 | return ENOMEM; |
65 | 65 | ||
66 | /* TYPE */ | 66 | /* TYPE */ |
67 | url->_init = ureg->_init; | 67 | url->_create = ureg->_create; |
68 | url->_destroy = ureg->_destroy; | 68 | url->_destroy = ureg->_destroy; |
69 | 69 | ||
70 | /* SCHEME */ | 70 | /* SCHEME */ | ... | ... |
... | @@ -19,13 +19,13 @@ | ... | @@ -19,13 +19,13 @@ |
19 | #include <registrar.h> | 19 | #include <registrar.h> |
20 | #include <errno.h> | 20 | #include <errno.h> |
21 | 21 | ||
22 | static int url_imap_init (url_t *purl, const char *name); | 22 | static int url_imap_create (url_t *purl, const char *name); |
23 | static void url_imap_destroy (url_t *purl); | 23 | static void url_imap_destroy (url_t *purl); |
24 | 24 | ||
25 | struct url_registrar _url_imap_registrar = | 25 | struct url_registrar _url_imap_registrar = |
26 | { | 26 | { |
27 | "imap://", | 27 | "imap://", |
28 | url_imap_init, url_imap_destroy | 28 | url_imap_create, url_imap_destroy |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static void | 31 | static void |
... | @@ -36,7 +36,7 @@ url_imap_destroy (url_t *purl) | ... | @@ -36,7 +36,7 @@ url_imap_destroy (url_t *purl) |
36 | } | 36 | } |
37 | 37 | ||
38 | static int | 38 | static int |
39 | url_imap_init (url_t *purl, const char *name) | 39 | url_imap_create (url_t *purl, const char *name) |
40 | { | 40 | { |
41 | (void)purl; (void)name; | 41 | (void)purl; (void)name; |
42 | return ENOSYS; | 42 | return ENOSYS; | ... | ... |
... | @@ -19,13 +19,13 @@ | ... | @@ -19,13 +19,13 @@ |
19 | #include <registrar.h> | 19 | #include <registrar.h> |
20 | #include <errno.h> | 20 | #include <errno.h> |
21 | 21 | ||
22 | static int url_mailto_init (url_t *purl, const char *name); | 22 | static int url_mailto_create (url_t *purl, const char *name); |
23 | static void url_mailto_destroy (url_t *purl); | 23 | static void url_mailto_destroy (url_t *purl); |
24 | 24 | ||
25 | struct url_registrar _url_mailto_registrar = | 25 | struct url_registrar _url_mailto_registrar = |
26 | { | 26 | { |
27 | "mailto:", | 27 | "mailto:", |
28 | url_mailto_init, url_mailto_destroy | 28 | url_mailto_create, url_mailto_destroy |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static void | 31 | static void |
... | @@ -36,7 +36,7 @@ url_mailto_destroy (url_t *purl) | ... | @@ -36,7 +36,7 @@ url_mailto_destroy (url_t *purl) |
36 | } | 36 | } |
37 | 37 | ||
38 | static int | 38 | static int |
39 | url_mailto_init (url_t *purl, const char *name) | 39 | url_mailto_create (url_t *purl, const char *name) |
40 | { | 40 | { |
41 | (void)purl; (void)name; | 41 | (void)purl; (void)name; |
42 | return ENOSYS; | 42 | return ENOSYS; | ... | ... |
... | @@ -23,12 +23,12 @@ | ... | @@ -23,12 +23,12 @@ |
23 | #include <string.h> | 23 | #include <string.h> |
24 | 24 | ||
25 | static void url_mbox_destroy (url_t *purl); | 25 | static void url_mbox_destroy (url_t *purl); |
26 | static int url_mbox_init (url_t *purl, const char *name); | 26 | static int url_mbox_create (url_t *purl, const char *name); |
27 | 27 | ||
28 | struct url_registrar _url_mbox_registrar = | 28 | struct url_registrar _url_mbox_registrar = |
29 | { | 29 | { |
30 | "/", | 30 | "/", |
31 | url_mbox_init, url_mbox_destroy | 31 | url_mbox_create, url_mbox_destroy |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static void | 34 | static void |
... | @@ -48,7 +48,7 @@ url_mbox_destroy (url_t *purl) | ... | @@ -48,7 +48,7 @@ url_mbox_destroy (url_t *purl) |
48 | UNIX box | 48 | UNIX box |
49 | */ | 49 | */ |
50 | static int | 50 | static int |
51 | url_mbox_init (url_t *purl, const char *name) | 51 | url_mbox_create (url_t *purl, const char *name) |
52 | { | 52 | { |
53 | url_t url; | 53 | url_t url; |
54 | struct url_registrar *ureg = &_url_mbox_registrar; | 54 | struct url_registrar *ureg = &_url_mbox_registrar; |
... | @@ -64,7 +64,7 @@ url_mbox_init (url_t *purl, const char *name) | ... | @@ -64,7 +64,7 @@ url_mbox_init (url_t *purl, const char *name) |
64 | return ENOMEM; | 64 | return ENOMEM; |
65 | 65 | ||
66 | /* TYPE */ | 66 | /* TYPE */ |
67 | url->_init = ureg->_init; | 67 | url->_create = ureg->_create; |
68 | url->_destroy = ureg->_destroy; | 68 | url->_destroy = ureg->_destroy; |
69 | 69 | ||
70 | /* SCHEME */ | 70 | /* SCHEME */ | ... | ... |
... | @@ -23,12 +23,12 @@ | ... | @@ -23,12 +23,12 @@ |
23 | #include <string.h> | 23 | #include <string.h> |
24 | 24 | ||
25 | static void url_maildir_destroy (url_t *purl); | 25 | static void url_maildir_destroy (url_t *purl); |
26 | static int url_maildir_init (url_t *purl, const char *name); | 26 | static int url_maildir_create (url_t *purl, const char *name); |
27 | 27 | ||
28 | struct url_registrar _url_maildir_registrar = | 28 | struct url_registrar _url_maildir_registrar = |
29 | { | 29 | { |
30 | "maildir:", | 30 | "maildir:", |
31 | url_maildir_init, url_maildir_destroy | 31 | url_maildir_create, url_maildir_destroy |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static void | 34 | static void |
... | @@ -49,7 +49,7 @@ url_maildir_destroy (url_t *purl) | ... | @@ -49,7 +49,7 @@ url_maildir_destroy (url_t *purl) |
49 | maildir: | 49 | maildir: |
50 | */ | 50 | */ |
51 | static int | 51 | static int |
52 | url_maildir_init (url_t *purl, const char *name) | 52 | url_maildir_create (url_t *purl, const char *name) |
53 | { | 53 | { |
54 | url_t url; | 54 | url_t url; |
55 | struct url_registrar *ureg = &_url_maildir_registrar; | 55 | struct url_registrar *ureg = &_url_maildir_registrar; |
... | @@ -67,7 +67,7 @@ url_maildir_init (url_t *purl, const char *name) | ... | @@ -67,7 +67,7 @@ url_maildir_init (url_t *purl, const char *name) |
67 | return EINVAL; | 67 | return EINVAL; |
68 | 68 | ||
69 | /* TYPE */ | 69 | /* TYPE */ |
70 | url->_init = ureg->_init; | 70 | url->_create = ureg->_create; |
71 | url->_destroy = ureg->_destroy; | 71 | url->_destroy = ureg->_destroy; |
72 | 72 | ||
73 | /* SCHEME */ | 73 | /* SCHEME */ | ... | ... |
... | @@ -23,12 +23,12 @@ | ... | @@ -23,12 +23,12 @@ |
23 | #include <string.h> | 23 | #include <string.h> |
24 | 24 | ||
25 | static void url_mh_destroy (url_t *purl); | 25 | static void url_mh_destroy (url_t *purl); |
26 | static int url_mh_init (url_t *purl, const char *name); | 26 | static int url_mh_create (url_t *purl, const char *name); |
27 | 27 | ||
28 | struct url_registrar _url_mh_registrar = | 28 | struct url_registrar _url_mh_registrar = |
29 | { | 29 | { |
30 | "mh:", | 30 | "mh:", |
31 | url_mh_init, url_mh_destroy | 31 | url_mh_create, url_mh_destroy |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static void | 34 | static void |
... | @@ -49,7 +49,7 @@ url_mh_destroy (url_t *purl) | ... | @@ -49,7 +49,7 @@ url_mh_destroy (url_t *purl) |
49 | mh: | 49 | mh: |
50 | */ | 50 | */ |
51 | static int | 51 | static int |
52 | url_mh_init (url_t *purl, const char *name) | 52 | url_mh_create (url_t *purl, const char *name) |
53 | { | 53 | { |
54 | url_t url; | 54 | url_t url; |
55 | struct url_registrar *ureg = &_url_mh_registrar; | 55 | struct url_registrar *ureg = &_url_mh_registrar; |
... | @@ -67,7 +67,7 @@ url_mh_init (url_t *purl, const char *name) | ... | @@ -67,7 +67,7 @@ url_mh_init (url_t *purl, const char *name) |
67 | return ENOMEM; | 67 | return ENOMEM; |
68 | 68 | ||
69 | /* TYPE */ | 69 | /* TYPE */ |
70 | url->_init = ureg->_init; | 70 | url->_create = ureg->_create; |
71 | url->_destroy = ureg->_destroy; | 71 | url->_destroy = ureg->_destroy; |
72 | 72 | ||
73 | /* SCHEME */ | 73 | /* SCHEME */ | ... | ... |
... | @@ -23,12 +23,12 @@ | ... | @@ -23,12 +23,12 @@ |
23 | #include <string.h> | 23 | #include <string.h> |
24 | 24 | ||
25 | static void url_mmdf_destroy (url_t *purl); | 25 | static void url_mmdf_destroy (url_t *purl); |
26 | static int url_mmdf_init (url_t *purl, const char *name); | 26 | static int url_mmdf_create (url_t *purl, const char *name); |
27 | 27 | ||
28 | struct url_registrar _url_mmdf_registrar = | 28 | struct url_registrar _url_mmdf_registrar = |
29 | { | 29 | { |
30 | "mmdf:", | 30 | "mmdf:", |
31 | url_mmdf_init, url_mmdf_destroy | 31 | url_mmdf_create, url_mmdf_destroy |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static void | 34 | static void |
... | @@ -49,7 +49,7 @@ url_mmdf_destroy (url_t *purl) | ... | @@ -49,7 +49,7 @@ url_mmdf_destroy (url_t *purl) |
49 | mmdf: | 49 | mmdf: |
50 | */ | 50 | */ |
51 | static int | 51 | static int |
52 | url_mmdf_init (url_t *purl, const char *name) | 52 | url_mmdf_create (url_t *purl, const char *name) |
53 | { | 53 | { |
54 | url_t url; | 54 | url_t url; |
55 | struct url_registrar *ureg = &_url_mmdf_registrar; | 55 | struct url_registrar *ureg = &_url_mmdf_registrar; |
... | @@ -67,7 +67,7 @@ url_mmdf_init (url_t *purl, const char *name) | ... | @@ -67,7 +67,7 @@ url_mmdf_init (url_t *purl, const char *name) |
67 | return ENOMEM; | 67 | return ENOMEM; |
68 | 68 | ||
69 | /* TYPE */ | 69 | /* TYPE */ |
70 | url->_init = ureg->_init; | 70 | url->_create = ureg->_create; |
71 | url->_destroy = ureg->_destroy; | 71 | url->_destroy = ureg->_destroy; |
72 | 72 | ||
73 | /* SCHEME */ | 73 | /* SCHEME */ | ... | ... |
... | @@ -25,12 +25,12 @@ | ... | @@ -25,12 +25,12 @@ |
25 | #include <errno.h> | 25 | #include <errno.h> |
26 | 26 | ||
27 | static void url_pop_destroy (url_t *purl); | 27 | static void url_pop_destroy (url_t *purl); |
28 | static int url_pop_init (url_t *purl, const char *name); | 28 | static int url_pop_create (url_t *purl, const char *name); |
29 | 29 | ||
30 | struct url_registrar _url_pop_registrar = | 30 | struct url_registrar _url_pop_registrar = |
31 | { | 31 | { |
32 | "pop://", | 32 | "pop://", |
33 | url_pop_init, url_pop_destroy | 33 | url_pop_create, url_pop_destroy |
34 | }; | 34 | }; |
35 | 35 | ||
36 | static int get_auth (const url_pop_t up, char *s, size_t len, size_t *); | 36 | static int get_auth (const url_pop_t up, char *s, size_t len, size_t *); |
... | @@ -80,7 +80,7 @@ url_pop_destroy (url_t *purl) | ... | @@ -80,7 +80,7 @@ url_pop_destroy (url_t *purl) |
80 | pop://<user>;AUTH=<auth>@<host>:<port> | 80 | pop://<user>;AUTH=<auth>@<host>:<port> |
81 | */ | 81 | */ |
82 | static int | 82 | static int |
83 | url_pop_init (url_t *purl, const char *name) | 83 | url_pop_create (url_t *purl, const char *name) |
84 | { | 84 | { |
85 | const char *host_port, *indexe; | 85 | const char *host_port, *indexe; |
86 | struct url_registrar *ureg = &_url_pop_registrar; | 86 | struct url_registrar *ureg = &_url_pop_registrar; |
... | @@ -101,7 +101,7 @@ url_pop_init (url_t *purl, const char *name) | ... | @@ -101,7 +101,7 @@ url_pop_init (url_t *purl, const char *name) |
101 | up->_get_auth = get_auth; | 101 | up->_get_auth = get_auth; |
102 | 102 | ||
103 | /* TYPE */ | 103 | /* TYPE */ |
104 | url->_init = _url_pop_registrar._init; | 104 | url->_create = _url_pop_registrar._create; |
105 | url->_destroy = _url_pop_registrar._destroy; | 105 | url->_destroy = _url_pop_registrar._destroy; |
106 | 106 | ||
107 | /* SCHEME */ | 107 | /* SCHEME */ | ... | ... |
... | @@ -23,12 +23,12 @@ | ... | @@ -23,12 +23,12 @@ |
23 | #include <string.h> | 23 | #include <string.h> |
24 | 24 | ||
25 | static void url_unix_destroy (url_t *purl); | 25 | static void url_unix_destroy (url_t *purl); |
26 | static int url_unix_init (url_t *purl, const char *name); | 26 | static int url_unix_create (url_t *purl, const char *name); |
27 | 27 | ||
28 | struct url_registrar _url_unix_registrar = | 28 | struct url_registrar _url_unix_registrar = |
29 | { | 29 | { |
30 | "unix:", | 30 | "unix:", |
31 | url_unix_init, url_unix_destroy | 31 | url_unix_create, url_unix_destroy |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static void | 34 | static void |
... | @@ -49,7 +49,7 @@ url_unix_destroy (url_t *purl) | ... | @@ -49,7 +49,7 @@ url_unix_destroy (url_t *purl) |
49 | unix:/path | 49 | unix:/path |
50 | */ | 50 | */ |
51 | static int | 51 | static int |
52 | url_unix_init (url_t *purl, const char *name) | 52 | url_unix_create (url_t *purl, const char *name) |
53 | { | 53 | { |
54 | url_t url; | 54 | url_t url; |
55 | struct url_registrar *ureg = &_url_unix_registrar; | 55 | struct url_registrar *ureg = &_url_unix_registrar; |
... | @@ -67,7 +67,7 @@ url_unix_init (url_t *purl, const char *name) | ... | @@ -67,7 +67,7 @@ url_unix_init (url_t *purl, const char *name) |
67 | return ENOMEM; | 67 | return ENOMEM; |
68 | 68 | ||
69 | /* TYPE */ | 69 | /* TYPE */ |
70 | url->_init = ureg->_init; | 70 | url->_create = ureg->_create; |
71 | url->_destroy = ureg->_destroy; | 71 | url->_destroy = ureg->_destroy; |
72 | 72 | ||
73 | /* SCHEME */ | 73 | /* SCHEME */ | ... | ... |
-
Please register or sign in to post a comment