Commit 5d0c69dd 5d0c69dda796350e3798025cd50b491b80a2489b by Sergey Poznyakoff

Moved from mailbox/

1 parent 44b2eccc
1 Makefile
2 Makefile.in
1 ## Process this file with GNU Automake to create Makefile.in
2
3 ## Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
4 ##
5 ## GNU Mailutils is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License as
7 ## published by the Free Software Foundation; either version 2, or (at
8 ## your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301 USA
19
20 noinst_HEADERS = \
21 address0.h \
22 attribute0.h \
23 amd.h \
24 auth0.h \
25 body0.h \
26 debug0.h \
27 envelope0.h \
28 filter0.h \
29 folder0.h \
30 header0.h \
31 iterator0.h \
32 imap0.h \
33 list0.h \
34 mailbox0.h \
35 mailer0.h \
36 message0.h \
37 mime0.h \
38 monitor0.h \
39 observer0.h \
40 property0.h \
41 registrar0.h \
42 stream0.h \
43 url0.h
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _ADDRESS0_H
20 #define _ADDRESS0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/address.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /*
33 * The data-structure representing an RFC822 MAILBOX. It may be
34 * one MAILBOX or a list of them, as found in an ADDRESS or
35 * a MAILBOX list (as found in a GROUP).
36 *
37 * Capitalized names are from RFC 822, section 6.1 (Address Syntax).
38 */
39 struct _mu_address
40 {
41 char *addr;
42 /* the original string that this list of addresses was created
43 * from, only present at the head of the list */
44
45 char *comments;
46 /* the collection of comments stripped during parsing this MAILBOX */
47 char *personal;
48 /* the PHRASE portion of a MAILBOX, called the DISPLAY-NAME in drums */
49 char *email;
50 /* the ADDR-SPEC, the LOCAL-PART@DOMAIN */
51 char *local_part;
52 /* the LOCAL-PART of a MAILBOX */
53 char *domain;
54 /* the DOMAIN of a MAILBOX */
55 char *route;
56 /* the optional ROUTE in the ROUTE-ADDR form of MAILBOX */
57
58 /* size_t num; this didn't appear to be used anywhere... so I commented
59 it out, is that ok? -sam */
60
61 struct _mu_address *next;
62 };
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif /* _ADDRESS0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002, 2003,
3 2004, 2005 Free Software Foundation, Inc.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General
16 Public License along with this library; if not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301 USA */
19
20 #define MAX_OPEN_STREAMS 16
21
22 /* Notifications ADD_MESG. */
23 #define DISPATCH_ADD_MSG(mbox,mhd) \
24 do \
25 { \
26 int bailing = 0; \
27 mu_monitor_unlock (mbox->monitor); \
28 if (mbox->observable) \
29 bailing = mu_observable_notify (mbox->observable, MU_EVT_MESSAGE_ADD); \
30 if (bailing != 0) \
31 { \
32 if (pcount) \
33 *pcount = (mhd)->msg_count; \
34 mu_locker_unlock (mbox->locker); \
35 return EINTR; \
36 } \
37 mu_monitor_wrlock (mbox->monitor); \
38 } while (0);
39
40 struct _amd_data;
41 struct _amd_message
42 {
43 mu_stream_t stream; /* Associated file stream */
44 mu_off_t body_start; /* Offset of body start in the message file */
45 mu_off_t body_end; /* Offset of body end (size of file, effectively)*/
46
47 int attr_flags; /* Attribute flags */
48 int deleted; /* Was the message originally deleted */
49
50 time_t mtime; /* Time of last modification */
51 size_t header_lines; /* Number of lines in the header part */
52 size_t body_lines; /* Number of lines in the body */
53
54 mu_message_t message; /* Corresponding mu_message_t */
55 struct _amd_data *amd; /* Back pointer. */
56 };
57
58 struct _amd_data
59 {
60 size_t msg_size; /* Size of struct _amd_message */
61 int (*msg_init_delivery) (struct _amd_data *, struct _amd_message *);
62 int (*msg_finish_delivery) (struct _amd_data *, struct _amd_message *);
63 void (*msg_free) (struct _amd_message *);
64 char *(*msg_file_name) (struct _amd_message *, int deleted);
65 int (*scan0) (mu_mailbox_t mailbox, size_t msgno, size_t *pcount,
66 int do_notify);
67 int (*msg_cmp) (struct _amd_message *, struct _amd_message *);
68 int (*message_uid) (mu_message_t msg, size_t *puid);
69 size_t (*next_uid) (struct _amd_data *mhd);
70
71 /* List of messages: */
72 size_t msg_count; /* number of messages in the list */
73 size_t msg_max; /* maximum message buffer capacity */
74 struct _amd_message **msg_array;
75
76 unsigned long uidvalidity;
77
78 char *name; /* Directory name */
79
80 /* Pool of open message streams */
81 struct _amd_message *msg_pool[MAX_OPEN_STREAMS];
82 int pool_first; /* Index to the first used entry in msg_pool */
83 int pool_last; /* Index to the first free entry in msg_pool */
84
85 time_t mtime; /* Time of last modification */
86
87 mu_mailbox_t mailbox; /* Back pointer. */
88 };
89
90
91 int amd_init_mailbox (mu_mailbox_t mailbox, size_t mhd_size,
92 struct _amd_data **pmhd);
93 int _amd_message_insert (struct _amd_data *mhd, struct _amd_message *msg);
94 int amd_message_stream_open (struct _amd_message *mhm);
95 void amd_message_stream_close (struct _amd_message *mhm);
96 void amd_cleanup (void *arg);
97 int amd_url_init (mu_url_t url, const char *scheme);
98 struct _amd_message *_amd_get_message (struct _amd_data *amd, size_t msgno);
99 int amd_msg_lookup (struct _amd_data *amd, struct _amd_message *msg,
100 size_t *pret);
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _ATTRIBUTE0_H
20 # define _ATTRIBUTE0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/attribute.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 struct _mu_attribute
33 {
34 void *owner;
35
36 int flags;
37 int user_flags;
38
39 int (*_get_flags) (mu_attribute_t, int *);
40 int (*_set_flags) (mu_attribute_t, int);
41 int (*_unset_flags) (mu_attribute_t, int);
42 };
43
44 #ifdef __cplusplus
45 }
46 #endif
47
48 #endif /* _ATTRIBUTE0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _AUTH0_H
20 #define _AUTH0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/auth.h>
27 #include <mailutils/list.h>
28 #include <sys/types.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 struct _mu_ticket
35 {
36 void *owner;
37 char *challenge;
38 void *data;
39 int (*_pop) (mu_ticket_t, mu_url_t, const char *challenge, char **);
40 void (*_destroy) (mu_ticket_t);
41 };
42
43 struct _mu_authority
44 {
45 void *owner;
46 mu_ticket_t ticket;
47 mu_list_t auth_methods; /* list of int (*_authenticate) (mu_authority_t)s; */
48 };
49
50 struct _mu_wicket
51 {
52 char *filename;
53 int (*_get_ticket) (mu_wicket_t, const char *, const char *, mu_ticket_t *);
54 };
55
56
57 #ifdef __cplusplus
58 }
59 #endif
60
61 #endif /* _AUTH0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _BODY0_H
20 #define _BODY0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/stream.h>
27 #include <mailutils/body.h>
28
29 #include <stdio.h>
30 #include <sys/types.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 struct _mu_body
37 {
38 void *owner;
39 char *filename;
40 mu_stream_t stream;
41 mu_stream_t fstream;
42 int flags;
43
44 int (*_size) (mu_body_t, size_t*);
45 int (*_lines) (mu_body_t, size_t*);
46 };
47
48 #ifdef __cplusplus
49 }
50 #endif
51
52 #endif /* _BODY0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _DEBUG0_H
20 #define _DEBUG0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/debug.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 struct _mu_debug
33 {
34 size_t level;
35 char *buffer;
36 size_t buflen;
37 void *owner;
38 int (*_print) (mu_debug_t, size_t level, const char *, va_list);
39 };
40
41 #ifdef __cplusplus
42 }
43 #endif
44
45 #endif /* _DEBUG0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _ENVELOPE0_H
20 #define _ENVELOPE0_H
21
22 #ifdef DMALLOC
23 #include <dmalloc.h>
24 #endif
25
26 #include <mailutils/envelope.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 struct _mu_envelope
33 {
34 void *owner;
35 int (*_destroy) (mu_envelope_t);
36 int (*_sender) (mu_envelope_t, char *, size_t, size_t*);
37 int (*_date) (mu_envelope_t, char *, size_t , size_t *);
38 };
39
40 #endif /* _ENVELOPE0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 /* Notes:
20
21 */
22
23 #ifndef _FILTER0_H
24 #define _FILTER0_H
25
26 #include <mailutils/filter.h>
27 #include <mailutils/list.h>
28 #include <mailutils/monitor.h>
29 #include <mailutils/property.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 struct _mu_filter
36 {
37 mu_stream_t stream;
38 mu_stream_t filter_stream;
39 mu_property_t property;
40 int direction;
41 int type;
42 void *data;
43 int (*_read) (mu_filter_t, char *, size_t, mu_off_t, size_t *);
44 int (*_readline) (mu_filter_t, char *, size_t, mu_off_t, size_t *);
45 int (*_write) (mu_filter_t, const char *, size_t, mu_off_t, size_t *);
46 void (*_destroy) (mu_filter_t);
47 };
48
49 #ifdef __cplusplus
50 }
51 #endif
52
53 #endif /* _FILTER0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _FOLDER0_H
20 #define _FOLDER0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <sys/types.h>
27 #include <stdio.h>
28
29 #include <mailutils/monitor.h>
30 #include <mailutils/folder.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 struct _mu_folder
37 {
38 /* Data */
39 mu_authority_t authority;
40 mu_observable_t observable;
41 mu_debug_t debug;
42 mu_stream_t stream;
43 mu_monitor_t monitor;
44 mu_url_t url;
45 int flags;
46 int ref;
47 size_t uid;
48
49 /* Back pointer to the specific mailbox */
50 void *data;
51
52 /* Public methods */
53
54 void (*_destroy) (mu_folder_t);
55
56 int (*_open) (mu_folder_t, int flag);
57 int (*_close) (mu_folder_t);
58 int (*_list) (mu_folder_t, const char *, const char *,
59 size_t,
60 mu_list_t);
61 int (*_lsub) (mu_folder_t, const char *, const char *,
62 mu_list_t);
63 int (*_delete) (mu_folder_t, const char *);
64 int (*_rename) (mu_folder_t, const char *, const char *);
65 int (*_subscribe) (mu_folder_t, const char *);
66 int (*_unsubscribe) (mu_folder_t, const char *);
67 };
68
69 /* Moro(?)ic kluge. */
70 #define FOLDER_DEBUG0(folder, type, format) \
71 if (folder->debug) mu_debug_print (folder->debug, type, format)
72 #define FOLDER_DEBUG1(folder, type, format, arg1) \
73 if (folder->debug) mu_debug_print (folder->debug, type, format, arg1)
74 #define FOLDER_DEBUG2(folder, type, format, arg1, arg2) \
75 if (folder->debug) mu_debug_print (folder->debug, type, format, arg1, arg2)
76 #define FOLDER_DEBUG3(folder, type, format, arg1, arg2, arg3) \
77 if (folder->debug) mu_debug_print (folder->debug, type, format, arg1, arg2, arg3)
78 #define FOLDER_DEBUG4(folder, type, format, arg1, arg2, arg3, arg4) \
79 if (folder->debug) mu_debug_print (folder->debug, type, format, arg1, arg2, arg3, arg4)
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif /* _FOLDER0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _HEADER0_H
20 #define _HEADER0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/header.h>
27 #include <sys/types.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /* The structure members are offset that point to the begin/end of header
34 fields. */
35 struct _hdr
36 {
37 char *fn;
38 char *fn_end;
39 char *fv;
40 char *fv_end;
41 };
42
43 /* The blurb member represents the headers, hdr_count the number of distinct
44 header field and the layout is done by struct_hdr *hdr. */
45 struct _mu_header
46 {
47 /* Owner. */
48 void *owner;
49
50 /* Data. */
51 mu_stream_t mstream;
52 size_t stream_len;
53 char *blurb;
54 size_t blurb_len;
55 size_t hdr_count;
56 struct _hdr *hdr;
57 size_t fhdr_count;
58 struct _hdr *fhdr;
59 int flags;
60
61 /* Stream. */
62 mu_stream_t stream;
63 int (*_get_value) (mu_header_t, const char *, char *, size_t , size_t *);
64 int (*_get_fvalue) (mu_header_t, const char *, char *, size_t , size_t *);
65 int (*_set_value) (mu_header_t, const char *, const char *, int);
66 int (*_lines) (mu_header_t, size_t *);
67 int (*_size) (mu_header_t, size_t *);
68 int (*_fill) (mu_header_t, char *, size_t, mu_off_t, size_t *);
69 };
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif /* _HEADER0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _IMAP0_H
20 #define _IMAP0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <folder0.h>
27 #include <mailbox0.h>
28 #include <registrar0.h>
29 #include <auth0.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #define CLEAR_STATE(f_imap) \
36 f_imap->selected = NULL, f_imap->state = IMAP_NO_STATE
37
38 /* Clear the state and close the stream. */
39 #define CHECK_ERROR_CLOSE(folder, f_imap, status) \
40 do \
41 { \
42 if (status != 0) \
43 { \
44 mu_stream_close (folder->stream); \
45 CLEAR_STATE (f_imap); \
46 return status; \
47 } \
48 } \
49 while (0)
50
51 /* Clear the state. */
52 #define CHECK_ERROR(f_imap, status) \
53 do \
54 { \
55 if (status != 0) \
56 { \
57 CLEAR_STATE (f_imap); \
58 return status; \
59 } \
60 } \
61 while (0)
62
63 /* Clear the state for non recoverable error. */
64 #define CHECK_EAGAIN(f_imap, status) \
65 do \
66 { \
67 if (status != 0) \
68 { \
69 if (status != EAGAIN && status != EINPROGRESS && status != EINTR) \
70 { \
71 CLEAR_STATE (f_imap); \
72 } \
73 return status; \
74 } \
75 } \
76 while (0)
77
78
79 struct _f_imap;
80 struct _m_imap;
81 struct _msg_imap;
82 typedef struct _f_imap *f_imap_t;
83 typedef struct _m_imap *m_imap_t;
84 typedef struct _msg_imap *msg_imap_t;
85
86 enum imap_state
87 {
88 IMAP_NO_STATE=0,
89 IMAP_AUTH, IMAP_AUTH_DONE,
90 IMAP_APPEND, IMAP_APPEND_CONT, IMAP_APPEND_SEND, IMAP_APPEND_ACK,
91 IMAP_BODY,
92 IMAP_CLOSE, IMAP_CLOSE_ACK,
93 IMAP_COPY, IMAP_COPY_ACK,
94 IMAP_CREATE, IMAP_CREATE_ACK,
95 IMAP_DELETE, IMAP_DELETE_ACK,
96 IMAP_EXPUNGE, IMAP_EXPUNGE_ACK,
97 IMAP_FETCH, IMAP_FETCH_ACK,
98 IMAP_GREETINGS,
99 IMAP_HEADER,
100 IMAP_HEADER_FIELD,
101 IMAP_LIST, IMAP_LIST_PARSE, IMAP_LIST_ACK,
102 IMAP_LOGIN, IMAP_LOGIN_ACK,
103 IMAP_LOGOUT, IMAP_LOGOUT_ACK,
104 IMAP_LSUB, IMAP_LSUB_ACK,
105 IMAP_MESSAGE,
106 IMAP_NOOP, IMAP_NOOP_ACK,
107 IMAP_OPEN_CONNECTION,
108 IMAP_RENAME, IMAP_RENAME_ACK,
109 IMAP_SCAN, IMAP_SCAN_ACK,
110 IMAP_SELECT, IMAP_SELECT_ACK,
111 IMAP_STORE, IMAP_STORE_ACK,
112 IMAP_SUBSCRIBE, IMAP_SUBSCRIBE_ACK,
113 IMAP_UNSUBSCRIBE, IMAP_UNSUBSCRIBE_ACK
114 };
115
116 enum imap_auth_state
117 {
118 /* ANONYMOUS */
119 IMAP_AUTH_ANON_REQ_WRITE,
120 IMAP_AUTH_ANON_REQ_SEND,
121 IMAP_AUTH_ANON_WAIT_CONT,
122 IMAP_AUTH_ANON_MSG,
123 IMAP_AUTH_ANON_MSG_SEND,
124 IMAP_AUTH_ANON_WAIT_RESP
125 };
126
127 struct literal_string
128 {
129 char *buffer;
130 size_t buflen;
131 size_t total;
132 msg_imap_t msg_imap;
133 enum imap_state type;
134 size_t nleft; /* nleft to read in the literal. */
135 };
136
137 struct _f_imap
138 {
139 /* Back pointer. */
140 mu_folder_t folder;
141 m_imap_t selected;
142
143 enum imap_state state;
144
145 size_t seq; /* Sequence number to build a tag. */
146 char **capav; /* Cabilities of the server. */
147 int capac; /* Number of capabilities in the above array */
148 int flags;
149
150 /* IO use to hold the literal and quoted strings send by
151 the IMAP server. */
152 struct
153 {
154 mu_stream_t stream;
155 mu_off_t offset;
156 size_t nleft; /* nleft to read in the literal. */
157 msg_imap_t msg_imap;
158 enum imap_state type;
159 } string;
160
161 /* Use for LIST and LSUB. */
162 mu_list_t flist;
163
164 int isopen;
165
166 /* Server channel buffer I/O */
167 size_t buflen;
168 char *buffer;
169 char *ptr;
170 char *nl;
171 mu_off_t offset; /* Dummy, this is used because of the stream buffering.
172 The mu_stream_t maintains and offset and the offset we use must
173 be in sync. */
174
175 /* Login */
176 char *user;
177 char *passwd;
178
179 /* AUTHENTICATE states */
180 enum imap_auth_state auth_state;
181 };
182
183 struct _m_imap
184 {
185 /* Back pointers. */
186 mu_mailbox_t mailbox;
187 f_imap_t f_imap;
188 size_t messages_count;
189 size_t imessages_count;
190 msg_imap_t *imessages;
191 size_t recent;
192 size_t unseen;
193 unsigned long uidvalidity;
194 size_t uidnext;
195 char *name;
196 enum imap_state state;
197 /* mailbox operations can be sequences of folder operations, and
198 thus need to keep meta-state, mailbox_imap_open(), for example. */
199 };
200
201 struct _msg_imap
202 {
203 /* Back pointers. */
204 mu_message_t message;
205 m_imap_t m_imap;
206 size_t num;
207 size_t part;
208 size_t num_parts;
209 msg_imap_t *parts;
210 msg_imap_t parent;
211 int flags;
212 size_t uid;
213
214 mu_header_t fheader;
215 char *internal_date;
216
217 size_t mu_message_size;
218 size_t mu_message_lines;
219 size_t body_size;
220 size_t body_lines;
221 size_t header_size;
222 size_t header_lines;
223 };
224
225 int imap_writeline (f_imap_t, const char *format, ...);
226 int imap_write (f_imap_t);
227 int imap_send (f_imap_t);
228 int imap_parse (f_imap_t);
229 int imap_readline (f_imap_t);
230 char *section_name (msg_imap_t);
231
232 #ifdef __cplusplus
233 }
234 #endif
235
236 #endif /* _IMAP0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _ITERATOR0_H
20 #define _ITERATOR0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/iterator.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 struct _mu_iterator
33 {
34 struct _mu_iterator *next_itr; /* Next iterator in the chain */
35 void *owner; /* Object whose contents is being iterated */
36 int is_advanced; /* Is the iterator already advanced */
37
38 int (*dup) (void **ptr, void *owner);
39 int (*destroy) (mu_iterator_t itr, void *owner);
40 int (*first) (void *owner);
41 int (*next) (void *owner);
42 int (*getitem) (void *owner, void **pret);
43 int (*curitem_p) (void *owner, void *item);
44 int (*finished_p) (void *owner);
45 };
46
47 #ifdef __cplusplus
48 }
49 #endif
50
51 #endif /* _ITERATOR0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _LIST0_H
20 #define _LIST0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <sys/types.h>
27
28 #include <mailutils/list.h>
29 #include <mailutils/monitor.h>
30 #include <mailutils/iterator.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 struct list_data
37 {
38 void *item;
39 struct list_data *next;
40 struct list_data *prev;
41 };
42
43 struct _mu_list
44 {
45 struct list_data head;
46 size_t count;
47 mu_monitor_t monitor;
48 mu_list_comparator_t comp;
49 void (*destroy_item) (void *item);
50 struct _mu_iterator *itr;
51 };
52
53
54 #ifdef __cplusplus
55 }
56 #endif
57
58 #endif /* _LIST0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _MAILBOX0_H
20 #define _MAILBOX0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <sys/types.h>
27 #include <stdio.h>
28
29 #include <mailutils/monitor.h>
30 #include <mailutils/mailbox.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 struct _mu_mailbox
37 {
38 /* Data */
39 mu_observable_t observable;
40 mu_debug_t debug;
41 mu_property_t property;
42 mu_locker_t locker;
43 mu_stream_t stream;
44 mu_url_t url;
45 int flags;
46 mu_folder_t folder;
47 mu_monitor_t monitor;
48
49 /* Back pointer to the specific mailbox */
50 void *data;
51
52 /* Public methods */
53
54 void (*_destroy) (mu_mailbox_t);
55
56 int (*_open) (mu_mailbox_t, int);
57 int (*_close) (mu_mailbox_t);
58
59 /* messages */
60 int (*_get_message) (mu_mailbox_t, size_t, mu_message_t *);
61 int (*_append_message) (mu_mailbox_t, mu_message_t);
62 int (*_messages_count) (mu_mailbox_t, size_t *);
63 int (*_messages_recent) (mu_mailbox_t, size_t *);
64 int (*_message_unseen) (mu_mailbox_t, size_t *);
65 int (*_expunge) (mu_mailbox_t);
66 int (*_save_attributes) (mu_mailbox_t);
67 int (*_uidvalidity) (mu_mailbox_t, unsigned long *);
68 int (*_uidnext) (mu_mailbox_t, size_t *);
69 int (*_get_property) (mu_mailbox_t, mu_property_t *);
70
71 int (*_scan) (mu_mailbox_t, size_t, size_t *);
72 int (*_is_updated) (mu_mailbox_t);
73
74 int (*_get_size) (mu_mailbox_t, mu_off_t *);
75
76 };
77
78 #define MAILBOX_NOTIFY(mbox, type) \
79 if (mbox->observer) observer_notify (mbox->observer, type)
80
81 /* Moro(?)ic kluge. */
82 #define MAILBOX_DEBUG0(mbox, type, format) \
83 if (mbox->debug) mu_debug_print (mbox->debug, type, format)
84 #define MAILBOX_DEBUG1(mbox, type, format, arg1) \
85 if (mbox->debug) mu_debug_print (mbox->debug, type, format, arg1)
86 #define MAILBOX_DEBUG2(mbox, type, format, arg1, arg2) \
87 if (mbox->debug) mu_debug_print (mbox->debug, type, format, arg1, arg2)
88 #define MAILBOX_DEBUG3(mbox, type, format, arg1, arg2, arg3) \
89 if (mbox->debug) mu_debug_print (mbox->debug, type, format, arg1, arg2, arg3)
90 #define MAILBOX_DEBUG4(mbox, type, format, arg1, arg2, arg3, arg4) \
91 if (mbox->debug) mu_debug_print (mbox->debug, type, format, arg1, arg2, arg3, arg4)
92
93 #ifdef __cplusplus
94 }
95 #endif
96
97 #endif /* _MAILBOX0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _MAILER0_H
20 #define _MAILER0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <sys/types.h>
27 #include <mailutils/mailer.h>
28 #include <mailutils/monitor.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /* Default mailer URL. */
35
36 #define MAILER_URL_DEFAULT "sendmail:"
37
38 #define MAILER_LINE_BUF_SIZE 1000
39
40 struct _mu_mailer
41 {
42 mu_stream_t stream;
43 mu_observable_t observable;
44 mu_debug_t debug;
45 mu_url_t url;
46 int flags;
47 mu_monitor_t monitor;
48 mu_property_t property;
49
50 /* Pointer to the specific mailer data. */
51 void *data;
52
53 /* Public methods. */
54 void (*_destroy) (mu_mailer_t);
55 int (*_open) (mu_mailer_t, int flags);
56 int (*_close) (mu_mailer_t);
57 int (*_send_message) (mu_mailer_t, mu_message_t, mu_address_t, mu_address_t);
58 };
59
60 #define MAILER_NOTIFY(mailer, type) \
61 if (mailer->observer) observer_notify (mailer->observer, type)
62
63 /* Moro(?)ic kluge. */
64 #define MAILER_DEBUGV(mailer, type, format, av) \
65 if (mailer->debug) mu_debug_print (mailer->debug, type, format, av)
66 #define MAILER_DEBUG0(mailer, type, format) \
67 if (mailer->debug) mu_debug_print (mailer->debug, type, format)
68 #define MAILER_DEBUG1(mailer, type, format, arg1) \
69 if (mailer->debug) mu_debug_print (mailer->debug, type, format, arg1)
70 #define MAILER_DEBUG2(mailer, type, format, arg1, arg2) \
71 if (mailer->debug) mu_debug_print (mailer->debug, type, format, arg1, arg2)
72 #define MAILER_DEBUG3(mailer, type, format, arg1, arg2, arg3) \
73 if (mailer->debug) mu_debug_print (mailer->debug, type, format, arg1, arg2, arg3)
74 #define MAILER_DEBUG4(mailer, type, format, arg1, arg2, arg3, arg4) \
75 if (mailer->debug) mu_debug_print (mailer->debug, type, format, arg1, arg2, arg3, arg4)
76
77 #ifdef __cplusplus
78 }
79 #endif
80
81 #endif /* MAILER0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _MESSAGE0_H
20 #define _MESSAGE0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/message.h>
27 #include <mailutils/mime.h>
28 #include <mailutils/monitor.h>
29
30 #include <sys/types.h>
31 #include <stdio.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 struct _mu_message
38 {
39 /* Who is the owner. */
40 void *owner;
41
42 mu_envelope_t envelope;
43 mu_header_t header;
44 mu_body_t body;
45
46 int flags;
47 mu_stream_t stream;
48 mu_attribute_t attribute;
49 mu_monitor_t monitor;
50 mu_mime_t mime;
51 mu_observable_t observable;
52 mu_mailbox_t mailbox;
53
54 /* Reference count. */
55 int ref;
56
57 /* Holder for message_write. */
58 size_t hdr_buflen;
59 int hdr_done;
60
61 int (*_get_uidl) (mu_message_t, char *, size_t, size_t *);
62 int (*_get_uid) (mu_message_t, size_t *);
63 int (*_get_num_parts) (mu_message_t, size_t *);
64 int (*_get_part) (mu_message_t, size_t, mu_message_t *);
65 int (*_is_multipart) (mu_message_t, int *);
66 int (*_lines) (mu_message_t, size_t *);
67 int (*_size) (mu_message_t, size_t *);
68 };
69
70 #ifdef __cplusplus
71 }
72 #endif
73
74 #endif /* _MESSAGE0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _MIME0_H
20 #define _MIME0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <sys/types.h>
27 #include <mailutils/mime.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #define MIME_MAX_HDR_LEN 256
34 #define MIME_DFLT_BUF_SIZE 2048
35
36 /* Parser states */
37 #define MIME_STATE_BEGIN_LINE 1
38 #define MIME_STATE_SCAN_BOUNDARY 2
39 #define MIME_STATE_HEADERS 3
40
41 #define MIME_FLAG_MASK 0x0000ffff
42
43 /* private */
44 #define MIME_PARSER_ACTIVE 0x80000000
45 #define MIME_PARSER_HAVE_CR 0x40000000
46 #define MIME_NEW_MESSAGE 0x20000000
47 #define MIME_ADDED_CT 0x10000000
48 #define MIME_ADDED_MULTIPART_CT 0x08000000
49 #define MIME_INSERT_BOUNDARY 0x04000000
50 #define MIME_ADDING_BOUNDARY 0x02000000
51
52 struct _mu_mime
53 {
54 mu_message_t msg;
55 mu_header_t hdrs;
56 mu_stream_t stream;
57 int flags;
58 char *content_type;
59
60 int tparts;
61 int nmtp_parts;
62 struct _mime_part **mtp_parts; /* list of parts in the msg */
63 char *boundary;
64 int cur_offset;
65 int cur_part;
66 int part_offset;
67 int boundary_len;
68 int preamble;
69 int postamble;
70 /* parser state */
71 char *cur_line;
72 int line_ndx;
73 char *cur_buf;
74 int buf_size;
75 char *header_buf;
76 int header_buf_size;
77 int header_length;
78 int body_offset;
79 int body_length;
80 int body_lines;
81 int parser_state;
82 };
83
84 struct _mime_part
85 {
86 mu_mime_t mime;
87 mu_message_t msg;
88 int body_created;
89 int offset;
90 size_t len;
91 size_t lines;
92 };
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif /* MIME0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _MONITOR0_H
20 #define _MONITOR0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29
30 #include <sys/types.h>
31 #include <mailutils/monitor.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 /* FIXME: any protos? */
37 #ifdef __cplusplus
38 }
39 #endif
40
41 #endif /* _MONITOR0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _OBSERVER0_H
20 #define _OBSERVER0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/observer.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 struct _mu_observer
33 {
34 int flags;
35 void *owner;
36 int (*_action) (mu_observer_t, size_t);
37 int (*_destroy) (mu_observer_t);
38 };
39
40 struct _mu_observable
41 {
42 void *owner;
43 mu_list_t list;
44 };
45
46 struct _event
47 {
48 size_t type;
49 mu_observer_t observer;
50 };
51
52 typedef struct _event *event_t;
53
54
55
56 #ifdef __cplusplus
57 }
58 #endif
59
60 #endif /* _OBSERVER0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _PROPERTY0_H
20 #define _PROPERTY0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <errno.h>
27 #include <stdlib.h>
28 #include <string.h>
29
30 #include <mailutils/property.h>
31 #include <mailutils/monitor.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 struct property_item
38 {
39 char *key;
40 char *value;
41 int set;
42 struct property_item *next;
43 };
44
45 struct _mu_property
46 {
47 struct property_item *items;
48 void *owner;
49 mu_monitor_t lock;
50 };
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 #endif /* _PROPERTY0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2004, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _REGISTRAR0_H
20 #define _REGISTRAR0_H
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/registrar.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /* The pop and imap defines are all wrong now, since they seem intertwined
33 with the old url parsing code. Also, "pop://" is not the POP scheme,
34 at least not as a scheme is described in the RFCs.
35
36 Perhaps they can be changed?
37 */
38 #define MU_POP_PORT 110
39 #define MU_POP_SCHEME "pop://"
40 #define MU_POP_SCHEME_LEN (sizeof (MU_POP_SCHEME) - 1)
41 extern int _url_pop_init (mu_url_t);
42 extern int _mailbox_pop_init (mu_mailbox_t);
43 extern int _folder_pop_init (mu_folder_t);
44
45 #define MU_IMAP_PORT 143
46 #define MU_IMAP_SCHEME "imap://"
47 #define MU_IMAP_SCHEME_LEN (sizeof (MU_IMAP_SCHEME) - 1)
48 extern int _url_imap_init (mu_url_t);
49 extern int _mailbox_imap_init (mu_mailbox_t);
50 extern int _folder_imap_init (mu_folder_t);
51
52 #define MU_MBOX_SCHEME "mbox:"
53 #define MU_MBOX_SCHEME_LEN (sizeof (MU_MBOX_SCHEME) - 1)
54 extern int _url_mbox_init (mu_url_t);
55 extern int _mailbox_mbox_init (mu_mailbox_t);
56 extern int _folder_mbox_init (mu_folder_t);
57
58 #define MU_FILE_SCHEME "file:"
59 #define MU_FILE_SCHEME_LEN (sizeof (MU_FILE_SCHEME) - 1)
60
61 #define MU_PATH_SCHEME "/"
62 #define MU_PATH_SCHEME_LEN (sizeof (MU_PATH_SCHEME) - 1)
63 extern int _url_path_init (mu_url_t);
64 extern int _mailbox_path_init (mu_mailbox_t);
65 extern int _folder_path_init (mu_folder_t);
66
67 #define MU_SMTP_SCHEME "smtp://"
68 #define MU_SMTP_SCHEME_LEN (sizeof (MU_SMTP_SCHEME) - 1)
69 #define MU_SMTP_PORT 25
70 extern int _url_smtp_init (mu_url_t);
71 extern int _mailer_smtp_init (mu_mailer_t);
72
73 #define MU_SENDMAIL_SCHEME "sendmail:"
74 #define MU_SENDMAIL_SCHEME_LEN (sizeof (MU_SENDMAIL_SCHEME) - 1)
75 extern int _url_sendmail_init (mu_url_t);
76 extern int _mailer_sendmail_init (mu_mailer_t);
77
78 #define MU_MH_SCHEME "mh:"
79 #define MU_MH_SCHEME_LEN (sizeof (MU_MH_SCHEME) - 1)
80 extern int _mailbox_mh_init (mu_mailbox_t mailbox);
81
82 #define MU_MAILDIR_SCHEME "maildir:"
83 #define MU_MAILDIR_SCHEME_LEN (sizeof (MU_MAILDIR_SCHEME) - 1)
84 extern int _mailbox_maildir_init (mu_mailbox_t mailbox);
85
86 #ifdef __cplusplus
87 }
88 #endif
89
90 #endif /* _REGISTRAR0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _STREAM0_H
20 #define _STREAM0_H
21
22 #include <mailutils/stream.h>
23 #ifdef DMALLOC
24 #include <dmalloc.h>
25 #endif
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /* Read buffer */
32 struct rbuffer
33 {
34 char *base;
35 char *ptr;
36 size_t count;
37 size_t bufsiz;
38 mu_off_t offset;
39 };
40
41 struct _mu_stream
42 {
43 void *owner;
44 mu_property_t property;
45
46 int flags;
47 int state;
48
49 /* Read space */
50 struct rbuffer rbuffer;
51
52 /* Stream pointer for sequential offset. */
53 mu_off_t offset;
54
55 void (*_destroy) (mu_stream_t);
56 int (*_open) (mu_stream_t);
57 int (*_close) (mu_stream_t);
58 int (*_get_transport2) (mu_stream_t, mu_transport_t *, mu_transport_t *);
59 int (*_read) (mu_stream_t, char *, size_t, mu_off_t, size_t *);
60 int (*_readline) (mu_stream_t, char *, size_t, mu_off_t, size_t *);
61 int (*_write) (mu_stream_t, const char *, size_t, mu_off_t, size_t *);
62 int (*_truncate) (mu_stream_t, mu_off_t);
63 int (*_size) (mu_stream_t, mu_off_t *);
64 int (*_flush) (mu_stream_t);
65 int (*_setbufsiz)(mu_stream_t, size_t);
66 int (*_strerror) (mu_stream_t, const char **);
67 int (*_wait) (mu_stream_t, int *pflags, struct timeval *tvp);
68 };
69
70 #ifdef __cplusplus
71 }
72 #endif
73
74 #endif /* _STREAM0_H */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifndef _URL0_H
20 #define _URL0_H 1
21
22 #ifdef DMALLOC
23 # include <dmalloc.h>
24 #endif
25
26 #include <mailutils/url.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 struct _mu_url
33 {
34 /* Data */
35 char *name;
36 char *scheme;
37 char *user;
38 char *passwd;
39 char *auth;
40 char *host;
41 long port;
42 char *path;
43 char *query;
44
45
46 void *data;
47
48 void (*_destroy) (mu_url_t url);
49
50 /* Methods */
51 int (*_get_scheme) (const mu_url_t, char *, size_t, size_t *);
52 int (*_get_user) (const mu_url_t, char *, size_t, size_t *);
53 int (*_get_passwd) (const mu_url_t, char *, size_t, size_t *);
54 int (*_get_auth) (const mu_url_t, char *, size_t, size_t *);
55 int (*_get_host) (const mu_url_t, char *, size_t, size_t *);
56 int (*_get_port) (const mu_url_t, long *);
57 int (*_get_path) (const mu_url_t, char *, size_t, size_t *);
58 int (*_get_query) (const mu_url_t, char *, size_t, size_t *);
59 };
60
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif /* URL_H */