summaryrefslogtreecommitdiffabout
path: root/libetpan/src/low-level/mbox/mailmbox.h
Unidiff
Diffstat (limited to 'libetpan/src/low-level/mbox/mailmbox.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libetpan/src/low-level/mbox/mailmbox.h144
1 files changed, 144 insertions, 0 deletions
diff --git a/libetpan/src/low-level/mbox/mailmbox.h b/libetpan/src/low-level/mbox/mailmbox.h
new file mode 100644
index 0000000..ea21d48
--- a/dev/null
+++ b/libetpan/src/low-level/mbox/mailmbox.h
@@ -0,0 +1,144 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001, 2005 - DINH Viet Hoa
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the libEtPan! project nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32/*
33 * $Id$
34 */
35
36#ifndef MAILMBOX_H
37
38#define MAILMBOX_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailmbox_types.h>
45
46int
47mailmbox_append_message_list(struct mailmbox_folder * folder,
48 carray * append_tab);
49
50int
51mailmbox_append_message(struct mailmbox_folder * folder,
52 const char * data, size_t len);
53
54int
55mailmbox_append_message_uid(struct mailmbox_folder * folder,
56 const char * data, size_t len, unsigned int * puid);
57
58int mailmbox_fetch_msg(struct mailmbox_folder * folder,
59 uint32_t num, char ** result,
60 size_t * result_len);
61
62int mailmbox_fetch_msg_headers(struct mailmbox_folder * folder,
63 uint32_t num, char ** result,
64 size_t * result_len);
65
66void mailmbox_fetch_result_free(char * msg);
67
68int mailmbox_copy_msg_list(struct mailmbox_folder * dest_folder,
69 struct mailmbox_folder * src_folder,
70 carray * tab);
71
72int mailmbox_copy_msg(struct mailmbox_folder * dest_folder,
73 struct mailmbox_folder * src_folder,
74 uint32_t uid);
75
76int mailmbox_expunge(struct mailmbox_folder * folder);
77
78int mailmbox_delete_msg(struct mailmbox_folder * folder, uint32_t uid);
79
80int mailmbox_init(const char * filename,
81 int force_readonly,
82 int force_no_uid,
83 uint32_t default_written_uid,
84 struct mailmbox_folder ** result_folder);
85
86void mailmbox_done(struct mailmbox_folder * folder);
87
88/* low-level access primitives */
89
90int mailmbox_write_lock(struct mailmbox_folder * folder);
91
92int mailmbox_write_unlock(struct mailmbox_folder * folder);
93
94int mailmbox_read_lock(struct mailmbox_folder * folder);
95
96int mailmbox_read_unlock(struct mailmbox_folder * folder);
97
98
99/* memory map */
100
101int mailmbox_map(struct mailmbox_folder * folder);
102
103void mailmbox_unmap(struct mailmbox_folder * folder);
104
105void mailmbox_sync(struct mailmbox_folder * folder);
106
107
108/* open & close file */
109
110int mailmbox_open(struct mailmbox_folder * folder);
111
112void mailmbox_close(struct mailmbox_folder * folder);
113
114
115/* validate cache */
116
117int mailmbox_validate_write_lock(struct mailmbox_folder * folder);
118
119int mailmbox_validate_read_lock(struct mailmbox_folder * folder);
120
121
122/* fetch message */
123
124int mailmbox_fetch_msg_no_lock(struct mailmbox_folder * folder,
125 uint32_t num, char ** result,
126 size_t * result_len);
127
128int mailmbox_fetch_msg_headers_no_lock(struct mailmbox_folder * folder,
129 uint32_t num, char ** result,
130 size_t * result_len);
131
132/* append message */
133
134int
135mailmbox_append_message_list_no_lock(struct mailmbox_folder * folder,
136 carray * append_tab);
137
138int mailmbox_expunge_no_lock(struct mailmbox_folder * folder);
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif