summaryrefslogtreecommitdiffabout
path: root/kmicromail/libetpan/mbox/mailmbox.h
Unidiff
Diffstat (limited to 'kmicromail/libetpan/mbox/mailmbox.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libetpan/mbox/mailmbox.h140
1 files changed, 140 insertions, 0 deletions
diff --git a/kmicromail/libetpan/mbox/mailmbox.h b/kmicromail/libetpan/mbox/mailmbox.h
new file mode 100644
index 0000000..8be086c
--- a/dev/null
+++ b/kmicromail/libetpan/mbox/mailmbox.h
@@ -0,0 +1,140 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001, 2002 - 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 REGENTS 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 REGENTS 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 mailmbox_fetch_msg(struct mailmbox_folder * folder,
55 uint32_t num, char ** result,
56 size_t * result_len);
57
58int mailmbox_fetch_msg_headers(struct mailmbox_folder * folder,
59 uint32_t num, char ** result,
60 size_t * result_len);
61
62void mailmbox_fetch_result_free(char * msg);
63
64int mailmbox_copy_msg_list(struct mailmbox_folder * dest_folder,
65 struct mailmbox_folder * src_folder,
66 carray * tab);
67
68int mailmbox_copy_msg(struct mailmbox_folder * dest_folder,
69 struct mailmbox_folder * src_folder,
70 uint32_t uid);
71
72int mailmbox_expunge(struct mailmbox_folder * folder);
73
74int mailmbox_delete_msg(struct mailmbox_folder * folder, uint32_t uid);
75
76int mailmbox_init(const char * filename,
77 int force_readonly,
78 int force_no_uid,
79 uint32_t default_written_uid,
80 struct mailmbox_folder ** result_folder);
81
82void mailmbox_done(struct mailmbox_folder * folder);
83
84/* low-level access primitives */
85
86int mailmbox_write_lock(struct mailmbox_folder * folder);
87
88int mailmbox_write_unlock(struct mailmbox_folder * folder);
89
90int mailmbox_read_lock(struct mailmbox_folder * folder);
91
92int mailmbox_read_unlock(struct mailmbox_folder * folder);
93
94
95/* memory map */
96
97int mailmbox_map(struct mailmbox_folder * folder);
98
99void mailmbox_unmap(struct mailmbox_folder * folder);
100
101void mailmbox_sync(struct mailmbox_folder * folder);
102
103
104/* open & close file */
105
106int mailmbox_open(struct mailmbox_folder * folder);
107
108void mailmbox_close(struct mailmbox_folder * folder);
109
110
111/* validate cache */
112
113int mailmbox_validate_write_lock(struct mailmbox_folder * folder);
114
115int mailmbox_validate_read_lock(struct mailmbox_folder * folder);
116
117
118/* fetch message */
119
120int mailmbox_fetch_msg_no_lock(struct mailmbox_folder * folder,
121 uint32_t num, char ** result,
122 size_t * result_len);
123
124int mailmbox_fetch_msg_headers_no_lock(struct mailmbox_folder * folder,
125 uint32_t num, char ** result,
126 size_t * result_len);
127
128/* append message */
129
130int
131mailmbox_append_message_list_no_lock(struct mailmbox_folder * folder,
132 carray * append_tab);
133
134int mailmbox_expunge_no_lock(struct mailmbox_folder * folder);
135
136#ifdef __cplusplus
137}
138#endif
139
140#endif