summaryrefslogtreecommitdiffabout
path: root/kmicromail/libetpan/include
authorzautrix <zautrix>2004-07-03 16:33:12 (UTC)
committer zautrix <zautrix>2004-07-03 16:33:12 (UTC)
commite3b89230f065c48c84b48c88edb6eb088374c487 (patch) (unidiff)
tree162ea2ef909a6f82ccfcedf45d80d6c821174912 /kmicromail/libetpan/include
parent2dd6ac0b2d24c91d35ce674a6c26351352df2b15 (diff)
downloadkdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.zip
kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.tar.gz
kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.tar.bz2
Initial revision
Diffstat (limited to 'kmicromail/libetpan/include') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libetpan/include/libetpan/carray.h124
-rw-r--r--kmicromail/libetpan/include/libetpan/charconv.h67
-rw-r--r--kmicromail/libetpan/include/libetpan/chash.h166
-rw-r--r--kmicromail/libetpan/include/libetpan/cinthash.h69
-rw-r--r--kmicromail/libetpan/include/libetpan/clist.h134
-rw-r--r--kmicromail/libetpan/include/libetpan/data_message_driver.h50
-rw-r--r--kmicromail/libetpan/include/libetpan/generic_cache_types.h56
-rw-r--r--kmicromail/libetpan/include/libetpan/imapdriver.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/imapdriver_cached.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/imapdriver_cached_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/imapdriver_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/imapdriver_types.h144
-rw-r--r--kmicromail/libetpan/include/libetpan/imapstorage.h90
-rw-r--r--kmicromail/libetpan/include/libetpan/libetpan-config.h7
-rw-r--r--kmicromail/libetpan/include/libetpan/libetpan.h104
-rw-r--r--kmicromail/libetpan/include/libetpan/libetpan_version.h51
-rw-r--r--kmicromail/libetpan/include/libetpan/mail.h56
-rw-r--r--kmicromail/libetpan/include/libetpan/maildir.h60
-rw-r--r--kmicromail/libetpan/include/libetpan/maildir_types.h90
-rw-r--r--kmicromail/libetpan/include/libetpan/maildirdriver.h53
-rw-r--r--kmicromail/libetpan/include/libetpan/maildirdriver_cached.h53
-rw-r--r--kmicromail/libetpan/include/libetpan/maildirdriver_cached_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/maildirdriver_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/maildirdriver_types.h96
-rw-r--r--kmicromail/libetpan/include/libetpan/maildirstorage.h69
-rw-r--r--kmicromail/libetpan/include/libetpan/maildriver.h543
-rw-r--r--kmicromail/libetpan/include/libetpan/maildriver_errors.h99
-rw-r--r--kmicromail/libetpan/include/libetpan/maildriver_types.h793
-rw-r--r--kmicromail/libetpan/include/libetpan/maildriver_types_helper.h99
-rw-r--r--kmicromail/libetpan/include/libetpan/mailfolder.h32
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimap.h598
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimap_helper.h66
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimap_socket.h54
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimap_ssl.h54
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimap_types.h3274
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimap_types_helper.h758
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimf.h345
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimf_types.h793
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimf_types_helper.h370
-rw-r--r--kmicromail/libetpan/include/libetpan/mailimf_write.h134
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmbox.h140
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmbox_types.h142
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmessage.h379
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmessage_types.h50
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmh.h143
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmime.h100
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmime_content.h89
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmime_decode.h55
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmime_disposition.h62
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmime_types.h440
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmime_types_helper.h165
-rw-r--r--kmicromail/libetpan/include/libetpan/mailmime_write.h73
-rw-r--r--kmicromail/libetpan/include/libetpan/mailpop3.h100
-rw-r--r--kmicromail/libetpan/include/libetpan/mailpop3_helper.h64
-rw-r--r--kmicromail/libetpan/include/libetpan/mailpop3_socket.h54
-rw-r--r--kmicromail/libetpan/include/libetpan/mailpop3_ssl.h54
-rw-r--r--kmicromail/libetpan/include/libetpan/mailpop3_types.h107
-rw-r--r--kmicromail/libetpan/include/libetpan/mailsmtp.h94
-rw-r--r--kmicromail/libetpan/include/libetpan/mailsmtp_helper.h74
-rw-r--r--kmicromail/libetpan/include/libetpan/mailsmtp_socket.h56
-rw-r--r--kmicromail/libetpan/include/libetpan/mailsmtp_ssl.h55
-rw-r--r--kmicromail/libetpan/include/libetpan/mailsmtp_types.h126
-rw-r--r--kmicromail/libetpan/include/libetpan/mailstorage.h98
-rw-r--r--kmicromail/libetpan/include/libetpan/mailstorage_types.h203
-rw-r--r--kmicromail/libetpan/include/libetpan/mailstream.h73
-rw-r--r--kmicromail/libetpan/include/libetpan/mailstream_helper.h70
-rw-r--r--kmicromail/libetpan/include/libetpan/mailstream_low.h62
-rw-r--r--kmicromail/libetpan/include/libetpan/mailstream_socket.h61
-rw-r--r--kmicromail/libetpan/include/libetpan/mailstream_ssl.h59
-rw-r--r--kmicromail/libetpan/include/libetpan/mailstream_types.h87
-rw-r--r--kmicromail/libetpan/include/libetpan/mailthread.h108
-rw-r--r--kmicromail/libetpan/include/libetpan/mailthread_types.h63
-rw-r--r--kmicromail/libetpan/include/libetpan/mboxdriver.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/mboxdriver_cached.h54
-rw-r--r--kmicromail/libetpan/include/libetpan/mboxdriver_cached_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/mboxdriver_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/mboxdriver_types.h107
-rw-r--r--kmicromail/libetpan/include/libetpan/mboxstorage.h69
-rw-r--r--kmicromail/libetpan/include/libetpan/mhdriver.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/mhdriver_cached.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/mhdriver_cached_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/mhdriver_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/mhdriver_types.h100
-rw-r--r--kmicromail/libetpan/include/libetpan/mhstorage.h67
-rw-r--r--kmicromail/libetpan/include/libetpan/mime_message_driver.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/mmapstring.h136
-rw-r--r--kmicromail/libetpan/include/libetpan/newsnntp.h188
-rw-r--r--kmicromail/libetpan/include/libetpan/newsnntp_socket.h55
-rw-r--r--kmicromail/libetpan/include/libetpan/newsnntp_ssl.h55
-rw-r--r--kmicromail/libetpan/include/libetpan/newsnntp_types.h144
-rw-r--r--kmicromail/libetpan/include/libetpan/nntpdriver.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/nntpdriver_cached.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/nntpdriver_cached_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/nntpdriver_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/nntpdriver_types.h146
-rw-r--r--kmicromail/libetpan/include/libetpan/nntpstorage.h93
-rw-r--r--kmicromail/libetpan/include/libetpan/pop3driver.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/pop3driver_cached.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/pop3driver_cached_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/pop3driver_message.h52
-rw-r--r--kmicromail/libetpan/include/libetpan/pop3driver_types.h153
-rw-r--r--kmicromail/libetpan/include/libetpan/pop3storage.h95
102 files changed, 15663 insertions, 0 deletions
diff --git a/kmicromail/libetpan/include/libetpan/carray.h b/kmicromail/libetpan/include/libetpan/carray.h
new file mode 100644
index 0000000..06003aa
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/carray.h
@@ -0,0 +1,124 @@
1
2/*
3 * libEtPan! -- a mail stuff library
4 *
5 * carray - Implements simple dynamic pointer arrays
6 *
7 * Copyright (c) 1999-2000, Gaël Roualland <gael.roualland@iname.com>
8 * interface changes - 2002 - DINH Viet Hoa
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the libEtPan! project nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36/*
37 * $Id$
38 */
39
40#ifndef CARRAY_H
41#define CARRAY_H
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47struct carray_s {
48 void ** array;
49 unsigned int len;
50 unsigned int max;
51};
52
53typedef struct carray_s carray;
54
55/* Creates a new array of pointers, with initsize preallocated cells */
56carray * carray_new(unsigned int initsize);
57
58/* Adds the pointer to data in the array.
59 Returns the index of the pointer in the array or -1 on error */
60int carray_add(carray * array, void * data, unsigned int * index);
61
62int carray_set_size(carray * array, unsigned int new_size);
63
64/* Removes the cell at this index position. Returns TRUE on success.
65 Order of elements in the array IS changed. */
66int carray_delete(carray * array, unsigned int indx);
67
68/* Removes the cell at this index position. Returns TRUE on success.
69 Order of elements in the array IS not changed. */
70int carray_delete_slow(carray * array, unsigned int indx);
71
72/* remove without decreasing the size of the array */
73int carray_delete_fast(carray * array, unsigned int indx);
74
75/* Some of the following routines can be implemented as macros to
76 be faster. If you don't want it, define NO_MACROS */
77#ifdef NO_MACROS
78
79/* Returns the array itself */
80void ** carray_data(carray *);
81
82/* Returns the number of elements in the array */
83int carray_count(carray *);
84
85/* Returns the contents of one cell */
86void * carray_get(carray * array, unsigned int indx);
87
88/* Sets the contents of one cell */
89void carray_set(carray * array, unsigned int indx, void * value);
90
91#else
92
93#if 0
94#define carray_data(a) (a->array)
95#define carray_count(a) (a->len)
96#define carray_get(a, indx) (a->array[indx])
97#define carray_set(a, indx, v) do { a->array[indx]=v; } while(0)
98#endif
99
100static inline void ** carray_data(carray * array) {
101 return array->array;
102}
103
104static inline unsigned int carray_count(carray * array) {
105 return array->len;
106}
107
108static inline void * carray_get(carray * array, unsigned int indx) {
109 return array->array[indx];
110}
111
112static inline void carray_set(carray * array,
113 unsigned int indx, void * value) {
114 array->array[indx] = value;
115}
116#endif
117
118void carray_free(carray * array);
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif
diff --git a/kmicromail/libetpan/include/libetpan/charconv.h b/kmicromail/libetpan/include/libetpan/charconv.h
new file mode 100644
index 0000000..5a435ff
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/charconv.h
@@ -0,0 +1,67 @@
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 CHARCONV_H
37
38#define CHARCONV_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <sys/types.h>
45
46enum {
47 MAIL_CHARCONV_NO_ERROR = 0,
48 MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET,
49 MAIL_CHARCONV_ERROR_MEMORY,
50 MAIL_CHARCONV_ERROR_CONV,
51};
52
53int charconv(const char * tocode, const char * fromcode,
54 const char * str, size_t length,
55 char ** result);
56
57int charconv_buffer(const char * tocode, const char * fromcode,
58 const char * str, size_t length,
59 char ** result, size_t * result_len);
60
61void charconv_buffer_free(char * str);
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif
diff --git a/kmicromail/libetpan/include/libetpan/chash.h b/kmicromail/libetpan/include/libetpan/chash.h
new file mode 100644
index 0000000..3b2b7d3
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/chash.h
@@ -0,0 +1,166 @@
1
2/*
3 * libEtPan! -- a mail stuff library
4 *
5 * chash - Implements generic hash tables.
6 *
7 * Copyright (c) 1999-2000, Gaël Roualland <gael.roualland@iname.com>
8 * interface changes - 2002 - DINH Viet Hoa
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the libEtPan! project nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36/*
37 * $Id$
38 */
39
40#ifndef CHASH_H
41#define CHASH_H
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47typedef struct {
48 void * data;
49 unsigned int len;
50} chashdatum;
51
52struct chash {
53 unsigned int size;
54 unsigned int count;
55 int copyvalue;
56 int copykey;
57 struct chashcell ** cells;
58};
59
60typedef struct chash chash;
61
62struct chashcell {
63 unsigned int func;
64 chashdatum key;
65 chashdatum value;
66 struct chashcell * next;
67};
68
69typedef struct chashcell chashiter;
70
71#define CHASH_COPYNONE 0
72#define CHASH_COPYKEY 1
73#define CHASH_COPYVALUE 2
74#define CHASH_COPYALL (CHASH_COPYKEY | CHASH_COPYVALUE)
75
76#define CHASH_DEFAULTSIZE 13
77
78/* Allocates a new (empty) hash using this initial size and the given flags,
79 specifying which data should be copied in the hash.
80 CHASH_COPYNONE : Keys/Values are not copied.
81 CHASH_COPYKEY : Keys are dupped and freed as needed in the hash.
82 CHASH_COPYVALUE : Values are dupped and freed as needed in the hash.
83 CHASH_COPYALL : Both keys and values are dupped in the hash.
84 */
85chash * chash_new(unsigned int size, int flags);
86
87/* Frees a hash */
88void chash_free(chash * hash);
89
90/* Removes all elements from a hash */
91void chash_clear(chash * hash);
92
93/* Adds an entry in the hash table.
94 Length can be 0 if key/value are strings.
95 If an entry already exists for this key, it is replaced, and its value
96 is returned. Otherwise, the data pointer will be NULL and the length
97 field be set to TRUE or FALSe to indicate success or failure. */
98int chash_set(chash * hash,
99 chashdatum * key,
100 chashdatum * value,
101 chashdatum * oldvalue);
102
103/* Retrieves the data associated to the key if it is found in the hash table.
104 The data pointer and the length will be NULL if not found*/
105int chash_get(chash * hash,
106 chashdatum * key, chashdatum * result);
107
108/* Removes the entry associated to this key if it is found in the hash table,
109 and returns its contents if not dupped (otherwise, pointer will be NULL
110 and len TRUE). If entry is not found both pointer and len will be NULL. */
111int chash_delete(chash * hash,
112 chashdatum * key,
113 chashdatum * oldvalue);
114
115/* Resizes the hash table to the passed size. */
116int chash_resize(chash * hash, unsigned int size);
117
118/* Returns an iterator to the first non-empty entry of the hash table */
119chashiter * chash_begin(chash * hash);
120
121/* Returns the next non-empty entry of the hash table */
122chashiter * chash_next(chash * hash, chashiter * iter);
123
124/* Some of the following routines can be implemented as macros to
125 be faster. If you don't want it, define NO_MACROS */
126#ifdef NO_MACROS
127/* Returns the size of the hash table */
128unsigned int chash_size(chash * hash);
129
130/* Returns the number of entries in the hash table */
131unsigned int chash_count(chash * hash);
132
133/* Returns the key part of the entry pointed by the iterator */
134void chash_key(chashiter * iter, chashdatum * result);
135
136/* Returns the value part of the entry pointed by the iterator */
137void chash_value(chashiter * iter, chashdatum * result);
138
139#else
140static inline unsigned int chash_size(chash * hash)
141{
142 return hash->size;
143}
144
145static inline unsigned int chash_count(chash * hash)
146{
147 return hash->count;
148}
149
150static inline void chash_key(chashiter * iter, chashdatum * result)
151{
152 * result = iter->key;
153}
154
155static inline void chash_value(chashiter * iter, chashdatum * result)
156{
157 * result = iter->value;
158}
159
160#endif
161
162#ifdef __cplusplus
163}
164#endif
165
166#endif
diff --git a/kmicromail/libetpan/include/libetpan/cinthash.h b/kmicromail/libetpan/include/libetpan/cinthash.h
new file mode 100644
index 0000000..7e59dff
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/cinthash.h
@@ -0,0 +1,69 @@
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 CINTHASH_H
37
38#define CINTHASH_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44typedef struct cinthash_t {
45 struct cinthash_list * table;
46 unsigned long hashtable_size ;
47 unsigned long count;
48} cinthash_t;
49
50cinthash_t * cinthash_new(unsigned long hashtable_size);
51void cinthash_free(cinthash_t * table);
52
53int cinthash_add(cinthash_t * table, unsigned long hash, void * data);
54int cinthash_remove(cinthash_t * table, unsigned long hash);
55void * cinthash_find(cinthash_t * table, unsigned long hash);
56
57void cinthash_foreach_key(cinthash_t * table,
58 void (* func)(unsigned long, void *),
59 void * data);
60
61void cinthash_foreach_data(cinthash_t * table,
62 void (* fun)(void *, void *),
63 void * data);
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif
diff --git a/kmicromail/libetpan/include/libetpan/clist.h b/kmicromail/libetpan/include/libetpan/clist.h
new file mode 100644
index 0000000..bd97f59
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/clist.h
@@ -0,0 +1,134 @@
1
2/*
3 * libEtPan! -- a mail stuff library
4 *
5 * clist - Implements simple generic double-linked pointer lists
6 *
7 * Copyright (c) 1999-2000, Gaël Roualland <gael.roualland@iname.com>
8 * interface changes - 2002 - DINH Viet Hoa
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the libEtPan! project nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36/*
37 * $Id$
38 */
39
40#ifndef CLIST_H
41#define CLIST_H
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47typedef struct clistcell_s {
48 void * data;
49 struct clistcell_s * previous;
50 struct clistcell_s * next;
51} clistcell;
52
53struct clist_s {
54 clistcell * first;
55 clistcell * last;
56 int count;
57};
58
59typedef struct clist_s clist;
60typedef clistcell clistiter;
61
62/* Allocate a new pointer list */
63clist * clist_new();
64
65/* Destroys a list. Data pointed by data pointers is NOT freed. */
66void clist_free(clist *);
67
68/* Some of the following routines can be implemented as macros to
69 be faster. If you don't want it, define NO_MACROS */
70#ifdef NO_MACROS
71
72/* Returns TRUE if list is empty */
73int clist_isempty(clist *);
74
75/* Returns the number of elements in the list */
76int clist_count(clist *);
77
78/* Returns an iterator to the first element of the list */
79clistiter * clist_begin(clist *);
80
81/* Returns an iterator to the last element of the list */
82clistiter * clist_end(clist *);
83
84/* Returns an iterator to the next element of the list */
85clistiter * clist_next(clistiter *);
86
87/* Returns an iterator to the previous element of the list */
88clistiter * clist_previous(clistiter *);
89
90/* Returns the data pointer of this element of the list */
91void* clist_content(clistiter *);
92
93/* Inserts this data pointer at the beginning of the list */
94int clist_prepend(clist *, void *);
95
96/* Inserts this data pointer at the end of the list */
97int clist_append(clist *, void *);
98#else
99#define clist_isempty(lst) ((lst->first==lst->last) && (lst->last==NULL))
100#define clist_count(lst) (lst->count)
101#define clist_begin(lst) (lst->first)
102#define clist_end(lst) (lst->last)
103#define clist_next(iter) (iter ? iter->next : NULL)
104#define clist_previous(iter) (iter ? iter->previous : NULL)
105#define clist_content(iter) (iter ? iter->data : NULL)
106#define clist_prepend(lst, data) (clist_insert_before(lst, lst->first, data))
107#define clist_append(lst, data) (clist_insert_after(lst, lst->last, data))
108#endif
109
110/* Inserts this data pointer before the element pointed by the iterator */
111int clist_insert_before(clist *, clistiter *, void *);
112
113/* Inserts this data pointer after the element pointed by the iterator */
114int clist_insert_after(clist *, clistiter *, void *);
115
116/* Deletes the element pointed by the iterator.
117 Returns an iterator to the next element. */
118clistiter * clist_delete(clist *, clistiter *);
119
120typedef void (* clist_func)(void *, void *);
121
122void clist_foreach(clist * lst, clist_func func, void * data);
123
124void clist_concat(clist * dest, clist * src);
125
126void * clist_nth_data(clist * lst, int index);
127
128clistiter * clist_nth(clist * lst, int index);
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif
diff --git a/kmicromail/libetpan/include/libetpan/data_message_driver.h b/kmicromail/libetpan/include/libetpan/data_message_driver.h
new file mode 100644
index 0000000..e0ee752
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/data_message_driver.h
@@ -0,0 +1,50 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001 - 2003 - 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 DATA_MESSAGE_DRIVER_H
37
38#define DATA_MESSAGE_DRIVER_H
39
40#include <libetpan/mailmessage.h>
41
42#define LIBETPAN_DATA_MESSAGE
43
44extern mailmessage_driver * data_message_driver;
45
46mailmessage * data_message_init(char * data, size_t len);
47
48void data_message_detach_mime(mailmessage * msg);
49
50#endif
diff --git a/kmicromail/libetpan/include/libetpan/generic_cache_types.h b/kmicromail/libetpan/include/libetpan/generic_cache_types.h
new file mode 100644
index 0000000..8803a42
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/generic_cache_types.h
@@ -0,0 +1,56 @@
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 GENERIC_CACHE_TYPE_H
37
38#define GENERIC_CACHE_TYPE_H
39
40#include <libetpan/carray.h>
41#include <libetpan/chash.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47struct mail_flags_store {
48 carray * fls_tab;
49 chash * fls_hash;
50};
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
diff --git a/kmicromail/libetpan/include/libetpan/imapdriver.h b/kmicromail/libetpan/include/libetpan/imapdriver.h
new file mode 100644
index 0000000..2bf36c7
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/imapdriver.h
@@ -0,0 +1,52 @@
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 IMAPDRIVER_H
37
38#define IMAPDRIVER_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/imapdriver_types.h>
45
46extern mailsession_driver * imap_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/imapdriver_cached.h b/kmicromail/libetpan/include/libetpan/imapdriver_cached.h
new file mode 100644
index 0000000..92bb60d
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/imapdriver_cached.h
@@ -0,0 +1,52 @@
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 IMAPDRIVER_CACHED_H
37
38#define IMAPDRIVER_CACHED_H
39
40#include <libetpan/imapdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailsession_driver * imap_cached_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/imapdriver_cached_message.h b/kmicromail/libetpan/include/libetpan/imapdriver_cached_message.h
new file mode 100644
index 0000000..49d63cb
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/imapdriver_cached_message.h
@@ -0,0 +1,52 @@
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 IMAPDRIVER_CACHED_MESSAGE_H
37
38#define IMAPDRIVER_CACHED_MESSAGE_H
39
40#include <libetpan/imapdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * imap_cached_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/imapdriver_message.h b/kmicromail/libetpan/include/libetpan/imapdriver_message.h
new file mode 100644
index 0000000..9142633
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/imapdriver_message.h
@@ -0,0 +1,52 @@
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 IMAPDRIVER_MESSAGE_H
37
38#define IMAPDRIVER_MESSAGE_H
39
40#include <libetpan/imapdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * imap_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/imapdriver_types.h b/kmicromail/libetpan/include/libetpan/imapdriver_types.h
new file mode 100644
index 0000000..d4e216d
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/imapdriver_types.h
@@ -0,0 +1,144 @@
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 IMAPDRIVER_TYPES_H
37
38#define IMAPDRIVER_TYPES_H
39
40#include <libetpan/libetpan-config.h>
41
42#include <libetpan/mailimap.h>
43#include <libetpan/maildriver_types.h>
44#include <libetpan/generic_cache_types.h>
45#include <libetpan/mailstorage_types.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/* IMAP driver for session */
52
53struct imap_session_state_data {
54 mailimap * imap_session;
55 char * imap_mailbox;
56 struct mail_flags_store * imap_flags_store;
57};
58
59enum {
60 IMAP_SECTION_MESSAGE,
61 IMAP_SECTION_HEADER,
62 IMAP_SECTION_MIME,
63 IMAP_SECTION_BODY
64};
65
66/* cached IMAP driver for session */
67
68enum {
69 IMAPDRIVER_CACHED_SET_CACHE_DIRECTORY = 1,
70};
71
72struct imap_cached_session_state_data {
73 mailsession * imap_ancestor;
74 char * imap_quoted_mb;
75 char imap_cache_directory[PATH_MAX];
76 carray * imap_uid_list;
77};
78
79
80/* IMAP storage */
81
82/*
83 imap_mailstorage is the state data specific to the IMAP4rev1 storage.
84
85 - servername this is the name of the IMAP4rev1 server
86
87 - port is the port to connect to, on the server.
88 you give 0 to use the default port.
89
90 - command, if non-NULL the command used to connect to the
91 server instead of allowing normal TCP connections to be used.
92
93 - connection_type is the type of socket layer to use.
94 The value can be CONNECTION_TYPE_PLAIN, CONNECTION_TYPE_STARTTLS,
95 CONNECTION_TYPE_TRY_STARTTLS, CONNECTION_TYPE_TLS or
96 CONNECTION_TYPE_COMMAND.
97
98 - auth_type is the authenticate mechanism to use.
99 The value can be IMAP_AUTH_TYPE_PLAIN.
100 Other values are not yet implemented.
101
102 - login is the login of the IMAP4rev1 account.
103
104 - password is the password of the IMAP4rev1 account.
105
106 - cached if this value is != 0, a persistant cache will be
107 stored on local system.
108
109 - cache_directory is the location of the cache
110*/
111
112struct imap_mailstorage {
113 char * imap_servername;
114 uint16_t imap_port;
115 char * imap_command;
116 int imap_connection_type;
117
118 int imap_auth_type;
119 char * imap_login;
120 char * imap_password;
121
122 int imap_cached;
123 char * imap_cache_directory;
124};
125
126/* this is the type of IMAP4rev1 authentication */
127
128enum {
129 IMAP_AUTH_TYPE_PLAIN, /* plain text authentication */
130 IMAP_AUTH_TYPE_SASL_ANONYMOUS, /* SASL anonymous */
131 IMAP_AUTH_TYPE_SASL_CRAM_MD5, /* SASL CRAM MD5 */
132 IMAP_AUTH_TYPE_SASL_KERBEROS_V4, /* SASL KERBEROS V4 */
133 IMAP_AUTH_TYPE_SASL_PLAIN, /* SASL plain */
134 IMAP_AUTH_TYPE_SASL_SCRAM_MD5, /* SASL SCRAM MD5 */
135 IMAP_AUTH_TYPE_SASL_GSSAPI, /* SASL GSSAPI */
136 IMAP_AUTH_TYPE_SASL_DIGEST_MD5, /* SASL digest MD5 */
137};
138
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif
diff --git a/kmicromail/libetpan/include/libetpan/imapstorage.h b/kmicromail/libetpan/include/libetpan/imapstorage.h
new file mode 100644
index 0000000..ebc42b0
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/imapstorage.h
@@ -0,0 +1,90 @@
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 IMAPSTORAGE_H
37
38#define IMAPSTORAGE_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/imapdriver_types.h>
45
46/*
47 imap_mailstorage_init is the constructor for a IMAP4rev1 storage
48
49 @param storage this is the storage to initialize.
50
51 @param servername this is the name of the IMAP4rev1 server
52
53 @param port is the port to connect to, on the server.
54 you give 0 to use the default port.
55
56 @param command the command used to connect to the server instead of
57 allowing normal TCP connections to be used.
58
59 @param connection_type is the type of socket layer to use.
60 The value can be CONNECTION_TYPE_PLAIN, CONNECTION_TYPE_STARTTLS,
61 CONNECTION_TYPE_TRY_STARTTLS, CONNECTION_TYPE_TLS,
62 CONNECTION_TYPE_COMMAND, CONNECTION_TYPE_COMMAND_STARTTLS,
63 CONNECTION_TYPE_COMMAND_TRY_STARTTLS, CONNECTION_TYPE_COMMAND_TLS,.
64
65 @param auth_type is the authenticate mechanism to use.
66 The value can be IMAP_AUTH_TYPE_PLAIN.
67 Other values are not yet implemented.
68
69 @param login is the login of the IMAP4rev1 account.
70
71 @param password is the password of the IMAP4rev1 account.
72
73 @param cached if this value is != 0, a persistant cache will be
74 stored on local system.
75
76 @param cache_directory is the location of the cache
77*/
78
79int imap_mailstorage_init(struct mailstorage * storage,
80 char * imap_servername, uint16_t imap_port,
81 char * imap_command,
82 int imap_connection_type, int imap_auth_type,
83 char * imap_login, char * imap_password,
84 int imap_cached, char * imap_cache_directory);
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif
diff --git a/kmicromail/libetpan/include/libetpan/libetpan-config.h b/kmicromail/libetpan/include/libetpan/libetpan-config.h
new file mode 100644
index 0000000..20d1e62
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/libetpan-config.h
@@ -0,0 +1,7 @@
1#ifndef LIBETPAN_CONFIG_H
2#define LIBETPAN_CONFIG_H
3#include <limits.h>
4#include <sys/param.h>
5#define MAIL_DIR_SEPARATOR '/'
6#define MAIL_DIR_SEPARATOR_S "/"
7#endif
diff --git a/kmicromail/libetpan/include/libetpan/libetpan.h b/kmicromail/libetpan/include/libetpan/libetpan.h
new file mode 100644
index 0000000..3b4a107
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/libetpan.h
@@ -0,0 +1,104 @@
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 LIBETPAN_H
37
38#define LIBETPAN_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/libetpan_version.h>
45#include <libetpan/maildriver.h>
46#include <libetpan/mailmessage.h>
47#include <libetpan/mailstorage.h>
48#include <libetpan/mailthread.h>
49#include <libetpan/mailsmtp.h>
50#include <libetpan/charconv.h>
51
52/* mbox driver */
53#include <libetpan/mboxdriver.h>
54#include <libetpan/mboxdriver_message.h>
55#include <libetpan/mboxdriver_cached.h>
56#include <libetpan/mboxdriver_cached_message.h>
57#include <libetpan/mboxstorage.h>
58
59/* MH driver */
60#include <libetpan/mhdriver.h>
61#include <libetpan/mhdriver_message.h>
62#include <libetpan/mhdriver_cached.h>
63#include <libetpan/mhdriver_cached_message.h>
64#include <libetpan/mhstorage.h>
65
66/* IMAP4rev1 driver */
67#include <libetpan/imapdriver.h>
68#include <libetpan/imapdriver_message.h>
69#include <libetpan/imapdriver_cached.h>
70#include <libetpan/imapdriver_cached_message.h>
71#include <libetpan/imapstorage.h>
72
73/* POP3 driver */
74#include <libetpan/pop3driver.h>
75#include <libetpan/pop3driver_message.h>
76#include <libetpan/pop3driver_cached.h>
77#include <libetpan/pop3driver_cached_message.h>
78#include <libetpan/pop3storage.h>
79
80/* NNTP driver */
81#include <libetpan/nntpdriver.h>
82#include <libetpan/nntpdriver_message.h>
83#include <libetpan/nntpdriver_cached.h>
84#include <libetpan/nntpdriver_cached_message.h>
85#include <libetpan/nntpstorage.h>
86
87/* maildir driver */
88#include <libetpan/maildirdriver.h>
89#include <libetpan/maildirdriver_message.h>
90#include <libetpan/maildirdriver_cached.h>
91#include <libetpan/maildirdriver_cached_message.h>
92#include <libetpan/maildirstorage.h>
93
94/* message which content is given by a MIME structure */
95#include <libetpan/mime_message_driver.h>
96
97/* message which content given by a string */
98#include <libetpan/data_message_driver.h>
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif
diff --git a/kmicromail/libetpan/include/libetpan/libetpan_version.h b/kmicromail/libetpan/include/libetpan/libetpan_version.h
new file mode 100644
index 0000000..5f9e5cf
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/libetpan_version.h
@@ -0,0 +1,51 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001 - 2003 - 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 LIBETPAN_VERSION_H
37
38#define LIBETPAN_VERSION_H
39
40#ifndef LIBETPAN_VERSION_MAJOR
41#define LIBETPAN_VERSION_MAJOR 0
42#endif
43
44#ifndef LIBETPAN_VERSION_MINOR
45#define LIBETPAN_VERSION_MINOR 32
46#endif
47
48int libetpan_get_version_major(void);
49int libetpan_get_version_minor(void);
50
51#endif
diff --git a/kmicromail/libetpan/include/libetpan/mail.h b/kmicromail/libetpan/include/libetpan/mail.h
new file mode 100644
index 0000000..d4c63c4
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mail.h
@@ -0,0 +1,56 @@
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 MAIL_H
37
38#define MAIL_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#ifndef TRUE
45#define TRUE 1
46#endif
47
48#ifndef FALSE
49#define FALSE 0
50#endif
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildir.h b/kmicromail/libetpan/include/libetpan/maildir.h
new file mode 100644
index 0000000..b782484
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildir.h
@@ -0,0 +1,60 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001 - 2003 - 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 MAILDIR_H
37
38#define MAILDIR_H
39
40#include <libetpan/maildir_types.h>
41
42struct maildir * maildir_new(const char * path);
43
44void maildir_free(struct maildir * md);
45
46int maildir_update(struct maildir * md);
47
48int maildir_message_add(struct maildir * md,
49 const char * message, size_t size);
50
51int maildir_message_add_file(struct maildir * md, int fd);
52
53char * maildir_message_get(struct maildir * md, const char * uid);
54
55int maildir_message_remove(struct maildir * md, const char * uid);
56
57int maildir_message_change_flags(struct maildir * md,
58 const char * uid, int new_flags);
59
60#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildir_types.h b/kmicromail/libetpan/include/libetpan/maildir_types.h
new file mode 100644
index 0000000..c7e368e
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildir_types.h
@@ -0,0 +1,90 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001 - 2003 - 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 MAILDIR_TYPES_H
37
38#define MAILDIR_TYPES_H
39
40#include <sys/types.h>
41#include <unistd.h>
42#include <libetpan/chash.h>
43#include <libetpan/carray.h>
44#include <inttypes.h>
45
46#include <libetpan/libetpan-config.h>
47
48#define LIBETPAN_MAILDIR
49
50enum {
51 MAILDIR_NO_ERROR = 0,
52 MAILDIR_ERROR_CREATE,
53 MAILDIR_ERROR_DIRECTORY,
54 MAILDIR_ERROR_MEMORY,
55 MAILDIR_ERROR_FILE,
56 MAILDIR_ERROR_NOT_FOUND,
57};
58
59#define MAILDIR_FLAG_NEW (1 << 0)
60#define MAILDIR_FLAG_SEEN (1 << 1)
61#define MAILDIR_FLAG_REPLIED (1 << 2)
62#define MAILDIR_FLAG_FLAGGED (1 << 3)
63#define MAILDIR_FLAG_TRASHED (1 << 4)
64
65struct maildir_msg {
66 char * msg_uid;
67 char * msg_filename;
68 int msg_flags;
69};
70
71/*
72 work around for missing #define HOST_NAME_MAX in Linux
73*/
74
75#ifndef HOST_NAME_MAX
76#define HOST_NAME_MAX 255
77#endif
78
79struct maildir {
80 pid_t mdir_pid;
81 char mdir_hostname[HOST_NAME_MAX];
82 char mdir_path[PATH_MAX];
83 uint32_t mdir_counter;
84 time_t mdir_mtime_new;
85 time_t mdir_mtime_cur;
86 carray * mdir_msg_list;
87 chash * mdir_msg_hash;
88};
89
90#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildirdriver.h b/kmicromail/libetpan/include/libetpan/maildirdriver.h
new file mode 100644
index 0000000..f59cf3e
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildirdriver.h
@@ -0,0 +1,53 @@
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 MAILDIRDRIVER_H
37
38#define MAILDIRDRIVER_H
39
40#include <libetpan/maildriver.h>
41#include <libetpan/maildirdriver_types.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47extern mailsession_driver * maildir_session_driver;
48
49#ifdef __cplusplus
50}
51#endif
52
53#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildirdriver_cached.h b/kmicromail/libetpan/include/libetpan/maildirdriver_cached.h
new file mode 100644
index 0000000..81de3c3
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildirdriver_cached.h
@@ -0,0 +1,53 @@
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 MAILDIRDRIVER_CACHED_H
37
38#define MAILDIRDRIVER_CACHED_H
39
40#include <libetpan/maildriver.h>
41#include <libetpan/maildirdriver_types.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47extern mailsession_driver * maildir_cached_session_driver;
48
49#ifdef __cplusplus
50}
51#endif
52
53#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildirdriver_cached_message.h b/kmicromail/libetpan/include/libetpan/maildirdriver_cached_message.h
new file mode 100644
index 0000000..399ecaa
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildirdriver_cached_message.h
@@ -0,0 +1,52 @@
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 MAILDIRDRIVER_CACHED_MESSAGE_H
37
38#define MAILDIRDRIVER_CACHED_MESSAGE_H
39
40#include <libetpan/maildirdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * maildir_cached_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildirdriver_message.h b/kmicromail/libetpan/include/libetpan/maildirdriver_message.h
new file mode 100644
index 0000000..cb378bc
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildirdriver_message.h
@@ -0,0 +1,52 @@
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 MAILDIRDRIVER_MESSAGE_H
37
38#define MAILDIRDRIVER_MESSAGE_H
39
40#include <libetpan/maildirdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * maildir_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildirdriver_types.h b/kmicromail/libetpan/include/libetpan/maildirdriver_types.h
new file mode 100644
index 0000000..cb3661f
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildirdriver_types.h
@@ -0,0 +1,96 @@
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 MAILDIRDRIVER_TYPES_H
37
38#define MAILDIRDRIVER_TYPES_H
39
40#include <libetpan/libetpan-config.h>
41
42#include <libetpan/maildriver_types.h>
43#include <libetpan/maildir.h>
44#include <libetpan/generic_cache_types.h>
45#include <libetpan/mailstorage_types.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51struct maildir_session_state_data {
52 struct maildir * md_session;
53 struct mail_flags_store * md_flags_store;
54};
55
56enum {
57 MAILDIRDRIVER_CACHED_SET_CACHE_DIRECTORY = 1,
58 MAILDIRDRIVER_CACHED_SET_FLAGS_DIRECTORY,
59};
60
61struct maildir_cached_session_state_data {
62 mailsession * md_ancestor;
63 char * md_quoted_mb;
64 struct mail_flags_store * md_flags_store;
65 char md_cache_directory[PATH_MAX];
66 char md_flags_directory[PATH_MAX];
67};
68
69/* maildir storage */
70
71/*
72 maildir_mailstorage is the state data specific to the maildir storage.
73
74 - pathname is the path of the maildir storage.
75
76 - cached if this value is != 0, a persistant cache will be
77 stored on local system.
78
79 - cache_directory is the location of the cache.
80
81 - flags_directory is the location of the flags.
82*/
83
84struct maildir_mailstorage {
85 char * md_pathname;
86
87 int md_cached;
88 char * md_cache_directory;
89 char * md_flags_directory;
90};
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildirstorage.h b/kmicromail/libetpan/include/libetpan/maildirstorage.h
new file mode 100644
index 0000000..d17ea2c
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildirstorage.h
@@ -0,0 +1,69 @@
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 MAILDIRSTORAGE_H
37
38#define MAILDIRSTORAGE_H
39
40#include <libetpan/maildirdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 maildir_mailstorage_init is the constructor for a mbox storage.
48
49 @param storage this is the storage to initialize.
50
51 @param pathname is the directory that contains the mailbox.
52
53 @param cached if this value is != 0, a persistant cache will be
54 stored on local system.
55
56 @param cache_directory is the location of the cache
57
58 @param flags_directory is the location of the flags
59*/
60
61int maildir_mailstorage_init(struct mailstorage * storage,
62 char * md_pathname, int md_cached,
63 char * md_cache_directory, char * md_flags_directory);
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildriver.h b/kmicromail/libetpan/include/libetpan/maildriver.h
new file mode 100644
index 0000000..7da9aea
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildriver.h
@@ -0,0 +1,543 @@
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 MAILDRIVER_H
37
38#define MAILDRIVER_H
39
40#include <libetpan/maildriver_types.h>
41#include <libetpan/maildriver_types_helper.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/* mailsession */
48
49/*
50 mailsession_new creates a new session, using the given driver
51
52 @return the created session is returned
53*/
54
55mailsession * mailsession_new(mailsession_driver * sess_driver);
56
57/*
58 mailsession_free release the memory used by the session
59*/
60
61void mailsession_free(mailsession * session);
62
63/*
64 mailsession_parameters is used to make calls specific to the driver
65
66 @param id is the command to send to the driver,
67 usually, commands can be found in the header of the driver
68
69 @param value is the parameter of the specific call
70
71 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
72 on error
73*/
74
75int mailsession_parameters(mailsession * session,
76 int id, void * value);
77
78/*
79 There are drivers of two kinds : stream drivers (driver that connects
80 to servers through TCP or other means of connection) and file drivers
81 (driver that are based on filesystem)
82
83 The following function can only be used by stream drivers.
84 mailsession_connect_stream connects a stream to the session
85
86 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
87 on error
88*/
89
90int mailsession_connect_stream(mailsession * session, mailstream * s);
91
92/*
93 The following function can only be used by file drivers.
94 mailsession_connect_path selects the main path of the session
95
96 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
97 on error
98*/
99
100int mailsession_connect_path(mailsession * session, char * path);
101
102/*
103 NOTE: works only on stream drivers
104
105 mailsession_starttls switches the current connection to TLS (secure layer)
106
107 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
108 on error
109*/
110
111int mailsession_starttls(mailsession * session);
112
113/*
114 mailsession_login notifies the login and the password to authenticate
115 to the session
116
117 @param userid the given string is only needed at this function call
118 (it will be duplicated if necessary)
119 @param password the given string is only needed at this function call
120 (it will be duplicated if necessary)
121
122 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
123 on error
124*/
125
126int mailsession_login(mailsession * session,
127 char * userid, char * password);
128
129/*
130 NOTE: this function doesn't often work on filsystem drivers
131
132 mailsession_logout deconnects the session and closes the stream.
133
134 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
135 on error
136*/
137
138int mailsession_logout(mailsession * session);
139
140/*
141 mailsession_noop does no operation on the session, but it can be
142 used to poll for the status of the connection.
143
144 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
145 on error
146*/
147
148int mailsession_noop(mailsession * session);
149
150/*
151 NOTE: driver's specific should be used
152
153 mailsession_build_folder_name will return an allocated string with
154 that contains the complete path of the folder to create
155
156 @param session the sesion
157 @param mb is the parent mailbox
158 @param name is the name of the folder to create
159 @param result the complete path of the folder to create will be
160 stored in (* result), this name have to be freed with free()
161
162 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
163 on error
164*/
165
166int mailsession_build_folder_name(mailsession * session, char * mb,
167 char * name, char ** result);
168
169/*
170 NOTE: driver's specific should be used
171
172 mailsession_create_folder creates the folder that corresponds to the
173 given name
174
175 @param session the session
176 @param mb is the name of the mailbox
177
178 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
179 on error
180*/
181
182int mailsession_create_folder(mailsession * session, char * mb);
183
184
185/*
186 NOTE: driver's specific should be used
187
188 mailsession_delete_folder deletes the folder that corresponds to the
189 given name
190
191 @param session the session
192 @param mb is the name of the mailbox
193
194 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
195 on error
196*/
197
198int mailsession_delete_folder(mailsession * session, char * mb);
199
200
201/*
202 mailsession_rename_folder changes the name of the folder
203
204 @param session the session
205 @param mb is the name of the mailbox whose name has to be changed
206 @param new_name is the destination name (the parent
207 of the new folder folder can be other)
208
209 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
210 on error
211*/
212
213int mailsession_rename_folder(mailsession * session,
214 char * mb, char * new_name);
215
216/*
217 mailsession_check_folder makes a checkpoint of the session
218
219 @param session the session
220
221 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
222 on error
223*/
224
225int mailsession_check_folder(mailsession * session);
226
227
228/*
229 NOTE: this function is not implemented in most drivers
230
231 mailsession_examine_folder selects a mailbox as readonly
232
233 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
234 on error
235*/
236
237int mailsession_examine_folder(mailsession * session, char * mb);
238
239
240/*
241 mailsession_select_folder selects a mailbox
242
243 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
244 on error
245*/
246
247int mailsession_select_folder(mailsession * session, char * mb);
248
249
250/*
251 mailsession_expunge_folder deletes all messages marked \Deleted
252
253 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
254 on error
255*/
256
257int mailsession_expunge_folder(mailsession * session);
258
259
260/*
261 mailsession_status_folder queries the status of the folder
262 (number of messages, number of recent messages, number of unseen messages)
263
264 @param session the session
265 @param mb mailbox to query
266 @param result_messages the number of messages is stored
267 in (* result_messages)
268 @param result_recent the number of messages is stored
269 in (* result_recent)
270 @param result_unseen the number of messages is stored
271 in (* result_unseen)
272
273 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
274 on error
275*/
276
277int mailsession_status_folder(mailsession * session, char * mb,
278 uint32_t * result_messages, uint32_t * result_recent,
279 uint32_t * result_unseen);
280
281
282/*
283 mailsession_messages_number queries the number of messages in the folder
284
285 @param session the session
286 @param mb mailbox to query
287 @param result the number of messages is stored in (* result)
288
289 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
290 on error
291*/
292
293int mailsession_messages_number(mailsession * session, char * mb,
294 uint32_t * result);
295
296/*
297 mailsession_recent_number queries the number of recent messages in the folder
298
299 @param session the session
300 @param mb mailbox to query
301 @param result the number of recent messages is stored in (* result)
302
303 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
304 on error
305*/
306
307int mailsession_recent_number(mailsession * session,
308 char * mb, uint32_t * result);
309
310/*
311 mailsession_unseen_number queries the number of unseen messages in the folder
312
313 @param session the session
314 @param mb mailbox to query
315 @param result the number of unseen messages is stored in (* result)
316
317 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
318 on error
319*/
320
321int mailsession_unseen_number(mailsession * session, char * mb,
322 uint32_t * result);
323
324/*
325 NOTE: driver's specific should be used
326
327 mailsession_list_folders returns the list of all sub-mailboxes
328 of the given mailbox
329
330 @param session the session
331 @param mb the mailbox
332 @param result list of mailboxes if stored in (* result),
333 this structure have to be freed with mail_list_free()
334
335 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
336 on error
337*/
338
339int mailsession_list_folders(mailsession * session, char * mb,
340 struct mail_list ** result);
341
342/*
343 NOTE: driver's specific should be used
344
345 mailsession_lsub_folders returns the list of subscribed
346 sub-mailboxes of the given mailbox
347
348 @param session the session
349 @param mb the mailbox
350 @param result list of mailboxes if stored in (* result),
351 this structure have to be freed with mail_list_free()
352
353 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
354 on error
355*/
356
357int mailsession_lsub_folders(mailsession * session, char * mb,
358 struct mail_list ** result);
359
360/*
361 NOTE: driver's specific should be used
362
363 mailsession_subscribe_folder subscribes to the given mailbox
364
365 @param session the session
366 @param mb the mailbox
367
368 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
369 on error
370*/
371
372int mailsession_subscribe_folder(mailsession * session, char * mb);
373
374/*
375 NOTE: driver's specific should be used
376
377 mailsession_unsubscribe_folder unsubscribes to the given mailbox
378
379 @param session the session
380 @param mb the mailbox
381
382 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
383 on error
384*/
385
386int mailsession_unsubscribe_folder(mailsession * session, char * mb);
387
388/*
389 mailsession_append_message adds a RFC 2822 message to the current
390 given mailbox
391
392 @param session the session
393 @param message is a string that contains the RFC 2822 message
394 @param size this is the size of the message
395
396 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
397 on error
398*/
399
400int mailsession_append_message(mailsession * session,
401 char * message, size_t size);
402
403/*
404 NOTE: some drivers does not implement this
405
406 mailsession_copy_message copies a message whose number is given to
407 a given mailbox. The mailbox must be accessible from the same session.
408
409 @param session the session
410 @param num the message number
411 @param mb the destination mailbox
412
413 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
414 on error
415*/
416
417int mailsession_copy_message(mailsession * session,
418 uint32_t num, char * mb);
419
420/*
421 NOTE: some drivers does not implement this
422
423 mailsession_move_message copies a message whose number is given to
424 a given mailbox. The mailbox must be accessible from the same session.
425
426 @param session the session
427 @param num the message number
428 @param mb the destination mailbox
429
430 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
431 on error
432*/
433
434int mailsession_move_message(mailsession * session,
435 uint32_t num, char * mb);
436
437/*
438 mailsession_get_messages_list returns the list of message numbers
439 of the current mailbox.
440
441 @param session the session
442 @param result the list of message numbers will be stored in (* result),
443 this structure have to be freed with mailmessage_list_free()
444
445 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
446 on error
447*/
448
449int mailsession_get_messages_list(mailsession * session,
450 struct mailmessage_list ** result);
451
452/*
453 mailsession_get_envelopes_list fills the parsed fields in the
454 mailmessage structures of the mailmessage_list.
455
456 @param session the session
457 @param result this is the list of mailmessage structures
458
459 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
460 on error
461*/
462
463int mailsession_get_envelopes_list(mailsession * session,
464 struct mailmessage_list * result);
465
466/*
467 NOTE: some drivers does not implement this
468
469 mailsession_remove_message removes the given message from the mailbox.
470 The message is permanently deleted.
471
472 @param session the session
473 @param num is the message number
474
475 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
476 on error
477*/
478
479int mailsession_remove_message(mailsession * session, uint32_t num);
480
481
482/*
483 NOTE: this function is not implemented in most drivers
484
485 mailsession_search_message returns a list of message numbers that
486 corresponds to the given criteria.
487
488 @param session the session
489 @param charset is the charset to use (it can be NULL)
490 @param key is the list of criteria
491 @param result the search result is stored in (* result),
492 this structure have to be freed with mail_search_result_free()
493
494 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
495 on error
496*/
497
498#if 0
499int mailsession_search_messages(mailsession * session, char * charset,
500 struct mail_search_key * key,
501 struct mail_search_result ** result);
502#endif
503
504/*
505 mailsession_get_message returns a mailmessage structure that corresponds
506 to the given message number.
507 * WARNING * mailsession_get_message_by_uid() should be used instead.
508
509 @param session the session
510 @param num the message number
511 @param result the allocated mailmessage structure will be stored
512 in (* result), this structure have to be freed with mailmessage_free()
513
514 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
515 on error
516*/
517
518int mailsession_get_message(mailsession * session,
519 uint32_t num, mailmessage ** result);
520
521/*
522 mailsession_get_message_by_uid returns a mailmessage structure
523 that corresponds to the given message unique identifier.
524 This is currently implemented only for cached drivers.
525 * WARNING * That will deprecates the use of mailsession_get_message()
526
527 @param session the session
528 @param uid the message unique identifier
529 @param result the allocated mailmessage structure will be stored
530 in (* result), this structure have to be freed with mailmessage_free()
531
532 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
533 on error
534*/
535
536int mailsession_get_message_by_uid(mailsession * session,
537 const char * uid, mailmessage ** result);
538
539#ifdef __cplusplus
540}
541#endif
542
543#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildriver_errors.h b/kmicromail/libetpan/include/libetpan/maildriver_errors.h
new file mode 100644
index 0000000..118b259
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildriver_errors.h
@@ -0,0 +1,99 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001 - 2003 - 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 MAILDRIVER_ERRORS_H
37
38#define MAILDRIVER_ERRORS_H
39
40enum {
41 MAIL_NO_ERROR = 0,
42 MAIL_NO_ERROR_AUTHENTICATED,
43 MAIL_NO_ERROR_NON_AUTHENTICATED,
44 MAIL_ERROR_NOT_IMPLEMENTED,
45 MAIL_ERROR_UNKNOWN,
46 MAIL_ERROR_CONNECT,
47 MAIL_ERROR_BAD_STATE,
48 MAIL_ERROR_FILE,
49 MAIL_ERROR_STREAM,
50 MAIL_ERROR_LOGIN,
51 MAIL_ERROR_CREATE, /* 10 */
52 MAIL_ERROR_DELETE,
53 MAIL_ERROR_LOGOUT,
54 MAIL_ERROR_NOOP,
55 MAIL_ERROR_RENAME,
56 MAIL_ERROR_CHECK,
57 MAIL_ERROR_EXAMINE,
58 MAIL_ERROR_SELECT,
59 MAIL_ERROR_MEMORY,
60 MAIL_ERROR_STATUS,
61 MAIL_ERROR_SUBSCRIBE, /* 20 */
62 MAIL_ERROR_UNSUBSCRIBE,
63 MAIL_ERROR_LIST,
64 MAIL_ERROR_LSUB,
65 MAIL_ERROR_APPEND,
66 MAIL_ERROR_COPY,
67 MAIL_ERROR_FETCH,
68 MAIL_ERROR_STORE,
69 MAIL_ERROR_SEARCH,
70 MAIL_ERROR_DISKSPACE,
71 MAIL_ERROR_MSG_NOT_FOUND, /* 30 */
72 MAIL_ERROR_PARSE,
73 MAIL_ERROR_INVAL,
74 MAIL_ERROR_PART_NOT_FOUND,
75 MAIL_ERROR_REMOVE,
76 MAIL_ERROR_FOLDER_NOT_FOUND,
77 MAIL_ERROR_MOVE,
78 MAIL_ERROR_STARTTLS,
79 MAIL_ERROR_CACHE_MISS,
80 MAIL_ERROR_NO_TLS,
81 MAIL_ERROR_EXPUNGE,
82 /* misc errors */
83 MAIL_ERROR_MISC,
84 MAIL_ERROR_PROTOCOL,
85 MAIL_ERROR_CAPABILITY,
86 MAIL_ERROR_CLOSE,
87 MAIL_ERROR_FATAL,
88 MAIL_ERROR_READONLY,
89 MAIL_ERROR_NO_APOP,
90 MAIL_ERROR_COMMAND_NOT_SUPPORTED,
91 MAIL_ERROR_NO_PERMISSION,
92 MAIL_ERROR_PROGRAM_ERROR,
93 MAIL_ERROR_SUBJECT_NOT_FOUND,
94 MAIL_ERROR_CHAR_ENCODING_FAILED,
95 MAIL_ERROR_SEND,
96 MAIL_ERROR_COMMAND,
97};
98
99#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildriver_types.h b/kmicromail/libetpan/include/libetpan/maildriver_types.h
new file mode 100644
index 0000000..3ff9440
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildriver_types.h
@@ -0,0 +1,793 @@
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 MAILDRIVER_TYPES_H
37
38#define MAILDRIVER_TYPES_H
39
40#include <inttypes.h>
41#include <sys/types.h>
42
43#include <libetpan/mailstream.h>
44#include <libetpan/mailimf.h>
45#include <libetpan/mailmime.h>
46#include <libetpan/carray.h>
47
48#include <libetpan/mailthread_types.h>
49#include <libetpan/maildriver_errors.h>
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55typedef struct mailsession_driver mailsession_driver;
56
57typedef struct mailsession mailsession;
58
59typedef struct mailmessage_driver mailmessage_driver;
60
61typedef struct mailmessage mailmessage;
62
63
64/*
65 mailmessage_list is a list of mailmessage
66
67 - tab is an array of mailmessage structures
68*/
69
70struct mailmessage_list {
71 carray * msg_tab; /* elements are (mailmessage *) */
72};
73
74struct mailmessage_list * mailmessage_list_new(carray * msg_tab);
75void mailmessage_list_free(struct mailmessage_list * env_list);
76
77/*
78 mail_list is a list of mailbox names
79
80 - list is a list of mailbox names
81*/
82
83struct mail_list {
84 clist * mb_list; /* elements are (char *) */
85};
86
87struct mail_list * mail_list_new(clist * mb_list);
88void mail_list_free(struct mail_list * resp);
89
90/*
91 This is a flag value.
92 Flags can be combined with OR operation
93*/
94
95enum {
96 MAIL_FLAG_NEW = 1 << 0,
97 MAIL_FLAG_SEEN = 1 << 1,
98 MAIL_FLAG_FLAGGED = 1 << 2,
99 MAIL_FLAG_DELETED = 1 << 3,
100 MAIL_FLAG_ANSWERED = 1 << 4,
101 MAIL_FLAG_FORWARDED = 1 << 5,
102 MAIL_FLAG_CANCELLED = 1 << 6,
103};
104
105/*
106 mail_flags is the value of a flag related to a message.
107
108 - flags is the standard flags value
109
110 - extension is a list of unknown flags for libEtPan!
111*/
112
113struct mail_flags {
114 uint32_t fl_flags;
115 clist * fl_extension; /* elements are (char *) */
116};
117
118struct mail_flags * mail_flags_new(uint32_t fl_flags, clist * fl_ext);
119void mail_flags_free(struct mail_flags * flags);
120
121/*
122 This function creates a flag for a new message
123*/
124
125struct mail_flags * mail_flags_new_empty(void);
126
127
128/*
129 mailimf_date_time_comp compares two dates
130
131
132*/
133
134int32_t mailimf_date_time_comp(struct mailimf_date_time * date1,
135 struct mailimf_date_time * date2);
136
137/*
138 this is type type of the search criteria
139*/
140
141enum {
142 MAIL_SEARCH_KEY_ALL, /* all messages correspond */
143 MAIL_SEARCH_KEY_ANSWERED, /* messages with flag \Answered */
144 MAIL_SEARCH_KEY_BCC, /* messages which Bcc field contains
145 a given string */
146 MAIL_SEARCH_KEY_BEFORE, /* messages which internal date is earlier
147 than the specified date */
148 MAIL_SEARCH_KEY_BODY, /* message that contains the given string
149 (in header and text parts) */
150 MAIL_SEARCH_KEY_CC, /* messages whose Cc field contains the
151 given string */
152 MAIL_SEARCH_KEY_DELETED, /* messages with the flag \Deleted */
153 MAIL_SEARCH_KEY_FLAGGED, /* messages with the flag \Flagged */
154 MAIL_SEARCH_KEY_FROM, /* messages whose From field contains the
155 given string */
156 MAIL_SEARCH_KEY_NEW, /* messages with the flag \Recent and not
157 the \Seen flag */
158 MAIL_SEARCH_KEY_OLD, /* messages that do not have the
159 \Recent flag set */
160 MAIL_SEARCH_KEY_ON, /* messages whose internal date is the
161 specified date */
162 MAIL_SEARCH_KEY_RECENT, /* messages with the flag \Recent */
163 MAIL_SEARCH_KEY_SEEN, /* messages with the flag \Seen */
164 MAIL_SEARCH_KEY_SINCE, /* messages whose internal date is later
165 than specified date */
166 MAIL_SEARCH_KEY_SUBJECT, /* messages whose Subject field contains the
167 given string */
168 MAIL_SEARCH_KEY_TEXT, /* messages whose text part contains the
169 given string */
170 MAIL_SEARCH_KEY_TO, /* messages whose To field contains the
171 given string */
172 MAIL_SEARCH_KEY_UNANSWERED, /* messages with no flag \Answered */
173 MAIL_SEARCH_KEY_UNDELETED, /* messages with no flag \Deleted */
174 MAIL_SEARCH_KEY_UNFLAGGED, /* messages with no flag \Flagged */
175 MAIL_SEARCH_KEY_UNSEEN, /* messages with no flag \Seen */
176 MAIL_SEARCH_KEY_HEADER, /* messages whose given field
177 contains the given string */
178 MAIL_SEARCH_KEY_LARGER, /* messages whose size is larger then
179 the given size */
180 MAIL_SEARCH_KEY_NOT, /* not operation of the condition */
181 MAIL_SEARCH_KEY_OR, /* or operation between two conditions */
182 MAIL_SEARCH_KEY_SMALLER, /* messages whose size is smaller than
183 the given size */
184 MAIL_SEARCH_KEY_MULTIPLE /* the boolean operator between the
185 conditions is AND */
186};
187
188/*
189 mail_search_key is the condition on the messages to return
190
191 - type is the type of the condition
192
193 - bcc is the text to search in the Bcc field when type is
194 MAIL_SEARCH_KEY_BCC, should be allocated with malloc()
195
196 - before is a date when type is MAIL_SEARCH_KEY_BEFORE
197
198 - body is the text to search in the message when type is
199 MAIL_SEARCH_KEY_BODY, should be allocated with malloc()
200
201 - cc is the text to search in the Cc field when type is
202 MAIL_SEARCH_KEY_CC, should be allocated with malloc()
203
204 - from is the text to search in the From field when type is
205 MAIL_SEARCH_KEY_FROM, should be allocated with malloc()
206
207 - on is a date when type is MAIL_SEARCH_KEY_ON
208
209 - since is a date when type is MAIL_SEARCH_KEY_SINCE
210
211 - subject is the text to search in the Subject field when type is
212 MAILIMAP_SEARCH_KEY_SUBJECT, should be allocated with malloc()
213
214 - text is the text to search in the text part of the message when
215 type is MAILIMAP_SEARCH_KEY_TEXT, should be allocated with malloc()
216
217 - to is the text to search in the To field when type is
218 MAILIMAP_SEARCH_KEY_TO, should be allocated with malloc()
219
220 - header_name is the header name when type is MAILIMAP_SEARCH_KEY_HEADER,
221 should be allocated with malloc()
222
223 - header_value is the text to search in the given header when type is
224 MAILIMAP_SEARCH_KEY_HEADER, should be allocated with malloc()
225
226 - larger is a size when type is MAILIMAP_SEARCH_KEY_LARGER
227
228 - not is a condition when type is MAILIMAP_SEARCH_KEY_NOT
229
230 - or1 is a condition when type is MAILIMAP_SEARCH_KEY_OR
231
232 - or2 is a condition when type is MAILIMAP_SEARCH_KEY_OR
233
234 - sentbefore is a date when type is MAILIMAP_SEARCH_KEY_SENTBEFORE
235
236 - senton is a date when type is MAILIMAP_SEARCH_KEY_SENTON
237
238 - sentsince is a date when type is MAILIMAP_SEARCH_KEY_SENTSINCE
239
240 - smaller is a size when type is MAILIMAP_SEARCH_KEY_SMALLER
241
242 - multiple is a set of message when type is MAILIMAP_SEARCH_KEY_MULTIPLE
243*/
244
245#if 0
246struct mail_search_key {
247 int sk_type;
248 union {
249 char * sk_bcc;
250 struct mailimf_date_time * sk_before;
251 char * sk_body;
252 char * sk_cc;
253 char * sk_from;
254 struct mailimf_date_time * sk_on;
255 struct mailimf_date_time * sk_since;
256 char * sk_subject;
257 char * sk_text;
258 char * sk_to;
259 char * sk_header_name;
260 char * sk_header_value;
261 size_t sk_larger;
262 struct mail_search_key * sk_not;
263 struct mail_search_key * sk_or1;
264 struct mail_search_key * sk_or2;
265 size_t sk_smaller;
266 clist * sk_multiple; /* list of (struct mailimap_search_key *) */
267 } sk_data;
268};
269
270
271struct mail_search_key *
272mail_search_key_new(int sk_type,
273 char * sk_bcc, struct mailimf_date_time * sk_before,
274 char * sk_body, char * sk_cc, char * sk_from,
275 struct mailimf_date_time * sk_on, struct mailimf_date_time * sk_since,
276 char * sk_subject, char * sk_text, char * sk_to,
277 char * sk_header_name, char * sk_header_value, size_t sk_larger,
278 struct mail_search_key * sk_not, struct mail_search_key * sk_or1,
279 struct mail_search_key * sk_or2, size_t sk_smaller,
280 clist * sk_multiple);
281
282void mail_search_key_free(struct mail_search_key * key);
283#endif
284
285/*
286 mail_search_result is a list of message numbers that is returned
287 by the mailsession_search_messages function()
288*/
289
290#if 0
291struct mail_search_result {
292 clist * sr_list; /* list of (uint32_t *) */
293};
294
295struct mail_search_result * mail_search_result_new(clist * sr_list);
296
297void mail_search_result_free(struct mail_search_result * search_result);
298#endif
299
300
301/*
302 There is three kinds of identities :
303 - storage
304 - folders
305 - session
306
307 A storage (struct mailstorage) represents whether a server or
308 a main path,
309
310 A storage can be an IMAP server, the root path of a MH or a mbox file.
311
312 Folders (struct mailfolder) are the mailboxes we can
313 choose in the server or as sub-folder of the main path.
314
315 Folders for IMAP are the IMAP mailboxes, for MH this is one of the
316 folder of the MH storage, for mbox, there is only one folder, the
317 mbox file content;
318
319 A mail session (struct mailsession) is whether a connection to a server
320 or a path that is open. It is the abstraction lower folders and storage.
321 It allow us to send commands.
322
323 We have a session driver for mail session for each kind of storage.
324
325 From a session, we can get a message (struct mailmessage) to read.
326 We have a message driver for each kind of storage.
327*/
328
329/*
330 maildriver is the driver structure for mail sessions
331
332 - name is the name of the driver
333
334 - initialize() is the function that will initializes a data structure
335 specific to the driver, it returns a value that will be stored
336 in the field data of the session.
337 The field data of the session is the state of the session,
338 the internal data structure used by the driver.
339 It is called when creating the mailsession structure with
340 mailsession_new().
341
342 - uninitialize() frees the structure created with initialize()
343
344 - parameters() implements functions specific to the given mail access
345
346 - connect_stream() connects a stream to the session
347
348 - connect_path() notify a main path to the session
349
350 - starttls() changes the current stream to a TLS stream
351
352 - login() notifies the user and the password to authenticate to the
353 session
354
355 - logout() exits the session and closes the stream
356
357 - noop() does no operation on the session, but it can be
358 used to poll for the status of the connection.
359
360 - build_folder_name() will return an allocated string with
361 that contains the complete path of the folder to create
362
363 - create_folder() creates the folder that corresponds to the
364 given name
365
366 - delete_folder() deletes the folder that corresponds to the
367 given name
368
369 - rename_folder() change the name of the folder
370
371 - check_folder() makes a checkpoint of the session
372
373 - examine_folder() selects a mailbox as readonly
374
375 - select_folder() selects a mailbox
376
377 - expunge_folder() deletes all messages marked \Deleted
378
379 - status_folder() queries the status of the folder
380 (number of messages, number of recent messages, number of
381 unseen messages)
382
383 - messages_number() queries the number of messages in the folder
384
385 - recent_number() queries the number of recent messages in the folder
386
387 - unseen_number() queries the number of unseen messages in the folder
388
389 - list_folders() returns the list of all sub-mailboxes
390 of the given mailbox
391
392 - lsub_folders() returns the list of subscribed
393 sub-mailboxes of the given mailbox
394
395 - subscribe_folder() subscribes to the given mailbox
396
397 - unsubscribe_folder() unsubscribes to the given mailbox
398
399 - append_message() adds a RFC 2822 message to the current
400 given mailbox
401
402 - copy_message() copies a message whose number is given to
403 a given mailbox. The mailbox must be accessible from
404 the same session.
405
406 - move_message() copies a message whose number is given to
407 a given mailbox. The mailbox must be accessible from the
408 same session.
409
410 - get_messages_list() returns the list of message numbers
411 of the current mailbox.
412
413 - get_envelopes_list() fills the parsed fields in the
414 mailmessage structures of the mailmessage_list.
415
416 - remove_message() removes the given message from the mailbox.
417 The message is permanently deleted.
418
419 - search_message() returns a list of message numbers that
420 corresponds to the given criteria.
421
422 - get_message returns a mailmessage structure that corresponds
423 to the given message number.
424
425 - get_message_by_uid returns a mailmessage structure that corresponds
426 to the given message unique identifier.
427
428 * mandatory functions are the following :
429
430 - connect_stream() of connect_path()
431 - logout()
432 - get_messages_list()
433 - get_envelopes_list()
434
435 * we advise you to implement these functions :
436
437 - select_folder() (in case a session can access several folders)
438 - noop() (to check if the server is responding)
439 - check_folder() (to make a checkpoint of the session)
440 - status_folder(), messages_number(), recent_number(), unseen_number()
441 (to get stat of the folder)
442 - append_message() (but can't be done in the case of POP3 at least)
443 - login() in a case of an authenticated driver.
444 - starttls() in a case of a stream driver, if the procotol supports
445 STARTTLS.
446 - get_message_by_uid() so that the application can remember the message
447 by UID and build its own list of messages.
448
449 * drivers' specific :
450
451 Everything that is specific to the driver will be implemented in this
452 function :
453
454 - parameters()
455*/
456
457struct mailsession_driver {
458 char * sess_name;
459
460 int (* sess_initialize)(mailsession * session);
461 void (* sess_uninitialize)(mailsession * session);
462
463 int (* sess_parameters)(mailsession * session,
464 int id, void * value);
465
466 int (* sess_connect_stream)(mailsession * session, mailstream * s);
467 int (* sess_connect_path)(mailsession * session, char * path);
468
469 int (* sess_starttls)(mailsession * session);
470
471 int (* sess_login)(mailsession * session, char * userid, char * password);
472 int (* sess_logout)(mailsession * session);
473 int (* sess_noop)(mailsession * session);
474
475 /* folders operations */
476
477 int (* sess_build_folder_name)(mailsession * session, char * mb,
478 char * name, char ** result);
479
480 int (* sess_create_folder)(mailsession * session, char * mb);
481 int (* sess_delete_folder)(mailsession * session, char * mb);
482 int (* sess_rename_folder)(mailsession * session, char * mb,
483 char * new_name);
484 int (* sess_check_folder)(mailsession * session);
485 int (* sess_examine_folder)(mailsession * session, char * mb);
486 int (* sess_select_folder)(mailsession * session, char * mb);
487 int (* sess_expunge_folder)(mailsession * session);
488 int (* sess_status_folder)(mailsession * session, char * mb,
489 uint32_t * result_num, uint32_t * result_recent,
490 uint32_t * result_unseen);
491 int (* sess_messages_number)(mailsession * session, char * mb,
492 uint32_t * result);
493 int (* sess_recent_number)(mailsession * session, char * mb,
494 uint32_t * result);
495 int (* sess_unseen_number)(mailsession * session, char * mb,
496 uint32_t * result);
497
498 int (* sess_list_folders)(mailsession * session, char * mb,
499 struct mail_list ** result);
500 int (* sess_lsub_folders)(mailsession * session, char * mb,
501 struct mail_list ** result);
502
503 int (* sess_subscribe_folder)(mailsession * session, char * mb);
504 int (* sess_unsubscribe_folder)(mailsession * session, char * mb);
505
506 /* messages operations */
507
508 int (* sess_append_message)(mailsession * session,
509 char * message, size_t size);
510 int (* sess_copy_message)(mailsession * session,
511 uint32_t num, char * mb);
512 int (* sess_move_message)(mailsession * session,
513 uint32_t num, char * mb);
514
515 int (* sess_get_message)(mailsession * session,
516 uint32_t num, mailmessage ** result);
517
518 int (* sess_get_message_by_uid)(mailsession * session,
519 const char * uid, mailmessage ** result);
520
521 int (* sess_get_messages_list)(mailsession * session,
522 struct mailmessage_list ** result);
523 int (* sess_get_envelopes_list)(mailsession * session,
524 struct mailmessage_list * env_list);
525 int (* sess_remove_message)(mailsession * session, uint32_t num);
526#if 0
527 int (* sess_search_messages)(mailsession * session, char * charset,
528 struct mail_search_key * key,
529 struct mail_search_result ** result);
530#endif
531};
532
533
534/*
535 session is the data structure for a mail session.
536
537 - data is the internal data structure used by the driver
538 It is called when initializing the mailsession structure.
539
540 - driver is the driver used for the session
541*/
542
543struct mailsession {
544 void * sess_data;
545 mailsession_driver * sess_driver;
546};
547
548
549
550
551/*
552 mailmessage_driver is the driver structure to get information from messages.
553
554 - name is the name of the driver
555
556 - initialize() is the function that will initializes a data structure
557 specific to the driver, it returns a value that will be stored
558 in the field data of the mailsession.
559 The field data of the session is the state of the session,
560 the internal data structure used by the driver.
561 It is called when initializing the mailmessage structure with
562 mailmessage_init().
563
564 - uninitialize() frees the structure created with initialize().
565 It will be called by mailmessage_free().
566
567 - flush() will free from memory all temporary structures of the message
568 (for example, the MIME structure of the message).
569
570 - fetch_result_free() will free all strings resulted by fetch() or
571 any fetch_xxx() functions that returns a string.
572
573 - fetch() returns the content of the message (headers and text).
574
575 - fetch_header() returns the content of the headers.
576
577 - fetch_body() returns the message text (message content without headers)
578
579 - fetch_size() returns the size of the message content.
580
581 - get_bodystructure() returns the MIME structure of the message.
582
583 - fetch_section() returns the content of a given MIME part
584
585 - fetch_section_header() returns the header of the message
586 contained by the given MIME part.
587
588 - fetch_section_mime() returns the MIME headers of the
589 given MIME part.
590
591 - fetch_section_body() returns the text (if this is a message, this is the
592 message content without headers) of the given MIME part.
593
594 - fetch_envelope() returns a mailimf_fields structure, with a list of
595 fields chosen by the driver.
596
597 - get_flags() returns a the flags related to the message.
598 When you want to get flags of a message, you have to make sure to
599 call get_flags() at least once before using directly message->flags.
600*/
601
602#define LIBETPAN_MAIL_MESSAGE_CHECK
603
604struct mailmessage_driver {
605 char * msg_name;
606
607 int (* msg_initialize)(mailmessage * msg_info);
608
609 void (* msg_uninitialize)(mailmessage * msg_info);
610
611 void (* msg_flush)(mailmessage * msg_info);
612
613 void (* msg_check)(mailmessage * msg_info);
614
615 void (* msg_fetch_result_free)(mailmessage * msg_info,
616 char * msg);
617
618 int (* msg_fetch)(mailmessage * msg_info,
619 char ** result,
620 size_t * result_len);
621
622 int (* msg_fetch_header)(mailmessage * msg_info,
623 char ** result,
624 size_t * result_len);
625
626 int (* msg_fetch_body)(mailmessage * msg_info,
627 char ** result, size_t * result_len);
628
629 int (* msg_fetch_size)(mailmessage * msg_info,
630 size_t * result);
631
632 int (* msg_get_bodystructure)(mailmessage * msg_info,
633 struct mailmime ** result);
634
635 int (* msg_fetch_section)(mailmessage * msg_info,
636 struct mailmime * mime,
637 char ** result, size_t * result_len);
638
639 int (* msg_fetch_section_header)(mailmessage * msg_info,
640 struct mailmime * mime,
641 char ** result,
642 size_t * result_len);
643
644 int (* msg_fetch_section_mime)(mailmessage * msg_info,
645 struct mailmime * mime,
646 char ** result,
647 size_t * result_len);
648
649 int (* msg_fetch_section_body)(mailmessage * msg_info,
650 struct mailmime * mime,
651 char ** result,
652 size_t * result_len);
653
654 int (* msg_fetch_envelope)(mailmessage * msg_info,
655 struct mailimf_fields ** result);
656
657 int (* msg_get_flags)(mailmessage * msg_info,
658 struct mail_flags ** result);
659};
660
661
662/*
663 mailmessage is a data structure to get information from messages
664
665 - session is the session linked to the given message, it can be NULL
666
667 - driver is the message driver
668
669 - index is the message number
670
671 - uid, when it is not NULL, it means that the folder
672 the folder has persistant message numbers, the string is
673 the unique message number in the folder.
674 uid should be implemented if possible.
675 for drivers where we cannot generate real uid,
676 a suggestion is "AAAA-IIII" where AAAA is some
677 random session number and IIII the content of index field.
678
679 - size, when it is not 0, is the size of the message content.
680
681 - fields, when it is not NULL, are the header fields of the message.
682
683 - flags, when it is not NULL, are the flags related to the message.
684
685 - single_fields, when resolved != 0, is filled with the data of fields.
686
687 - mime, when it is not NULL
688
689 - cached is != 0 when the header fields were read from the cache.
690
691 - data is data specific to the driver, this is internal data structure,
692 some state of the message.
693*/
694
695struct mailmessage {
696 mailsession * msg_session;
697 mailmessage_driver * msg_driver;
698 uint32_t msg_index;
699 char * msg_uid;
700
701 size_t msg_size;
702 struct mailimf_fields * msg_fields;
703 struct mail_flags * msg_flags;
704
705 int msg_resolved;
706 struct mailimf_single_fields msg_single_fields;
707 struct mailmime * msg_mime;
708
709 /* internal data */
710
711 int msg_cached;
712 void * msg_data;
713
714 /*
715 msg_folder field :
716 used to reference the mailfolder, this is a workaround due
717 to the problem with initial conception, where folder notion
718 did not exist.
719 */
720 void * msg_folder;
721 /* user data */
722 void * msg_user_data;
723};
724
725
726/*
727 mailmessage_tree is a node in the messages tree (thread)
728
729 - parent is the parent of the message, it is NULL if the message
730 is the root of the message tree.
731
732 - date is the date of the message in number of second elapsed
733 since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
734
735 - msg is the message structure that is stored referenced by the node.
736 is msg is NULL, this is a dummy node.
737
738 - children is an array that contains all the children of the node.
739 children are mailmessage_tree structures.
740
741 - is_reply is != 0 when the message is a reply or a forward
742
743 - base_subject is the extracted subject of the message.
744
745 - index is the message number.
746*/
747
748struct mailmessage_tree {
749 struct mailmessage_tree * node_parent;
750 char * node_msgid;
751 time_t node_date;
752 mailmessage * node_msg;
753 carray * node_children; /* array of (struct mailmessage_tree *) */
754
755 /* private, used for threading */
756 int node_is_reply;
757 char * node_base_subject;
758};
759
760
761struct mailmessage_tree *
762mailmessage_tree_new(char * node_msgid, time_t node_date,
763 mailmessage * node_msg);
764
765void mailmessage_tree_free(struct mailmessage_tree * tree);
766
767/*
768 mailmessage_tree_free_recursive
769
770 if you want to release memory of the given tree and all the sub-trees,
771 you can use this function.
772*/
773
774void mailmessage_tree_free_recursive(struct mailmessage_tree * tree);
775
776
777struct generic_message_t {
778 int (* msg_prefetch)(mailmessage * msg_info);
779 void (* msg_prefetch_free)(struct generic_message_t * msg);
780 int msg_fetched;
781 char * msg_message;
782 size_t msg_length;
783 void * msg_data;
784};
785
786
787const char * maildriver_strerror(int err);
788
789#ifdef __cplusplus
790}
791#endif
792
793#endif
diff --git a/kmicromail/libetpan/include/libetpan/maildriver_types_helper.h b/kmicromail/libetpan/include/libetpan/maildriver_types_helper.h
new file mode 100644
index 0000000..2e74dea
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/maildriver_types_helper.h
@@ -0,0 +1,99 @@
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 MAILDRIVER_TYPES_HELPER_H
37
38#define MAILDRIVER_TYPES_HELPER_H
39
40#include <libetpan/maildriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 mail_flags_add_extension adds the given flag if it does not exists in
48 the flags.
49
50 @param flags this is the flag to change
51
52 @param ext_flag this is the name of an extension flag
53 the given flag name is duplicated and is no more needed after
54 the function call.
55
56 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
57 on error
58*/
59
60int mail_flags_add_extension(struct mail_flags * flags,
61 char * ext_flag);
62
63/*
64 mail_flags_remove_extension removes the given flag if it does not exists in
65 the flags.
66
67 @param flags this is the flag to change
68
69 @param ext_flag this is the name of an extension flag
70 the given flag name is no more needed after the function call.
71
72 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
73 on error
74*/
75
76int mail_flags_remove_extension(struct mail_flags * flags,
77 char * ext_flag);
78
79/*
80 mail_flags_has_extension returns 1 if the flags is in the given flags,
81 0 is returned otherwise.
82
83 @param flags this is the flag to change
84
85 @param ext_flag this is the name of an extension flag
86 the given flag name is no more needed after the function call.
87
88 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
89 on error
90*/
91
92int mail_flags_has_extension(struct mail_flags * flags,
93 char * ext_flag);
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailfolder.h b/kmicromail/libetpan/include/libetpan/mailfolder.h
new file mode 100644
index 0000000..3ecad23
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailfolder.h
@@ -0,0 +1,32 @@
1#ifndef MAILFOLDER_H
2
3#define MAILFOLDER_H
4
5#include "mailstorage_types.h"
6
7int mailfolder_noop(struct mailfolder * folder);
8
9int mailfolder_check(struct mailfolder * folder);
10
11int mailfolder_expunge(struct mailfolder * folder);
12
13int mailfolder_status(struct mailfolder * folder,
14 uint32_t * result_messages, uint32_t * result_recent,
15 uint32_t * result_unseen);
16
17int mailfolder_append_message(struct mailfolder * folder,
18 char * message, size_t size);
19
20int mailfolder_get_messages_list(struct mailfolder * folder,
21 struct mailmessage_list ** result);
22
23int mailfolder_get_envelopes_list(struct mailfolder * folder,
24 struct mailmessage_list * result);
25
26int mailfolder_get_message(struct mailfolder * folder,
27 uint32_t num, mailmessage ** result);
28
29int mailfolder_get_message_by_uid(struct mailfolder * folder,
30 const char * uid, mailmessage ** result);
31
32#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimap.h b/kmicromail/libetpan/include/libetpan/mailimap.h
new file mode 100644
index 0000000..8dfa3d4
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimap.h
@@ -0,0 +1,598 @@
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 MAILIMAP_H
37
38#define MAILIMAP_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailimap_types.h>
45#include <libetpan/mailimap_types_helper.h>
46#include <libetpan/mailimap_helper.h>
47
48#include <libetpan/mailimap_socket.h>
49#include <libetpan/mailimap_ssl.h>
50
51/*
52 mailimap_connect()
53
54 This function will connect the IMAP session with the given stream.
55
56 @param session the IMAP session
57 @param s stream to use
58
59 @return the return code is one of MAILIMAP_ERROR_XXX or
60 MAILIMAP_NO_ERROR codes
61
62 note that on success, MAILIMAP_NO_ERROR_AUTHENTICATED or
63 MAILIMAP_NO_ERROR_NON_AUTHENTICATED is returned
64
65 MAILIMAP_NO_ERROR_NON_AUTHENTICATED is returned when you need to
66 use mailimap_login() to authenticate, else
67 MAILIMAP_NO_ERROR_AUTHENTICATED is returned.
68*/
69
70int mailimap_connect(mailimap * session, mailstream * s);
71
72/*
73 mailimap_append()
74
75 This function will append a given message to the given mailbox
76 by sending an APPEND command.
77
78 @param session the IMAP session
79 @param mailbox name of the mailbox
80 @param flag_list flags of the message
81 @param date_time timestamp of the message
82 @param literal content of the message
83 @param literal_size size of the message
84
85 @return the return code is one of MAILIMAP_ERROR_XXX or
86 MAILIMAP_NO_ERROR codes
87*/
88
89int mailimap_append(mailimap * session, const char * mailbox,
90 struct mailimap_flag_list * flag_list,
91 struct mailimap_date_time * date_time,
92 const char * literal, size_t literal_size);
93
94/*
95 mailimap_noop()
96
97 This function will poll for an event on the server by
98 sending a NOOP command to the IMAP server
99
100 @param session IMAP session
101
102 @return the return code is one of MAILIMAP_ERROR_XXX or
103 MAILIMAP_NO_ERROR_XXX codes
104*/
105
106int mailimap_noop(mailimap * session);
107
108/*
109 mailimap_logout()
110
111 This function will logout from an IMAP server by sending
112 a LOGOUT command.
113
114 @param session IMAP session
115
116 @return the return code is one of MAILIMAP_ERROR_XXX or
117 MAILIMAP_NO_ERROR codes
118*/
119
120int mailimap_logout(mailimap * session);
121
122/*
123 mailimap_capability()
124
125 This function will query an IMAP server for his capabilities
126 by sending a CAPABILITY command.
127
128 @param session IMAP session
129 @param result The result of this command is a list of
130 capabilities and it is stored into (* result).
131
132 @return the return code is one of MAILIMAP_ERROR_XXX or
133 MAILIMAP_NO_ERROR codes
134 */
135
136int mailimap_capability(mailimap * session,
137 struct mailimap_capability_data ** result);
138
139/*
140 mailimap_check()
141
142 This function will request for a checkpoint of the mailbox by
143 sending a CHECK command.
144
145 @param session IMAP session
146
147 @return the return code is one of MAILIMAP_ERROR_XXX or
148 MAILIMAP_NO_ERROR codes
149 */
150
151int mailimap_check(mailimap * session);
152
153/*
154 mailimap_close()
155
156 This function will close the selected mailbox by sending
157 a CLOSE command.
158
159 @param session IMAP session
160
161 @return the return code is one of MAILIMAP_ERROR_XXX or
162 MAILIMAP_NO_ERROR codes
163 */
164
165int mailimap_close(mailimap * session);
166
167/*
168 mailimap_expunge()
169
170 This function will permanently remove from the selected mailbox
171 message that have the \Deleted flag set.
172
173 @param session IMAP session
174
175 @return the return code is one of MAILIMAP_ERROR_XXX or
176 MAILIMAP_NO_ERROR codes
177*/
178
179int mailimap_expunge(mailimap * session);
180
181/*
182 mailimap_copy()
183
184 This function will copy the given messages from the selected mailbox
185 to the given mailbox.
186
187 @param session IMAP session
188 @param set This is a set of message numbers.
189 @param mb This is the destination mailbox.
190
191 @return the return code is one of MAILIMAP_ERROR_XXX or
192 MAILIMAP_NO_ERROR codes
193 */
194
195int mailimap_copy(mailimap * session, struct mailimap_set * set,
196 const char * mb);
197
198/*
199 mailimap_uid_copy()
200
201 This function will copy the given messages from the selected mailbox
202 to the given mailbox.
203
204 @param session IMAP session
205 @param set This is a set of message unique identifiers.
206 @param mb This is the destination mailbox.
207
208 @return the return code is one of MAILIMAP_ERROR_XXX or
209 MAILIMAP_NO_ERROR codes
210 */
211
212int mailimap_uid_copy(mailimap * session,
213 struct mailimap_set * set, const char * mb);
214
215/*
216 mailimap_create()
217
218 This function will create a mailbox.
219
220 @param session IMAP session
221 @param mb This is the name of the mailbox to create.
222
223 @return the return code is one of MAILIMAP_ERROR_XXX or
224 MAILIMAP_NO_ERROR codes
225*/
226
227int mailimap_create(mailimap * session, const char * mb);
228
229/*
230 mailimap_delete()
231
232 This function will delete a mailox.
233
234 @param session IMAP session
235 @param mb This is the name of the mailbox to delete.
236
237 @return the return code is one of MAILIMAP_ERROR_XXX or
238 MAILIMAP_NO_ERROR codes
239*/
240
241int mailimap_delete(mailimap * session, const char * mb);
242
243/*
244 mailimap_examine()
245
246 This function will select the mailbox for read-only operations.
247
248 @param session IMAP session
249 @param mb This is the name of the mailbox to select.
250
251 @return the return code is one of MAILIMAP_ERROR_XXX or
252 MAILIMAP_NO_ERROR codes
253*/
254
255int mailimap_examine(mailimap * session, const char * mb);
256
257/*
258 mailimap_fetch()
259
260 This function will retrieve data associated with the given message
261 numbers.
262
263 @param session IMAP session
264 @param set set of message numbers
265 @param fetch_type type of information to be retrieved
266 @param result The result of this command is a clist
267 and it is stored into (* result). Each element of the clist is a
268 (struct mailimap_msg_att *).
269
270 @return the return code is one of MAILIMAP_ERROR_XXX or
271 MAILIMAP_NO_ERROR codes
272*/
273
274int
275mailimap_fetch(mailimap * session, struct mailimap_set * set,
276 struct mailimap_fetch_type * fetch_type, clist ** result);
277
278/*
279 mailimap_fetch()
280
281 This function will retrieve data associated with the given message
282 numbers.
283
284 @param session IMAP session
285 @param set set of message unique identifiers
286 @param fetch_type type of information to be retrieved
287 @param result The result of this command is a clist
288 and it is stored into (* result). Each element of the clist is a
289 (struct mailimap_msg_att *).
290
291 @return the return code is one of MAILIMAP_ERROR_XXX or
292 MAILIMAP_NO_ERROR codes
293*/
294
295int
296mailimap_uid_fetch(mailimap * session,
297 struct mailimap_set * set,
298 struct mailimap_fetch_type * fetch_type, clist ** result);
299
300/*
301 mailimap_fetch_list_free()
302
303 This function will free the result of a fetch command.
304
305 @param fetch_list This is the clist containing
306 (struct mailimap_msg_att *) elements to free.
307*/
308
309void mailimap_fetch_list_free(clist * fetch_list);
310
311/*
312 mailimap_list()
313
314 This function will return the list of the mailbox
315 available on the server.
316
317 @param session IMAP session
318 @param mb This is the reference name that informs
319 of the level of hierarchy
320 @param list_mb mailbox name with possible wildcard
321 @param result This will store a clist of (struct mailimap_mailbox_list *)
322 in (* result)
323
324 @return the return code is one of MAILIMAP_ERROR_XXX or
325 MAILIMAP_NO_ERROR codes
326*/
327
328int mailimap_list(mailimap * session, const char * mb,
329 const char * list_mb, clist ** result);
330
331/*
332 mailimap_login()
333
334 This function will authenticate the client.
335
336 @param session IMAP session
337 @param userid login of the user
338 @param password password of the user
339
340 @return the return code is one of MAILIMAP_ERROR_XXX or
341 MAILIMAP_NO_ERROR codes
342*/
343
344int mailimap_login(mailimap * session,
345 const char * userid, const char * password);
346
347/*
348 mailimap_lsub()
349
350 This function will return the list of the mailbox
351 that the client has subscribed to.
352
353 @param session IMAP session
354 @param mb This is the reference name that informs
355 of the level of hierarchy
356 @param list_mb mailbox name with possible wildcard
357 @param result This will store a list of (struct mailimap_mailbox_list *)
358 in (* result)
359
360 @return the return code is one of MAILIMAP_ERROR_XXX or
361 MAILIMAP_NO_ERROR codes
362*/
363
364int mailimap_lsub(mailimap * session, const char * mb,
365 const char * list_mb, clist ** result);
366
367/*
368 mailimap_list_result_free()
369
370 This function will free the clist of (struct mailimap_mailbox_list *)
371
372 @param list This is the clist to free.
373*/
374
375void mailimap_list_result_free(clist * list);
376
377/*
378 mailimap_rename()
379
380 This function will change the name of a mailbox.
381
382 @param session IMAP session
383 @param mb current name
384 @param new_name new name
385
386 @return the return code is one of MAILIMAP_ERROR_XXX or
387 MAILIMAP_NO_ERROR codes
388*/
389
390int mailimap_rename(mailimap * session,
391 const char * mb, const char * new_name);
392
393/*
394 mailimap_search()
395
396 All mails that match the given criteria will be returned
397 their numbers in the result list.
398
399 @param session IMAP session
400 @param charset This indicates the charset of the strings that appears
401 in the searching criteria
402 @param key This is the searching criteria
403 @param result The result is a clist of (uint32_t *) and will be
404 stored in (* result).
405
406 @return the return code is one of MAILIMAP_ERROR_XXX or
407 MAILIMAP_NO_ERROR codes
408*/
409
410int
411mailimap_search(mailimap * session, const char * charset,
412 struct mailimap_search_key * key, clist ** result);
413
414/*
415 mailimap_uid_search()
416
417
418 All mails that match the given criteria will be returned
419 their unique identifiers in the result list.
420
421 @param session IMAP session
422 @param charset This indicates the charset of the strings that appears
423 in the searching criteria
424 @param key This is the searching criteria
425 @param result The result is a clist of (uint32_t *) and will be
426 stored in (* result).
427
428 @return the return code is one of MAILIMAP_ERROR_XXX or
429 MAILIMAP_NO_ERROR codes
430*/
431
432int
433mailimap_uid_search(mailimap * session, const char * charset,
434 struct mailimap_search_key * key, clist ** result);
435
436/*
437 mailimap_search_result_free()
438
439 This function will free the result of the a search.
440
441 @param search_result This is a clist of (uint32_t *) returned
442 by mailimap_uid_search() or mailimap_search()
443*/
444
445void mailimap_search_result_free(clist * search_result);
446
447/*
448 mailimap_select()
449
450 This function will select a given mailbox so that messages in the
451 mailbox can be accessed.
452
453 @param session IMAP session
454 @param mb This is the name of the mailbox to select.
455
456 @return the return code is one of MAILIMAP_ERROR_XXX or
457 MAILIMAP_NO_ERROR codes
458*/
459
460int
461mailimap_select(mailimap * session, const char * mb);
462
463/*
464 mailimap_status()
465
466 This function will return informations about a given mailbox.
467
468 @param session IMAP session
469 @param mb This is the name of the mailbox
470 @param status_att_list This is the list of mailbox information to return
471 @param result List of returned values
472
473 @return the return code is one of MAILIMAP_ERROR_XXX or
474 MAILIMAP_NO_ERROR codes
475*/
476
477int
478mailimap_status(mailimap * session, const char * mb,
479 struct mailimap_status_att_list * status_att_list,
480 struct mailimap_mailbox_data_status ** result);
481
482/*
483 mailimap_uid_store()
484
485 This function will alter the data associated with some messages
486 (flags of the messages).
487
488 @param session IMAP session
489 @param set This is a list of message numbers.
490 @param store_att_flags This is the data to associate with the
491 given messages
492
493 @return the return code is one of MAILIMAP_ERROR_XXX or
494 MAILIMAP_NO_ERROR codes
495*/
496
497int
498mailimap_store(mailimap * session,
499 struct mailimap_set * set,
500 struct mailimap_store_att_flags * store_att_flags);
501
502/*
503 mailimap_uid_store()
504
505 This function will alter the data associated with some messages
506 (flags of the messages).
507
508 @param session IMAP session
509 @param set This is a list of message unique identifiers.
510 @param store_att_flags This is the data to associate with the
511 given messages
512
513 @return the return code is one of MAILIMAP_ERROR_XXX or
514 MAILIMAP_NO_ERROR codes
515*/
516
517int
518mailimap_uid_store(mailimap * session,
519 struct mailimap_set * set,
520 struct mailimap_store_att_flags * store_att_flags);
521
522/*
523 mailimap_subscribe()
524
525 This function adds the specified mailbox name to the
526 server's set of "active" or "subscribed" mailboxes.
527
528 @param session IMAP session
529 @param mb This is the name of the mailbox
530
531 @return the return code is one of MAILIMAP_ERROR_XXX or
532 MAILIMAP_NO_ERROR codes
533*/
534
535int mailimap_subscribe(mailimap * session, const char * mb);
536
537/*
538 mailimap_unsubscribe()
539
540 This function removes the specified mailbox name to the
541 server's set of "active" or "subscribed" mailboxes.
542
543 @param session IMAP session
544 @param mb This is the name of the mailbox
545
546 @return the return code is one of MAILIMAP_ERROR_XXX or
547 MAILIMAP_NO_ERROR codes
548*/
549
550int mailimap_unsubscribe(mailimap * session, const char * mb);
551
552/*
553 mailimap_starttls()
554
555 This function starts change the mode of the connection to
556 switch to SSL connection.
557
558 @param session IMAP session
559
560 @return the return code is one of MAILIMAP_ERROR_XXX or
561 MAILIMAP_NO_ERROR_XXX codes
562 */
563
564int mailimap_starttls(mailimap * session);
565
566/*
567 mailimap_new()
568
569 This function returns a new IMAP session.
570
571 @param progr_rate When downloading messages, a function will be called
572 each time the amount of bytes downloaded reaches a multiple of this
573 value, this can be 0.
574 @param progr_fun This is the function to call to notify the progress,
575 this can be NULL.
576
577 @return an IMAP session is returned.
578 */
579
580mailimap * mailimap_new(size_t imap_progr_rate,
581 progress_function * imap_progr_fun);
582
583/*
584 mailimap_free()
585
586 This function will free the data structures associated with
587 the IMAP session.
588
589 @param session IMAP session
590 */
591
592void mailimap_free(mailimap * session);
593
594#ifdef __cplusplus
595}
596#endif
597
598#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimap_helper.h b/kmicromail/libetpan/include/libetpan/mailimap_helper.h
new file mode 100644
index 0000000..d73cf5f
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimap_helper.h
@@ -0,0 +1,66 @@
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 MAILIMAP_HELPER_H
37
38#define MAILIMAP_HELPER_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailimap_types.h>
45
46int mailimap_fetch_rfc822(mailimap * session,
47 uint32_t msgid, char ** result);
48
49int mailimap_fetch_rfc822_header(mailimap * session,
50 uint32_t msgid, char ** result);
51
52int mailimap_fetch_envelope(mailimap * session,
53 uint32_t first, uint32_t last,
54 clist ** result);
55
56int mailimap_append_simple(mailimap * session, char * mailbox,
57 char * content, uint32_t size);
58
59int mailimap_login_simple(mailimap * session,
60 char * userid, char * password);
61
62#ifdef __cplusplus
63}
64#endif
65
66#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimap_socket.h b/kmicromail/libetpan/include/libetpan/mailimap_socket.h
new file mode 100644
index 0000000..aadc67e
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimap_socket.h
@@ -0,0 +1,54 @@
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 MAILIMAP_SOCKET_H
37
38#define MAILIMAP_SOCKET_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45
46#include <libetpan/mailimap_types.h>
47
48int mailimap_socket_connect(mailimap * f, const char * server, uint16_t port);
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimap_ssl.h b/kmicromail/libetpan/include/libetpan/mailimap_ssl.h
new file mode 100644
index 0000000..76906a0
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimap_ssl.h
@@ -0,0 +1,54 @@
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 MAILIMAP_SSL_H
37
38#define MAILIMAP_SSL_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45
46#include <libetpan/mailimap_types.h>
47
48int mailimap_ssl_connect(mailimap * f, const char * server, uint16_t port);
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimap_types.h b/kmicromail/libetpan/include/libetpan/mailimap_types.h
new file mode 100644
index 0000000..2996b53
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimap_types.h
@@ -0,0 +1,3274 @@
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/*
37 IMAP4rev1 grammar
38
39 address = "(" addr-name SP addr-adl SP addr-mailbox SP
40 addr-host ")"
41
42 addr-adl = nstring
43 ; Holds route from [RFC-822] route-addr if
44 ; non-NIL
45
46 addr-host = nstring
47 ; NIL indicates [RFC-822] group syntax.
48 ; Otherwise, holds [RFC-822] domain name
49
50 addr-mailbox = nstring
51 ; NIL indicates end of [RFC-822] group; if
52 ; non-NIL and addr-host is NIL, holds
53 ; [RFC-822] group name.
54 ; Otherwise, holds [RFC-822] local-part
55 ; after removing [RFC-822] quoting
56
57
58
59 addr-name = nstring
60 ; If non-NIL, holds phrase from [RFC-822]
61 ; mailbox after removing [RFC-822] quoting
62
63 append = "APPEND" SP mailbox [SP flag-list] [SP date-time] SP
64 literal
65
66 astring = 1*ASTRING-CHAR / string
67
68 ASTRING-CHAR = ATOM-CHAR / resp-specials
69
70 atom = 1*ATOM-CHAR
71
72 ATOM-CHAR = <any CHAR except atom-specials>
73
74 atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards /
75 quoted-specials / resp-specials
76
77 authenticate = "AUTHENTICATE" SP auth-type *(CRLF base64)
78
79 auth-type = atom
80 ; Defined by [SASL]
81
82 base64 = *(4base64-char) [base64-terminal]
83
84 base64-char = ALPHA / DIGIT / "+" / "/"
85 ; Case-sensitive
86
87 base64-terminal = (2base64-char "==") / (3base64-char "=")
88
89 body = "(" (body-type-1part / body-type-mpart) ")"
90
91 body-extension = nstring / number /
92 "(" body-extension *(SP body-extension) ")"
93 ; Future expansion. Client implementations
94 ; MUST accept body-extension fields. Server
95 ; implementations MUST NOT generate
96 ; body-extension fields except as defined by
97 ; future standard or standards-track
98 ; revisions of this specification.
99
100 body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang
101 *(SP body-extension)]]
102 ; MUST NOT be returned on non-extensible
103 ; "BODY" fetch
104
105
106 body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang
107 *(SP body-extension)]]
108 ; MUST NOT be returned on non-extensible
109 ; "BODY" fetch
110
111 body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP
112 body-fld-enc SP body-fld-octets
113
114 body-fld-desc = nstring
115
116 body-fld-dsp = "(" string SP body-fld-param ")" / nil
117
118 body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/
119 "QUOTED-PRINTABLE") DQUOTE) / string
120
121 body-fld-id = nstring
122
123 body-fld-lang = nstring / "(" string *(SP string) ")"
124
125 body-fld-lines = number
126
127 body-fld-md5 = nstring
128
129 body-fld-octets = number
130
131 body-fld-param = "(" string SP string *(SP string SP string) ")" / nil
132
133 body-type-1part = (body-type-basic / body-type-msg / body-type-text)
134 [SP body-ext-1part]
135
136 body-type-basic = media-basic SP body-fields
137 ; MESSAGE subtype MUST NOT be "RFC822"
138
139 body-type-mpart = 1*body SP media-subtype
140 [SP body-ext-mpart]
141
142 body-type-msg = media-message SP body-fields SP envelope
143 SP body SP body-fld-lines
144
145 body-type-text = media-text SP body-fields SP body-fld-lines
146
147 capability = ("AUTH=" auth-type) / atom
148 ; New capabilities MUST begin with "X" or be
149 ; registered with IANA as standard or
150 ; standards-track
151
152
153 capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev1"
154 *(SP capability)
155 ; IMAP4rev1 servers which offer RFC 1730
156 ; compatibility MUST list "IMAP4" as the first
157 ; capability.
158
159 CHAR8 = %x01-ff
160 ; any OCTET except NUL, %x00
161
162 command = tag SP (command-any / command-auth / command-nonauth /
163 command-select) CRLF
164 ; Modal based on state
165
166 command-any = "CAPABILITY" / "LOGOUT" / "NOOP" / x-command
167 ; Valid in all states
168
169 command-auth = append / create / delete / examine / list / lsub /
170 rename / select / status / subscribe / unsubscribe
171 ; Valid only in Authenticated or Selected state
172
173 command-nonauth = login / authenticate
174 ; Valid only when in Not Authenticated state
175
176 command-select = "CHECK" / "CLOSE" / "EXPUNGE" / copy / fetch / store /
177 uid / search
178 ; Valid only when in Selected state
179
180 continue-req = "+" SP (resp-text / base64) CRLF
181
182 copy = "COPY" SP set SP mailbox
183
184 create = "CREATE" SP mailbox
185 ; Use of INBOX gives a NO error
186
187 date = date-text / DQUOTE date-text DQUOTE
188
189 date-day = 1*2DIGIT
190 ; Day of month
191
192 date-day-fixed = (SP DIGIT) / 2DIGIT
193 ; Fixed-format version of date-day
194
195 date-month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
196 "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
197
198 date-text = date-day "-" date-month "-" date-year
199
200 date-year = 4DIGIT
201
202 date-time = DQUOTE date-day-fixed "-" date-month "-" date-year
203 SP time SP zone DQUOTE
204
205 delete = "DELETE" SP mailbox
206 ; Use of INBOX gives a NO error
207
208 digit-nz = %x31-39
209 ; 1-9
210
211 envelope = "(" env-date SP env-subject SP env-from SP env-sender SP
212 env-reply-to SP env-to SP env-cc SP env-bcc SP
213 env-in-reply-to SP env-message-id ")"
214
215 env-bcc = "(" 1*address ")" / nil
216
217 env-cc = "(" 1*address ")" / nil
218
219 env-date = nstring
220
221 env-from = "(" 1*address ")" / nil
222
223 env-in-reply-to = nstring
224
225 env-message-id = nstring
226
227 env-reply-to = "(" 1*address ")" / nil
228
229 env-sender = "(" 1*address ")" / nil
230
231 env-subject = nstring
232
233 env-to = "(" 1*address ")" / nil
234
235 examine = "EXAMINE" SP mailbox
236
237 fetch = "FETCH" SP set SP ("ALL" / "FULL" / "FAST" / fetch-att /
238 "(" fetch-att *(SP fetch-att) ")")
239
240 fetch-att = "ENVELOPE" / "FLAGS" / "INTERNALDATE" /
241 "RFC822" [".HEADER" / ".SIZE" / ".TEXT"] /
242 "BODY" ["STRUCTURE"] / "UID" /
243 "BODY" [".PEEK"] section ["<" number "." nz-number ">"]
244
245 flag = "\Answered" / "\Flagged" / "\Deleted" /
246 "\Seen" / "\Draft" / flag-keyword / flag-extension
247 ; Does not include "\Recent"
248
249 flag-extension = "\" atom
250 ; Future expansion. Client implementations
251 ; MUST accept flag-extension flags. Server
252 ; implementations MUST NOT generate
253 ; flag-extension flags except as defined by
254 ; future standard or standards-track
255 ; revisions of this specification.
256
257 flag-fetch = flag / "\Recent"
258
259 flag-keyword = atom
260
261 flag-list = "(" [flag *(SP flag)] ")"
262
263 flag-perm = flag / "\*"
264
265 greeting = "*" SP (resp-cond-auth / resp-cond-bye) CRLF
266
267 header-fld-name = astring
268
269 header-list = "(" header-fld-name *(SP header-fld-name) ")"
270
271 list = "LIST" SP mailbox SP list-mailbox
272
273 list-mailbox = 1*list-char / string
274
275 list-char = ATOM-CHAR / list-wildcards / resp-specials
276
277 list-wildcards = "%" / "*"
278
279 literal = "{" number "}" CRLF *CHAR8
280 ; Number represents the number of CHAR8s
281
282 login = "LOGIN" SP userid SP password
283
284 lsub = "LSUB" SP mailbox SP list-mailbox
285
286 mailbox = "INBOX" / astring
287 ; INBOX is case-insensitive. All case variants of
288 ; INBOX (e.g. "iNbOx") MUST be interpreted as INBOX
289 ; not as an astring. An astring which consists of
290 ; the case-insensitive sequence "I" "N" "B" "O" "X"
291 ; is considered to be INBOX and not an astring.
292 ; Refer to section 5.1 for further
293 ; semantic details of mailbox names.
294
295 mailbox-data = "FLAGS" SP flag-list / "LIST" SP mailbox-list /
296 "LSUB" SP mailbox-list / "SEARCH" *(SP nz-number) /
297 "STATUS" SP mailbox SP "("
298 [status-att SP number *(SP status-att SP number)] ")" /
299 number SP "EXISTS" / number SP "RECENT"
300
301 mailbox-list = "(" [mbx-list-flags] ")" SP
302 (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox
303
304 mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag
305 *(SP mbx-list-oflag) /
306 mbx-list-oflag *(SP mbx-list-oflag)
307
308 mbx-list-oflag = "\Noinferiors" / flag-extension
309 ; Other flags; multiple possible per LIST response
310
311 mbx-list-sflag = "\Noselect" / "\Marked" / "\Unmarked"
312 ; Selectability flags; only one per LIST response
313
314 media-basic = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" / "MESSAGE" /
315 "VIDEO") DQUOTE) / string) SP media-subtype
316 ; Defined in [MIME-IMT]
317
318 media-message = DQUOTE "MESSAGE" DQUOTE SP DQUOTE "RFC822" DQUOTE
319 ; Defined in [MIME-IMT]
320
321 media-subtype = string
322 ; Defined in [MIME-IMT]
323
324 media-text = DQUOTE "TEXT" DQUOTE SP media-subtype
325 ; Defined in [MIME-IMT]
326
327 message-data = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att))
328
329 msg-att = "(" (msg-att-dynamic / msg-att-static)
330 *(SP (msg-att-dynamic / msg-att-static)) ")"
331
332 msg-att-dynamic = "FLAGS" SP "(" [flag-fetch *(SP flag-fetch)] ")"
333 ; MAY change for a message
334
335 msg-att-static = "ENVELOPE" SP envelope / "INTERNALDATE" SP date-time /
336 "RFC822" [".HEADER" / ".TEXT"] SP nstring /
337 "RFC822.SIZE" SP number / "BODY" ["STRUCTURE"] SP body /
338 "BODY" section ["<" number ">"] SP nstring /
339 "UID" SP uniqueid
340 ; MUST NOT change for a message
341
342 nil = "NIL"
343
344 nstring = string / nil
345
346 number = 1*DIGIT
347 ; Unsigned 32-bit integer
348 ; (0 <= n < 4,294,967,296)
349
350 nz-number = digit-nz *DIGIT
351 ; Non-zero unsigned 32-bit integer
352 ; (0 < n < 4,294,967,296)
353
354 password = astring
355
356 quoted = DQUOTE *QUOTED-CHAR DQUOTE
357
358 QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> /
359 "\" quoted-specials
360
361 quoted-specials = DQUOTE / "\"
362
363 rename = "RENAME" SP mailbox SP mailbox
364 ; Use of INBOX as a destination gives a NO error
365
366 response = *(continue-req / response-data) response-done
367
368 response-data = "*" SP (resp-cond-state / resp-cond-bye /
369 mailbox-data / message-data / capability-data) CRLF
370
371 response-done = response-tagged / response-fatal
372
373 response-fatal = "*" SP resp-cond-bye CRLF
374 ; Server closes connection immediately
375
376 response-tagged = tag SP resp-cond-state CRLF
377
378 resp-cond-auth = ("OK" / "PREAUTH") SP resp-text
379 ; Authentication condition
380
381 resp-cond-bye = "BYE" SP resp-text
382
383 resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text
384 ; Status condition
385
386 resp-specials = "]"
387
388 resp-text = ["[" resp-text-code "]" SP] text
389
390 resp-text-code = "ALERT" /
391 "BADCHARSET" [SP "(" astring *(SP astring) ")" ] /
392 capability-data / "PARSE" /
393 "PERMANENTFLAGS" SP "(" [flag-perm *(SP flag-perm)] ")" /
394 "READ-ONLY" / "READ-WRITE" / "TRYCREATE" /
395 "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number /
396 "UNSEEN" SP nz-number /
397 atom [SP 1*<any TEXT-CHAR except "]">]
398
399 search = "SEARCH" [SP "CHARSET" SP astring] 1*(SP search-key)
400 ; CHARSET argument to MUST be registered with IANA
401
402 search-key = "ALL" / "ANSWERED" / "BCC" SP astring /
403 "BEFORE" SP date / "BODY" SP astring /
404 "CC" SP astring / "DELETED" / "FLAGGED" /
405 "FROM" SP astring / "KEYWORD" SP flag-keyword / "NEW" /
406 "OLD" / "ON" SP date / "RECENT" / "SEEN" /
407 "SINCE" SP date / "SUBJECT" SP astring /
408 "TEXT" SP astring / "TO" SP astring /
409 "UNANSWERED" / "UNDELETED" / "UNFLAGGED" /
410 "UNKEYWORD" SP flag-keyword / "UNSEEN" /
411 ; Above this line were in [IMAP2]
412 "DRAFT" / "HEADER" SP header-fld-name SP astring /
413 "LARGER" SP number / "NOT" SP search-key /
414 "OR" SP search-key SP search-key /
415 "SENTBEFORE" SP date / "SENTON" SP date /
416 "SENTSINCE" SP date / "SMALLER" SP number /
417 "UID" SP set / "UNDRAFT" / set /
418 "(" search-key *(SP search-key) ")"
419
420 section = "[" [section-spec] "]"
421
422 section-msgtext = "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list /
423 "TEXT"
424 ; top-level or MESSAGE/RFC822 part
425
426 section-part = nz-number *("." nz-number)
427 ; body part nesting
428
429 section-spec = section-msgtext / (section-part ["." section-text])
430
431 section-text = section-msgtext / "MIME"
432 ; text other than actual body part (headers, etc.)
433
434 select = "SELECT" SP mailbox
435
436 sequence-num = nz-number / "*"
437 ; * is the largest number in use. For message
438 ; sequence numbers, it is the number of messages
439 ; in the mailbox. For unique identifiers, it is
440 ; the unique identifier of the last message in
441 ; the mailbox.
442
443 set = sequence-num / (sequence-num ":" sequence-num) /
444 (set "," set)
445 ; Identifies a set of messages. For message
446 ; sequence numbers, these are consecutive
447 ; numbers from 1 to the number of messages in
448 ; the mailbox
449 ; Comma delimits individual numbers, colon
450 ; delimits between two numbers inclusive.
451 ; Example: 2,4:7,9,12:* is 2,4,5,6,7,9,12,13,
452 ; 14,15 for a mailbox with 15 messages.
453
454
455 status = "STATUS" SP mailbox SP "(" status-att *(SP status-att) ")"
456
457 status-att = "MESSAGES" / "RECENT" / "UIDNEXT" / "UIDVALIDITY" /
458 "UNSEEN"
459
460 store = "STORE" SP set SP store-att-flags
461
462 store-att-flags = (["+" / "-"] "FLAGS" [".SILENT"]) SP
463 (flag-list / (flag *(SP flag)))
464
465 string = quoted / literal
466
467 subscribe = "SUBSCRIBE" SP mailbox
468
469 tag = 1*<any ASTRING-CHAR except "+">
470
471 text = 1*TEXT-CHAR
472
473 TEXT-CHAR = <any CHAR except CR and LF>
474
475 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
476 ; Hours minutes seconds
477
478 uid = "UID" SP (copy / fetch / search / store)
479 ; Unique identifiers used instead of message
480 ; sequence numbers
481
482 uniqueid = nz-number
483 ; Strictly ascending
484
485 unsubscribe = "UNSUBSCRIBE" SP mailbox
486
487 userid = astring
488
489 x-command = "X" atom <experimental command arguments>
490
491 zone = ("+" / "-") 4DIGIT
492 ; Signed four-digit value of hhmm representing
493 ; hours and minutes east of Greenwich (that is,
494 ; the amount that the given time differs from
495 ; Universal Time). Subtracting the timezone
496 ; from the given time will give the UT form.
497 ; The Universal Time zone is "+0000".
498*/
499
500
501#ifndef MAILIMAP_TYPES_H
502
503#define MAILIMAP_TYPES_H
504
505#ifdef __cplusplus
506extern "C" {
507#endif
508
509#include <inttypes.h>
510#include <libetpan/mailstream.h>
511#include <libetpan/clist.h>
512
513
514/*
515 IMPORTANT NOTE:
516
517 All allocation functions will take as argument allocated data
518 and will store these data in the structure they will allocate.
519 Data should be persistant during all the use of the structure
520 and will be freed by the free function of the structure
521
522 allocation functions will return NULL on failure
523*/
524
525
526/*
527 mailimap_address represents a mail address
528
529 - personal_name is the name to display in an address
530 '"name"' in '"name" <address@domain>', should be allocated
531 with a malloc()
532
533 - source_route is the source-route information in the
534 mail address (RFC 822), should be allocated with a malloc()
535
536 - mailbox_name is the name of the mailbox 'address' in
537 '"name" <address@domain>', should be allocated with a malloc()
538
539 - host_name is the name of the host 'domain' in
540 '"name" <address@domain>', should be allocated with a malloc()
541
542 if mailbox_name is not NULL and host_name is NULL, this is the name
543 of a group, the next addresses in the list are elements of the group
544 until we reach an address with a NULL mailbox_name.
545*/
546
547struct mailimap_address {
548 char * ad_personal_name; /* can be NULL */
549 char * ad_source_route; /* can be NULL */
550 char * ad_mailbox_name; /* can be NULL */
551 char * ad_host_name; /* can be NULL */
552};
553
554
555struct mailimap_address *
556mailimap_address_new(char * ad_personal_name, char * ad_source_route,
557 char * ad_mailbox_name, char * ad_host_name);
558
559void mailimap_address_free(struct mailimap_address * addr);
560
561
562/* this is the type of MIME body parsed by IMAP server */
563
564enum {
565 MAILIMAP_BODY_ERROR,
566 MAILIMAP_BODY_1PART, /* single part */
567 MAILIMAP_BODY_MPART, /* multi-part */
568};
569
570/*
571 mailimap_body represent a MIME body parsed by IMAP server
572
573 - type is the type of the MIME part (single part or multipart)
574
575 - body_1part is defined if this is a single part
576
577 - body_mpart is defined if this is a multipart
578*/
579
580struct mailimap_body {
581 int bd_type;
582 /* can be MAILIMAP_BODY_1PART or MAILIMAP_BODY_MPART */
583 union {
584 struct mailimap_body_type_1part * bd_body_1part; /* can be NULL */
585 struct mailimap_body_type_mpart * bd_body_mpart; /* can be NULL */
586 } bd_data;
587};
588
589
590struct mailimap_body *
591mailimap_body_new(int bd_type,
592 struct mailimap_body_type_1part * bd_body_1part,
593 struct mailimap_body_type_mpart * bd_body_mpart);
594
595void mailimap_body_free(struct mailimap_body * body);
596
597
598
599/*
600 this is the type of MIME body extension
601*/
602
603enum {
604 MAILIMAP_BODY_EXTENSION_ERROR,
605 MAILIMAP_BODY_EXTENSION_NSTRING, /* string */
606 MAILIMAP_BODY_EXTENSION_NUMBER, /* number */
607 MAILIMAP_BODY_EXTENSION_LIST, /* list of
608 (struct mailimap_body_extension *) */
609};
610
611/*
612 mailimap_body_extension is a future extension header field value
613
614 - type is the type of the body extension (string, number or
615 list of extension)
616
617 - nstring is a string value if the type is string
618
619 - number is a integer value if the type is number
620
621 - list is a list of body extension if the type is a list
622*/
623
624struct mailimap_body_extension {
625 int ext_type;
626 /*
627 can be MAILIMAP_BODY_EXTENSION_NSTRING, MAILIMAP_BODY_EXTENSION_NUMBER
628 or MAILIMAP_BODY_EXTENSION_LIST
629 */
630 union {
631 char * ext_nstring; /* can be NULL */
632 uint32_t ext_number;
633 clist * ext_body_extension_list;
634 /* list of (struct mailimap_body_extension *) */
635 /* can be NULL */
636 } ext_data;
637};
638
639struct mailimap_body_extension *
640mailimap_body_extension_new(int ext_type, char * ext_nstring,
641 uint32_t ext_number,
642 clist * ext_body_extension_list);
643
644void mailimap_body_extension_free(struct mailimap_body_extension * be);
645
646
647/*
648 mailimap_body_ext_1part is the extended result part of a single part
649 bodystructure.
650
651 - body_md5 is the value of the Content-MD5 header field, should be
652 allocated with malloc()
653
654 - body_disposition is the value of the Content-Disposition header field
655
656 - body_language is the value of the Content-Language header field
657
658 - body_extension_list is the list of extension fields value.
659*/
660
661struct mailimap_body_ext_1part {
662 char * bd_md5; /* != NULL */
663 struct mailimap_body_fld_dsp * bd_disposition; /* can be NULL */
664 struct mailimap_body_fld_lang * bd_language; /* can be NULL */
665
666 clist * bd_extension_list; /* list of (struct mailimap_body_extension *) */
667 /* can be NULL */
668};
669
670struct mailimap_body_ext_1part *
671mailimap_body_ext_1part_new(char * bd_md5,
672 struct mailimap_body_fld_dsp * bd_disposition,
673 struct mailimap_body_fld_lang * bd_language,
674 clist * bd_extension_list);
675
676
677void
678mailimap_body_ext_1part_free(struct mailimap_body_ext_1part * body_ext_1part);
679
680
681/*
682 mailimap_body_ext_mpart is the extended result part of a multipart
683 bodystructure.
684
685 - body_parameter is the list of parameters of Content-Type header field
686
687 - body_disposition is the value of Content-Disposition header field
688
689 - body_language is the value of Content-Language header field
690
691 - body_extension_list is the list of extension fields value.
692*/
693
694struct mailimap_body_ext_mpart {
695 struct mailimap_body_fld_param * bd_parameter; /* != NULL */
696 struct mailimap_body_fld_dsp * bd_disposition; /* can be NULL */
697 struct mailimap_body_fld_lang * bd_language; /* can be NULL */
698 clist * bd_extension_list; /* list of (struct mailimap_body_extension *) */
699 /* can be NULL */
700};
701
702struct mailimap_body_ext_mpart *
703mailimap_body_ext_mpart_new(struct mailimap_body_fld_param * bd_parameter,
704 struct mailimap_body_fld_dsp * bd_disposition,
705 struct mailimap_body_fld_lang * bd_language,
706 clist * bd_extension_list);
707
708void
709mailimap_body_ext_mpart_free(struct mailimap_body_ext_mpart * body_ext_mpart);
710
711
712/*
713 mailimap_body_fields is the MIME fields of a MIME part.
714
715 - body_parameter is the list of parameters of Content-Type header field
716
717 - body_id is the value of Content-ID header field, should be allocated
718 with malloc()
719
720 - body_description is the value of Content-Description header field,
721 should be allocated with malloc()
722
723 - body_encoding is the value of Content-Transfer-Encoding header field
724
725 - body_disposition is the value of Content-Disposition header field
726
727 - body_size is the size of the MIME part
728*/
729
730struct mailimap_body_fields {
731 struct mailimap_body_fld_param * bd_parameter; /* != NULL */
732 char * bd_id; /* can be NULL */
733 char * bd_description; /* can be NULL */
734 struct mailimap_body_fld_enc * bd_encoding; /* != NULL */
735 uint32_t bd_size;
736};
737
738struct mailimap_body_fields *
739mailimap_body_fields_new(struct mailimap_body_fld_param * bd_parameter,
740 char * bd_id,
741 char * bd_description,
742 struct mailimap_body_fld_enc * bd_encoding,
743 uint32_t bd_size);
744
745void
746mailimap_body_fields_free(struct mailimap_body_fields * body_fields);
747
748
749
750/*
751 mailimap_body_fld_dsp is the parsed value of the Content-Disposition field
752
753 - disposition_type is the type of Content-Disposition
754 (usually attachment or inline), should be allocated with malloc()
755
756 - attributes is the list of Content-Disposition attributes
757*/
758
759struct mailimap_body_fld_dsp {
760 char * dsp_type; /* != NULL */
761 struct mailimap_body_fld_param * dsp_attributes; /* != NULL */
762};
763
764struct mailimap_body_fld_dsp *
765mailimap_body_fld_dsp_new(char * dsp_type,
766 struct mailimap_body_fld_param * dsp_attributes);
767
768void mailimap_body_fld_dsp_free(struct mailimap_body_fld_dsp * bfd);
769
770
771
772/* these are the different parsed values for Content-Transfer-Encoding */
773
774enum {
775 MAILIMAP_BODY_FLD_ENC_7BIT, /* 7bit */
776 MAILIMAP_BODY_FLD_ENC_8BIT, /* 8bit */
777 MAILIMAP_BODY_FLD_ENC_BINARY, /* binary */
778 MAILIMAP_BODY_FLD_ENC_BASE64, /* base64 */
779 MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE, /* quoted-printable */
780 MAILIMAP_BODY_FLD_ENC_OTHER, /* other */
781};
782
783/*
784 mailimap_body_fld_enc is a parsed value for Content-Transfer-Encoding
785
786 - type is the kind of Content-Transfer-Encoding, this can be
787 MAILIMAP_BODY_FLD_ENC_7BIT, MAILIMAP_BODY_FLD_ENC_8BIT,
788 MAILIMAP_BODY_FLD_ENC_BINARY, MAILIMAP_BODY_FLD_ENC_BASE64,
789 MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE or MAILIMAP_BODY_FLD_ENC_OTHER
790
791 - in case of MAILIMAP_BODY_FLD_ENC_OTHER, this value is defined,
792 should be allocated with malloc()
793*/
794
795struct mailimap_body_fld_enc {
796 int enc_type;
797 char * enc_value; /* can be NULL */
798};
799
800struct mailimap_body_fld_enc *
801mailimap_body_fld_enc_new(int enc_type, char * enc_value);
802
803void mailimap_body_fld_enc_free(struct mailimap_body_fld_enc * bfe);
804
805
806/* this is the type of Content-Language header field value */
807
808enum {
809 MAILIMAP_BODY_FLD_LANG_ERROR, /* error parse */
810 MAILIMAP_BODY_FLD_LANG_SINGLE, /* single value */
811 MAILIMAP_BODY_FLD_LANG_LIST /* list of values */
812};
813
814/*
815 mailimap_body_fld_lang is the parsed value of the Content-Language field
816
817 - type is the type of content, this can be MAILIMAP_BODY_FLD_LANG_SINGLE
818 if this is a single value or MAILIMAP_BODY_FLD_LANG_LIST if there are
819 several values
820
821 - single is the single value if the type is MAILIMAP_BODY_FLD_LANG_SINGLE,
822 should be allocated with malloc()
823
824 - list is the list of value if the type is MAILIMAP_BODY_FLD_LANG_LIST,
825 all elements of the list should be allocated with malloc()
826*/
827
828struct mailimap_body_fld_lang {
829 int lg_type;
830 union {
831 char * lg_single; /* can be NULL */
832 clist * lg_list; /* list of string (char *), can be NULL */
833 } lg_data;
834};
835
836struct mailimap_body_fld_lang *
837mailimap_body_fld_lang_new(int lg_type, char * lg_single, clist * lg_list);
838
839void
840mailimap_body_fld_lang_free(struct mailimap_body_fld_lang * fld_lang);
841
842
843
844/*
845 mailimap_single_body_fld_param is a body field parameter
846
847 - name is the name of the parameter, should be allocated with malloc()
848
849 - value is the value of the parameter, should be allocated with malloc()
850*/
851
852struct mailimap_single_body_fld_param {
853 char * pa_name; /* != NULL */
854 char * pa_value; /* != NULL */
855};
856
857struct mailimap_single_body_fld_param *
858mailimap_single_body_fld_param_new(char * pa_name, char * pa_value);
859
860void
861mailimap_single_body_fld_param_free(struct mailimap_single_body_fld_param * p);
862
863
864/*
865 mailmap_body_fld_param is a list of parameters
866
867 - list is the list of parameters.
868*/
869
870struct mailimap_body_fld_param {
871 clist * pa_list; /* list of (struct mailimap_single_body_fld_param *) */
872 /* != NULL */
873};
874
875struct mailimap_body_fld_param *
876mailimap_body_fld_param_new(clist * pa_list);
877
878void
879mailimap_body_fld_param_free(struct mailimap_body_fld_param * fld_param);
880
881
882/*
883 this is the kind of single part: a text part
884 (when Content-Type is text/xxx), a message part (when Content-Type is
885 message/rfc2822) or a basic part (others than multpart/xxx)
886*/
887
888enum {
889 MAILIMAP_BODY_TYPE_1PART_ERROR, /* parse error */
890 MAILIMAP_BODY_TYPE_1PART_BASIC, /* others then multipart/xxx */
891 MAILIMAP_BODY_TYPE_1PART_MSG, /* message/rfc2822 */
892 MAILIMAP_BODY_TYPE_1PART_TEXT /* text/xxx */
893};
894
895
896/*
897 mailimap_body_type_1part is
898
899 - type is the kind of single part, this can be
900 MAILIMAP_BODY_TYPE_1PART_BASIC, MAILIMAP_BODY_TYPE_1PART_MSG or
901 MAILIMAP_BODY_TYPE_1PART_TEXT.
902
903 - body_type_basic is the basic part when type is
904 MAILIMAP_BODY_TYPE_1PART_BASIC
905
906 - body_type_msg is the message part when type is
907 MAILIMAP_BODY_TYPE_1PART_MSG
908
909 - body_type_text is the text part when type is
910 MAILIMAP_BODY_TYPE_1PART_TEXT
911*/
912
913struct mailimap_body_type_1part {
914 int bd_type;
915 union {
916 struct mailimap_body_type_basic * bd_type_basic; /* can be NULL */
917 struct mailimap_body_type_msg * bd_type_msg; /* can be NULL */
918 struct mailimap_body_type_text * bd_type_text; /* can be NULL */
919 } bd_data;
920 struct mailimap_body_ext_1part * bd_ext_1part; /* can be NULL */
921};
922
923struct mailimap_body_type_1part *
924mailimap_body_type_1part_new(int bd_type,
925 struct mailimap_body_type_basic * bd_type_basic,
926 struct mailimap_body_type_msg * bd_type_msg,
927 struct mailimap_body_type_text * bd_type_text,
928 struct mailimap_body_ext_1part * bd_ext_1part);
929
930void
931mailimap_body_type_1part_free(struct mailimap_body_type_1part * bt1p);
932
933
934
935/*
936 mailimap_body_type_basic is a basic field (with Content-Type other
937 than multipart/xxx, message/rfc2822 and text/xxx
938
939 - media_basic will be the MIME type of the part
940
941 - body_fields will be the parsed fields of the MIME part
942*/
943
944struct mailimap_body_type_basic {
945 struct mailimap_media_basic * bd_media_basic; /* != NULL */
946 struct mailimap_body_fields * bd_fields; /* != NULL */
947};
948
949struct mailimap_body_type_basic *
950mailimap_body_type_basic_new(struct mailimap_media_basic * bd_media_basic,
951 struct mailimap_body_fields * bd_fields);
952
953void mailimap_body_type_basic_free(struct mailimap_body_type_basic *
954 body_type_basic);
955
956/*
957 mailimap_body_type_mpart is a MIME multipart.
958
959 - body_list is the list of sub-parts.
960
961 - media_subtype is the subtype of the multipart (for example
962 in multipart/alternative, this is "alternative")
963
964 - body_ext_mpart is the extended fields of the MIME multipart
965*/
966
967struct mailimap_body_type_mpart {
968 clist * bd_list; /* list of (struct mailimap_body *) */
969 /* != NULL */
970 char * bd_media_subtype; /* != NULL */
971 struct mailimap_body_ext_mpart * bd_ext_mpart; /* can be NULL */
972};
973
974struct mailimap_body_type_mpart *
975mailimap_body_type_mpart_new(clist * bd_list, char * bd_media_subtype,
976 struct mailimap_body_ext_mpart * bd_ext_mpart);
977
978void mailimap_body_type_mpart_free(struct mailimap_body_type_mpart *
979 body_type_mpart);
980
981/*
982 mailimap_body_type_msg is a MIME message part
983
984 - body_fields is the MIME fields of the MIME message part
985
986 - envelope is the list of parsed RFC 822 fields of the MIME message
987
988 - body is the sub-part of the message
989
990 - body_lines is the number of lines of the message part
991*/
992
993struct mailimap_body_type_msg {
994 struct mailimap_body_fields * bd_fields; /* != NULL */
995 struct mailimap_envelope * bd_envelope; /* != NULL */
996 struct mailimap_body * bd_body; /* != NULL */
997 uint32_t bd_lines;
998};
999
1000struct mailimap_body_type_msg *
1001mailimap_body_type_msg_new(struct mailimap_body_fields * bd_fields,
1002 struct mailimap_envelope * bd_envelope,
1003 struct mailimap_body * bd_body,
1004 uint32_t bd_lines);
1005
1006void
1007mailimap_body_type_msg_free(struct mailimap_body_type_msg * body_type_msg);
1008
1009
1010
1011/*
1012 mailimap_body_type_text is a single MIME part where Content-Type is text/xxx
1013
1014 - media-text is the subtype of the text part (for example, in "text/plain",
1015 this is "plain", should be allocated with malloc()
1016
1017 - body_fields is the MIME fields of the MIME message part
1018
1019 - body_lines is the number of lines of the message part
1020*/
1021
1022struct mailimap_body_type_text {
1023 char * bd_media_text; /* != NULL */
1024 struct mailimap_body_fields * bd_fields; /* != NULL */
1025 uint32_t bd_lines;
1026};
1027
1028struct mailimap_body_type_text *
1029mailimap_body_type_text_new(char * bd_media_text,
1030 struct mailimap_body_fields * bd_fields,
1031 uint32_t bd_lines);
1032
1033void
1034mailimap_body_type_text_free(struct mailimap_body_type_text * body_type_text);
1035
1036
1037
1038/* this is the type of capability field */
1039
1040enum {
1041 MAILIMAP_CAPABILITY_AUTH_TYPE, /* when the capability is an
1042 authentication type */
1043 MAILIMAP_CAPABILITY_NAME, /* other type of capability */
1044};
1045
1046/*
1047 mailimap_capability is a capability of the IMAP server
1048
1049 - type is the type of capability, this is either a authentication type
1050 (MAILIMAP_CAPABILITY_AUTH_TYPE) or an other type of capability
1051 (MAILIMAP_CAPABILITY_NAME)
1052
1053 - auth_type is a type of authentication "name" in "AUTH=name",
1054 auth_type can be for example "PLAIN", when this is an authentication type,
1055 should be allocated with malloc()
1056
1057 - name is a type of capability when this is not an authentication type,
1058 should be allocated with malloc()
1059*/
1060
1061struct mailimap_capability {
1062 int cap_type;
1063 union {
1064 char * cap_auth_type; /* can be NULL */
1065 char * cap_name; /* can be NULL */
1066 } cap_data;
1067};
1068
1069struct mailimap_capability *
1070mailimap_capability_new(int cap_type, char * cap_auth_type, char * cap_name);
1071
1072void mailimap_capability_free(struct mailimap_capability * c);
1073
1074
1075
1076
1077/*
1078 mailimap_capability_data is a list of capability
1079
1080 - list is the list of capability
1081*/
1082
1083struct mailimap_capability_data {
1084 clist * cap_list; /* list of (struct mailimap_capability *), != NULL */
1085};
1086
1087struct mailimap_capability_data *
1088mailimap_capability_data_new(clist * cap_list);
1089
1090void
1091mailimap_capability_data_free(struct mailimap_capability_data * cap_data);
1092
1093
1094
1095/* this is the type of continue request data */
1096
1097enum {
1098 MAILIMAP_CONTINUE_REQ_ERROR, /* on parse error */
1099 MAILIMAP_CONTINUE_REQ_TEXT, /* when data is a text response */
1100 MAILIMAP_CONTINUE_REQ_BASE64, /* when data is a base64 response */
1101};
1102
1103/*
1104 mailimap_continue_req is a continue request (a response prefixed by "+")
1105
1106 - type is the type of continue request response
1107 MAILIMAP_CONTINUE_REQ_TEXT (when information data is text),
1108 MAILIMAP_CONTINUE_REQ_BASE64 (when information data is base64)
1109
1110 - text is the information of type text in case of text data
1111
1112 - base64 is base64 encoded data in the other case, should be allocated
1113 with malloc()
1114*/
1115
1116struct mailimap_continue_req {
1117 int cr_type;
1118 union {
1119 struct mailimap_resp_text * cr_text; /* can be NULL */
1120 char * cr_base64; /* can be NULL */
1121 } cr_data;
1122};
1123
1124struct mailimap_continue_req *
1125mailimap_continue_req_new(int cr_type, struct mailimap_resp_text * cr_text,
1126 char * cr_base64);
1127
1128void mailimap_continue_req_free(struct mailimap_continue_req * cont_req);
1129
1130
1131/*
1132 mailimap_date_time is a date
1133
1134 - day is the day of month (1 to 31)
1135
1136 - month (1 to 12)
1137
1138 - year (4 digits)
1139
1140 - hour (0 to 23)
1141
1142 - min (0 to 59)
1143
1144 - sec (0 to 59)
1145
1146 - zone (this is the decimal value that we can read, for example:
1147 for "-0200", the value is -200)
1148*/
1149
1150struct mailimap_date_time {
1151 int dt_day;
1152 int dt_month;
1153 int dt_year;
1154 int dt_hour;
1155 int dt_min;
1156 int dt_sec;
1157 int dt_zone;
1158};
1159
1160struct mailimap_date_time *
1161mailimap_date_time_new(int dt_day, int dt_month, int dt_year, int dt_hour,
1162 int dt_min, int dt_sec, int dt_zone);
1163
1164void mailimap_date_time_free(struct mailimap_date_time * date_time);
1165
1166
1167
1168/*
1169 mailimap_envelope is the list of fields that can be parsed by
1170 the IMAP server.
1171
1172 - date is the (non-parsed) content of the "Date" header field,
1173 should be allocated with malloc()
1174
1175 - subject is the subject of the message, should be allocated with
1176 malloc()
1177
1178 - sender is the the parsed content of the "Sender" field
1179
1180 - reply-to is the parsed content of the "Reply-To" field
1181
1182 - to is the parsed content of the "To" field
1183
1184 - cc is the parsed content of the "Cc" field
1185
1186 - bcc is the parsed content of the "Bcc" field
1187
1188 - in_reply_to is the content of the "In-Reply-To" field,
1189 should be allocated with malloc()
1190
1191 - message_id is the content of the "Message-ID" field,
1192 should be allocated with malloc()
1193*/
1194
1195struct mailimap_envelope {
1196 char * env_date; /* can be NULL */
1197 char * env_subject; /* can be NULL */
1198 struct mailimap_env_from * env_from; /* can be NULL */
1199 struct mailimap_env_sender * env_sender; /* can be NULL */
1200 struct mailimap_env_reply_to * env_reply_to; /* can be NULL */
1201 struct mailimap_env_to * env_to; /* can be NULL */
1202 struct mailimap_env_cc * env_cc; /* can be NULL */
1203 struct mailimap_env_bcc * env_bcc; /* can be NULL */
1204 char * env_in_reply_to; /* can be NULL */
1205 char * env_message_id; /* can be NULL */
1206};
1207
1208struct mailimap_envelope *
1209mailimap_envelope_new(char * env_date, char * env_subject,
1210 struct mailimap_env_from * env_from,
1211 struct mailimap_env_sender * env_sender,
1212 struct mailimap_env_reply_to * env_reply_to,
1213 struct mailimap_env_to * env_to,
1214 struct mailimap_env_cc* env_cc,
1215 struct mailimap_env_bcc * env_bcc,
1216 char * env_in_reply_to, char * env_message_id);
1217
1218void mailimap_envelope_free(struct mailimap_envelope * env);
1219
1220
1221
1222/*
1223 mailimap_env_bcc is the parsed "Bcc" field
1224
1225 - list is the list of addresses
1226*/
1227
1228struct mailimap_env_bcc {
1229 clist * bcc_list; /* list of (struct mailimap_address *), != NULL */
1230};
1231
1232struct mailimap_env_bcc * mailimap_env_bcc_new(clist * bcc_list);
1233
1234void mailimap_env_bcc_free(struct mailimap_env_bcc * env_bcc);
1235
1236
1237/*
1238 mailimap_env_cc is the parsed "Cc" field
1239
1240 - list is the list of addresses
1241*/
1242
1243struct mailimap_env_cc {
1244 clist * cc_list; /* list of (struct mailimap_address *), != NULL */
1245};
1246
1247struct mailimap_env_cc * mailimap_env_cc_new(clist * cc_list);
1248
1249void mailimap_env_cc_free(struct mailimap_env_cc * env_cc);
1250
1251
1252
1253/*
1254 mailimap_env_from is the parsed "From" field
1255
1256 - list is the list of addresses
1257*/
1258
1259struct mailimap_env_from {
1260 clist * frm_list; /* list of (struct mailimap_address *) */
1261 /* != NULL */
1262};
1263
1264struct mailimap_env_from * mailimap_env_from_new(clist * frm_list);
1265
1266void mailimap_env_from_free(struct mailimap_env_from * env_from);
1267
1268
1269
1270/*
1271 mailimap_env_reply_to is the parsed "Reply-To" field
1272
1273 - list is the list of addresses
1274*/
1275
1276struct mailimap_env_reply_to {
1277 clist * rt_list; /* list of (struct mailimap_address *), != NULL */
1278};
1279
1280struct mailimap_env_reply_to * mailimap_env_reply_to_new(clist * rt_list);
1281
1282void
1283mailimap_env_reply_to_free(struct mailimap_env_reply_to * env_reply_to);
1284
1285
1286
1287/*
1288 mailimap_env_sender is the parsed "Sender" field
1289
1290 - list is the list of addresses
1291*/
1292
1293struct mailimap_env_sender {
1294 clist * snd_list; /* list of (struct mailimap_address *), != NULL */
1295};
1296
1297struct mailimap_env_sender * mailimap_env_sender_new(clist * snd_list);
1298
1299void mailimap_env_sender_free(struct mailimap_env_sender * env_sender);
1300
1301
1302
1303/*
1304 mailimap_env_to is the parsed "To" field
1305
1306 - list is the list of addresses
1307*/
1308
1309struct mailimap_env_to {
1310 clist * to_list; /* list of (struct mailimap_address *), != NULL */
1311};
1312
1313struct mailimap_env_to * mailimap_env_to_new(clist * to_list);
1314
1315void mailimap_env_to_free(struct mailimap_env_to * env_to);
1316
1317
1318/* this is the type of flag */
1319
1320enum {
1321 MAILIMAP_FLAG_ANSWERED, /* \Answered flag */
1322 MAILIMAP_FLAG_FLAGGED, /* \Flagged flag */
1323 MAILIMAP_FLAG_DELETED, /* \Deleted flag */
1324 MAILIMAP_FLAG_SEEN, /* \Seen flag */
1325 MAILIMAP_FLAG_DRAFT, /* \Draft flag */
1326 MAILIMAP_FLAG_KEYWORD, /* keyword flag */
1327 MAILIMAP_FLAG_EXTENSION, /* \extension flag */
1328};
1329
1330
1331/*
1332 mailimap_flag is a message flag (that we can associate with a message)
1333
1334 - type is the type of the flag, MAILIMAP_FLAG_XXX
1335
1336 - keyword is the flag when the flag is of keyword type,
1337 should be allocated with malloc()
1338
1339 - extension is the flag when the flag is of extension type, should be
1340 allocated with malloc()
1341*/
1342
1343struct mailimap_flag {
1344 int fl_type;
1345 union {
1346 char * fl_keyword; /* can be NULL */
1347 char * fl_extension; /* can be NULL */
1348 } fl_data;
1349};
1350
1351struct mailimap_flag * mailimap_flag_new(int fl_type,
1352 char * fl_keyword, char * fl_extension);
1353
1354void mailimap_flag_free(struct mailimap_flag * f);
1355
1356
1357
1358
1359/* this is the type of flag */
1360
1361enum {
1362 MAILIMAP_FLAG_FETCH_ERROR, /* on parse error */
1363 MAILIMAP_FLAG_FETCH_RECENT, /* \Recent flag */
1364 MAILIMAP_FLAG_FETCH_OTHER, /* other type of flag */
1365};
1366
1367/*
1368 mailimap_flag_fetch is a message flag (when we fetch it)
1369
1370 - type is the type of flag fetch
1371
1372 - flag is the flag when this is not a \Recent flag
1373*/
1374
1375struct mailimap_flag_fetch {
1376 int fl_type;
1377 struct mailimap_flag * fl_flag; /* can be NULL */
1378};
1379
1380struct mailimap_flag_fetch *
1381mailimap_flag_fetch_new(int fl_type, struct mailimap_flag * fl_flag);
1382
1383void mailimap_flag_fetch_free(struct mailimap_flag_fetch * flag_fetch);
1384
1385
1386
1387
1388/* this is the type of flag */
1389
1390enum {
1391 MAILIMAP_FLAG_PERM_ERROR, /* on parse error */
1392 MAILIMAP_FLAG_PERM_FLAG, /* to specify that usual flags can be changed */
1393 MAILIMAP_FLAG_PERM_ALL /* to specify that new flags can be created */
1394};
1395
1396
1397/*
1398 mailimap_flag_perm is a flag returned in case of PERMANENTFLAGS response
1399
1400 - type is the type of returned PERMANENTFLAGS, it can be
1401 MAILIMAP_FLAG_PERM_FLAG (the given flag can be changed permanently) or
1402 MAILIMAP_FLAG_PERM_ALL (new flags can be created)
1403
1404 - flag is the given flag when type is MAILIMAP_FLAG_PERM_FLAG
1405*/
1406
1407struct mailimap_flag_perm {
1408 int fl_type;
1409 struct mailimap_flag * fl_flag; /* can be NULL */
1410};
1411
1412struct mailimap_flag_perm *
1413mailimap_flag_perm_new(int fl_type, struct mailimap_flag * fl_flag);
1414
1415void mailimap_flag_perm_free(struct mailimap_flag_perm * flag_perm);
1416
1417
1418/*
1419 mailimap_flag_list is a list of flags
1420
1421 - list is a list of flags
1422*/
1423
1424struct mailimap_flag_list {
1425 clist * fl_list; /* list of (struct mailimap_flag *), != NULL */
1426};
1427
1428struct mailimap_flag_list *
1429mailimap_flag_list_new(clist * fl_list);
1430
1431void mailimap_flag_list_free(struct mailimap_flag_list * flag_list);
1432
1433
1434
1435
1436/* this is the type of greeting response */
1437
1438enum {
1439 MAILIMAP_GREETING_RESP_COND_ERROR, /* on parse error */
1440 MAILIMAP_GREETING_RESP_COND_AUTH, /* when connection is accepted */
1441 MAILIMAP_GREETING_RESP_COND_BYE, /* when connection is refused */
1442};
1443
1444/*
1445 mailimap_greeting is the response returned on connection
1446
1447 - type is the type of response on connection, either
1448 MAILIMAP_GREETING_RESP_COND_AUTH if connection is accepted or
1449 MAIMIMAP_GREETING_RESP_COND_BYE if connection is refused
1450*/
1451
1452struct mailimap_greeting {
1453 int gr_type;
1454 union {
1455 struct mailimap_resp_cond_auth * gr_auth; /* can be NULL */
1456 struct mailimap_resp_cond_bye * gr_bye; /* can be NULL */
1457 } gr_data;
1458};
1459
1460struct mailimap_greeting *
1461mailimap_greeting_new(int gr_type,
1462 struct mailimap_resp_cond_auth * gr_auth,
1463 struct mailimap_resp_cond_bye * gr_bye);
1464
1465void mailimap_greeting_free(struct mailimap_greeting * greeting);
1466
1467
1468/*
1469 mailimap_header_list is a list of headers that can be specified when
1470 we want to fetch fields
1471
1472 - list is a list of header names, each header name should be allocated
1473 with malloc()
1474*/
1475
1476struct mailimap_header_list {
1477 clist * hdr_list; /* list of astring (char *), != NULL */
1478};
1479
1480struct mailimap_header_list *
1481mailimap_header_list_new(clist * hdr_list);
1482
1483void
1484mailimap_header_list_free(struct mailimap_header_list * header_list);
1485
1486
1487
1488/* this is the type of mailbox STATUS that can be returned */
1489
1490enum {
1491 MAILIMAP_STATUS_ATT_MESSAGES, /* when requesting the number of
1492 messages */
1493 MAILIMAP_STATUS_ATT_RECENT, /* when requesting the number of
1494 recent messages */
1495 MAILIMAP_STATUS_ATT_UIDNEXT, /* when requesting the next unique
1496 identifier */
1497 MAILIMAP_STATUS_ATT_UIDVALIDITY, /* when requesting the validity of
1498 message unique identifiers*/
1499 MAILIMAP_STATUS_ATT_UNSEEN, /* when requesting the number of
1500 unseen messages */
1501};
1502
1503/*
1504 mailimap_status_info is a returned information when a STATUS of
1505 a mailbox is requested
1506
1507 - att is the type of mailbox STATUS, the value can be
1508 MAILIMAP_STATUS_ATT_MESSAGES, MAILIMAP_STATUS_ATT_RECENT,
1509 MAILIMAP_STATUS_ATT_UIDNEXT, MAILIMAP_STATUS_ATT_UIDVALIDITY or
1510 MAILIMAP_STATUS_ATT_UNSEEN
1511
1512 - value is the value of the given information
1513*/
1514
1515struct mailimap_status_info {
1516 int st_att;
1517 uint32_t st_value;
1518};
1519
1520struct mailimap_status_info *
1521mailimap_status_info_new(int st_att, uint32_t st_value);
1522
1523void mailimap_status_info_free(struct mailimap_status_info * info);
1524
1525
1526
1527/*
1528 mailimap_mailbox_data_status is the list of information returned
1529 when a STATUS of a mailbox is requested
1530
1531 - mailbox is the name of the mailbox, should be allocated with malloc()
1532
1533 - status_info_list is the list of information returned
1534*/
1535
1536struct mailimap_mailbox_data_status {
1537 char * st_mailbox;
1538 clist * st_info_list; /* list of (struct mailimap_status_info *) */
1539 /* can be NULL */
1540};
1541
1542struct mailimap_mailbox_data_status *
1543mailimap_mailbox_data_status_new(char * st_mailbox,
1544 clist * st_info_list);
1545
1546void
1547mailimap_mailbox_data_status_free(struct mailimap_mailbox_data_status * info);
1548
1549
1550
1551/* this is the type of mailbox information that is returned */
1552
1553enum {
1554 MAILIMAP_MAILBOX_DATA_ERROR, /* on parse error */
1555 MAILIMAP_MAILBOX_DATA_FLAGS, /* flag that are applicable to the mailbox */
1556 MAILIMAP_MAILBOX_DATA_LIST, /* this is a mailbox in the list of mailboxes
1557 returned on LIST command*/
1558 MAILIMAP_MAILBOX_DATA_LSUB, /* this is a mailbox in the list of
1559 subscribed mailboxes returned on LSUB
1560 command */
1561 MAILIMAP_MAILBOX_DATA_SEARCH, /* this is a list of messages numbers or
1562 unique identifiers returned
1563 on a SEARCH command*/
1564 MAILIMAP_MAILBOX_DATA_STATUS, /* this is the list of information returned
1565 on a STATUS command */
1566 MAILIMAP_MAILBOX_DATA_EXISTS, /* this is the number of messages in the
1567 mailbox */
1568 MAILIMAP_MAILBOX_DATA_RECENT, /* this is the number of recent messages
1569 in the mailbox */
1570};
1571
1572/*
1573 mailimap_mailbox_data is an information related to a mailbox
1574
1575 - type is the type of mailbox_data that is filled, the value of this field
1576 can be MAILIMAP_MAILBOX_DATA_FLAGS, MAILIMAP_MAILBOX_DATA_LIST,
1577 MAILIMAP_MAILBOX_DATA_LSUB, MAILIMAP_MAILBOX_DATA_SEARCH,
1578 MAILIMAP_MAILBOX_DATA_STATUS, MAILIMAP_MAILBOX_DATA_EXISTS
1579 or MAILIMAP_MAILBOX_DATA_RECENT.
1580
1581 - flags is the flags that are applicable to the mailbox when
1582 type is MAILIMAP_MAILBOX_DATA_FLAGS
1583
1584 - list is a mailbox in the list of mailboxes returned on LIST command
1585 when type is MAILIMAP_MAILBOX_DATA_LIST
1586
1587 - lsub is a mailbox in the list of subscribed mailboxes returned on
1588 LSUB command when type is MAILIMAP_MAILBOX_DATA_LSUB
1589
1590 - search is a list of messages numbers or unique identifiers returned
1591 on SEARCH command when type MAILIMAP_MAILBOX_DATA_SEARCH, each element
1592 should be allocated with malloc()
1593
1594 - status is a list of information returned on STATUS command when
1595 type is MAILIMAP_MAILBOX_DATA_STATUS
1596
1597 - exists is the number of messages in the mailbox when type
1598 is MAILIMAP_MAILBOX_DATA_EXISTS
1599
1600 - recent is the number of recent messages in the mailbox when type
1601 is MAILIMAP_MAILBOX_DATA_RECENT
1602*/
1603
1604struct mailimap_mailbox_data {
1605 int mbd_type;
1606 union {
1607 struct mailimap_flag_list * mbd_flags; /* can be NULL */
1608 struct mailimap_mailbox_list * mbd_list; /* can be NULL */
1609 struct mailimap_mailbox_list * mbd_lsub; /* can be NULL */
1610 clist * mbd_search; /* list of nz-number (uint32_t *), can be NULL */
1611 struct mailimap_mailbox_data_status * mbd_status; /* can be NULL */
1612 uint32_t mbd_exists;
1613 uint32_t mbd_recent;
1614 } mbd_data;
1615};
1616
1617struct mailimap_mailbox_data *
1618mailimap_mailbox_data_new(int mbd_type, struct mailimap_flag_list * mbd_flags,
1619 struct mailimap_mailbox_list * mbd_list,
1620 struct mailimap_mailbox_list * mbd_lsub,
1621 clist * mbd_search,
1622 struct mailimap_mailbox_data_status * mbd_status,
1623 uint32_t mbd_exists,
1624 uint32_t mbd_recent);
1625
1626void
1627mailimap_mailbox_data_free(struct mailimap_mailbox_data * mb_data);
1628
1629
1630
1631/* this is the type of mailbox flags */
1632
1633enum {
1634 MAILIMAP_MBX_LIST_FLAGS_SFLAG, /* mailbox single flag - a flag in
1635 {\NoSelect, \Marked, \Unmarked} */
1636 MAILIMAP_MBX_LIST_FLAGS_NO_SFLAG, /* mailbox other flag - mailbox flag
1637 other than \NoSelect \Marked and
1638 \Unmarked) */
1639};
1640
1641/* this is a single flag type */
1642
1643enum {
1644 MAILIMAP_MBX_LIST_SFLAG_ERROR,
1645 MAILIMAP_MBX_LIST_SFLAG_MARKED,
1646 MAILIMAP_MBX_LIST_SFLAG_NOSELECT,
1647 MAILIMAP_MBX_LIST_SFLAG_UNMARKED
1648};
1649
1650/*
1651 mailimap_mbx_list_flags is a mailbox flag
1652
1653 - type is the type of mailbox flag, it can be MAILIMAP_MBX_LIST_FLAGS_SFLAG,
1654 or MAILIMAP_MBX_LIST_FLAGS_NO_SFLAG.
1655
1656 - oflags is a list of "mailbox other flag"
1657
1658 - sflag is a mailbox single flag
1659*/
1660
1661struct mailimap_mbx_list_flags {
1662 int mbf_type;
1663 clist * mbf_oflags; /* list of
1664 (struct mailimap_mbx_list_oflag *), != NULL */
1665 int mbf_sflag;
1666};
1667
1668struct mailimap_mbx_list_flags *
1669mailimap_mbx_list_flags_new(int mbf_type,
1670 clist * mbf_oflags, int mbf_sflag);
1671
1672void
1673mailimap_mbx_list_flags_free(struct mailimap_mbx_list_flags * mbx_list_flags);
1674
1675
1676
1677/* this is the type of the mailbox other flag */
1678
1679enum {
1680 MAILIMAP_MBX_LIST_OFLAG_ERROR, /* on parse error */
1681 MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS, /* \NoInferior flag */
1682 MAILIMAP_MBX_LIST_OFLAG_FLAG_EXT /* other flag */
1683};
1684
1685/*
1686 mailimap_mbx_list_oflag is a mailbox other flag
1687
1688 - type can be MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS when this is
1689 a \NoInferior flag or MAILIMAP_MBX_LIST_OFLAG_FLAG_EXT
1690
1691 - flag_ext is set when MAILIMAP_MBX_LIST_OFLAG_FLAG_EXT and is
1692 an extension flag, should be allocated with malloc()
1693*/
1694
1695struct mailimap_mbx_list_oflag {
1696 int of_type;
1697 char * of_flag_ext; /* can be NULL */
1698};
1699
1700struct mailimap_mbx_list_oflag *
1701mailimap_mbx_list_oflag_new(int of_type, char * of_flag_ext);
1702
1703void
1704mailimap_mbx_list_oflag_free(struct mailimap_mbx_list_oflag * oflag);
1705
1706
1707
1708/*
1709 mailimap_mailbox_list is a list of mailbox flags
1710
1711 - mb_flag is a list of mailbox flags
1712
1713 - delimiter is the delimiter of the mailbox path
1714
1715 - mb is the name of the mailbox, should be allocated with malloc()
1716*/
1717
1718struct mailimap_mailbox_list {
1719 struct mailimap_mbx_list_flags * mb_flag; /* can be NULL */
1720 char mb_delimiter;
1721 char * mb_name; /* != NULL */
1722};
1723
1724struct mailimap_mailbox_list *
1725mailimap_mailbox_list_new(struct mailimap_mbx_list_flags * mbx_flags,
1726 char mb_delimiter, char * mb_name);
1727
1728void
1729mailimap_mailbox_list_free(struct mailimap_mailbox_list * mb_list);
1730
1731
1732
1733/* this is the MIME type */
1734
1735enum {
1736 MAILIMAP_MEDIA_BASIC_APPLICATION, /* application/xxx */
1737 MAILIMAP_MEDIA_BASIC_AUDIO, /* audio/xxx */
1738 MAILIMAP_MEDIA_BASIC_IMAGE, /* image/xxx */
1739 MAILIMAP_MEDIA_BASIC_MESSAGE, /* message/xxx */
1740 MAILIMAP_MEDIA_BASIC_VIDEO, /* video/xxx */
1741 MAILIMAP_MEDIA_BASIC_OTHER, /* for all other cases */
1742};
1743
1744
1745/*
1746 mailimap_media_basic is the MIME type
1747
1748 - type can be MAILIMAP_MEDIA_BASIC_APPLICATION, MAILIMAP_MEDIA_BASIC_AUDIO,
1749 MAILIMAP_MEDIA_BASIC_IMAGE, MAILIMAP_MEDIA_BASIC_MESSAGE,
1750 MAILIMAP_MEDIA_BASIC_VIDEO or MAILIMAP_MEDIA_BASIC_OTHER
1751
1752 - basic_type is defined when type is MAILIMAP_MEDIA_BASIC_OTHER, should
1753 be allocated with malloc()
1754
1755 - subtype is the subtype of the MIME type, for example, this is
1756 "data" in "application/data", should be allocated with malloc()
1757*/
1758
1759struct mailimap_media_basic {
1760 int med_type;
1761 char * med_basic_type; /* can be NULL */
1762 char * med_subtype; /* != NULL */
1763};
1764
1765struct mailimap_media_basic *
1766mailimap_media_basic_new(int med_type,
1767 char * med_basic_type, char * med_subtype);
1768
1769void
1770mailimap_media_basic_free(struct mailimap_media_basic * media_basic);
1771
1772
1773
1774/* this is the type of message data */
1775
1776enum {
1777 MAILIMAP_MESSAGE_DATA_ERROR,
1778 MAILIMAP_MESSAGE_DATA_EXPUNGE,
1779 MAILIMAP_MESSAGE_DATA_FETCH
1780};
1781
1782/*
1783 mailimap_message_data is an information related to a message
1784
1785 - number is the number or the unique identifier of the message
1786
1787 - type is the type of information, this value can be
1788 MAILIMAP_MESSAGE_DATA_EXPUNGE or MAILIMAP_MESSAGE_DATA_FETCH
1789
1790 - msg_att is the message data
1791*/
1792
1793struct mailimap_message_data {
1794 uint32_t mdt_number;
1795 int mdt_type;
1796 struct mailimap_msg_att * mdt_msg_att; /* can be NULL */
1797 /* if type = EXPUNGE, can be NULL */
1798};
1799
1800struct mailimap_message_data *
1801mailimap_message_data_new(uint32_t mdt_number, int mdt_type,
1802 struct mailimap_msg_att * mdt_msg_att);
1803
1804void
1805mailimap_message_data_free(struct mailimap_message_data * msg_data);
1806
1807
1808
1809/* this the type of the message attributes */
1810
1811enum {
1812 MAILIMAP_MSG_ATT_ITEM_ERROR, /* on parse error */
1813 MAILIMAP_MSG_ATT_ITEM_DYNAMIC, /* dynamic message attributes (flags) */
1814 MAILIMAP_MSG_ATT_ITEM_STATIC, /* static messages attributes
1815 (message content) */
1816};
1817
1818/*
1819 mailimap_msg_att_item is a message attribute
1820
1821 - type is the type of message attribute, the value can be
1822 MAILIMAP_MSG_ATT_ITEM_DYNAMIC or MAILIMAP_MSG_ATT_ITEM_STATIC
1823
1824 - msg_att_dyn is a dynamic message attribute when type is
1825 MAILIMAP_MSG_ATT_ITEM_DYNAMIC
1826
1827 - msg_att_static is a static message attribute when type is
1828 MAILIMAP_MSG_ATT_ITEM_STATIC
1829*/
1830
1831struct mailimap_msg_att_item {
1832 int att_type;
1833 union {
1834 struct mailimap_msg_att_dynamic * att_dyn; /* can be NULL */
1835 struct mailimap_msg_att_static * att_static; /* can be NULL */
1836 } att_data;
1837};
1838
1839struct mailimap_msg_att_item *
1840mailimap_msg_att_item_new(int att_type,
1841 struct mailimap_msg_att_dynamic * att_dyn,
1842 struct mailimap_msg_att_static * att_static);
1843
1844void
1845mailimap_msg_att_item_free(struct mailimap_msg_att_item * item);
1846
1847
1848/*
1849 mailimap_msg_att is a list of attributes
1850
1851 - list is a list of message attributes
1852
1853 - number is the message number or unique identifier, this field
1854 has been added for implementation purpose
1855*/
1856
1857struct mailimap_msg_att {
1858 clist * att_list; /* list of (struct mailimap_msg_att_item *) */
1859 /* != NULL */
1860 uint32_t att_number; /* extra field to store the message number,
1861 used for mailimap */
1862};
1863
1864struct mailimap_msg_att * mailimap_msg_att_new(clist * att_list);
1865
1866void mailimap_msg_att_free(struct mailimap_msg_att * msg_att);
1867
1868
1869/*
1870 mailimap_msg_att_dynamic is a dynamic message attribute
1871
1872 - list is a list of flags (that have been fetched)
1873*/
1874
1875struct mailimap_msg_att_dynamic {
1876 clist * att_list; /* list of (struct mailimap_flag_fetch *) */
1877 /* can be NULL */
1878};
1879
1880struct mailimap_msg_att_dynamic *
1881mailimap_msg_att_dynamic_new(clist * att_list);
1882
1883void
1884mailimap_msg_att_dynamic_free(struct mailimap_msg_att_dynamic * msg_att_dyn);
1885
1886
1887
1888/*
1889 mailimap_msg_att_body_section is a MIME part content
1890
1891 - section is the location of the MIME part in the message
1892
1893 - origin_octet is the offset of the requested part of the MIME part
1894
1895 - body_part is the content or partial content of the MIME part,
1896 should be allocated through a MMAPString
1897
1898 - length is the size of the content
1899*/
1900
1901struct mailimap_msg_att_body_section {
1902 struct mailimap_section * sec_section; /* != NULL */
1903 uint32_t sec_origin_octet;
1904 char * sec_body_part; /* can be NULL */
1905 size_t sec_length;
1906};
1907
1908struct mailimap_msg_att_body_section *
1909mailimap_msg_att_body_section_new(struct mailimap_section * section,
1910 uint32_t sec_origin_octet,
1911 char * sec_body_part,
1912 size_t sec_length);
1913
1914void
1915mailimap_msg_att_body_section_free(struct mailimap_msg_att_body_section *
1916 msg_att_body_section);
1917
1918
1919
1920/*
1921 this is the type of static message attribute
1922*/
1923
1924enum {
1925 MAILIMAP_MSG_ATT_ERROR, /* on parse error */
1926 MAILIMAP_MSG_ATT_ENVELOPE, /* this is the fields that can be
1927 parsed by the server */
1928 MAILIMAP_MSG_ATT_INTERNALDATE, /* this is the message date kept
1929 by the server */
1930 MAILIMAP_MSG_ATT_RFC822, /* this is the message content
1931 (header and body) */
1932 MAILIMAP_MSG_ATT_RFC822_HEADER, /* this is the message header */
1933 MAILIMAP_MSG_ATT_RFC822_TEXT, /* this is the message text part */
1934 MAILIMAP_MSG_ATT_RFC822_SIZE, /* this is the size of the message content */
1935 MAILIMAP_MSG_ATT_BODY, /* this is the MIME description of
1936 the message */
1937 MAILIMAP_MSG_ATT_BODYSTRUCTURE, /* this is the MIME description of the
1938 message with additional information */
1939 MAILIMAP_MSG_ATT_BODY_SECTION, /* this is a MIME part content */
1940 MAILIMAP_MSG_ATT_UID, /* this is the message unique identifier */
1941};
1942
1943/*
1944 mailimap_msg_att_static is a given part of the message
1945
1946 - type is the type of the static message attribute, the value can be
1947 MAILIMAP_MSG_ATT_ENVELOPE, MAILIMAP_MSG_ATT_INTERNALDATE,
1948 MAILIMAP_MSG_ATT_RFC822, MAILIMAP_MSG_ATT_RFC822_HEADER,
1949 MAILIMAP_MSG_ATT_RFC822_TEXT, MAILIMAP_MSG_ATT_RFC822_SIZE,
1950 MAILIMAP_MSG_ATT_BODY, MAILIMAP_MSG_ATT_BODYSTRUCTURE,
1951 MAILIMAP_MSG_ATT_BODY_SECTION, MAILIMAP_MSG_ATT_UID
1952
1953 - env is the headers parsed by the server if type is
1954 MAILIMAP_MSG_ATT_ENVELOPE
1955
1956 - internal_date is the date of message kept by the server if type is
1957 MAILIMAP_MSG_ATT_INTERNALDATE
1958
1959 - rfc822 is the message content if type is MAILIMAP_MSG_ATT_RFC822,
1960 should be allocated through a MMAPString
1961
1962 - rfc822_header is the message header if type is
1963 MAILIMAP_MSG_ATT_RFC822_HEADER, should be allocated through a MMAPString
1964
1965 - rfc822_text is the message text part if type is
1966 MAILIMAP_MSG_ATT_RFC822_TEXT, should be allocated through a MMAPString
1967
1968 - rfc822_size is the message size if type is MAILIMAP_MSG_ATT_SIZE
1969
1970 - body is the MIME description of the message
1971
1972 - bodystructure is the MIME description of the message with additional
1973 information
1974
1975 - body_section is a MIME part content
1976
1977 - uid is a unique message identifier
1978*/
1979
1980struct mailimap_msg_att_static {
1981 int att_type;
1982 union {
1983 struct mailimap_envelope * att_env; /* can be NULL */
1984 struct mailimap_date_time * att_internal_date; /* can be NULL */
1985 struct {
1986 char * att_content; /* can be NULL */
1987 size_t att_length;
1988 } att_rfc822;
1989 struct {
1990 char * att_content; /* can be NULL */
1991 size_t att_length;
1992 } att_rfc822_header;
1993 struct {
1994 char * att_content; /* can be NULL */
1995 size_t att_length;
1996 } att_rfc822_text;
1997 uint32_t att_rfc822_size;
1998 struct mailimap_body * att_bodystructure; /* can be NULL */
1999 struct mailimap_body * att_body; /* can be NULL */
2000 struct mailimap_msg_att_body_section * att_body_section; /* can be NULL */
2001 uint32_t att_uid;
2002 } att_data;
2003};
2004
2005struct mailimap_msg_att_static *
2006mailimap_msg_att_static_new(int att_type, struct mailimap_envelope * att_env,
2007 struct mailimap_date_time * att_internal_date,
2008 char * att_rfc822,
2009 char * att_rfc822_header,
2010 char * att_rfc822_text,
2011 size_t att_length,
2012 uint32_t att_rfc822_size,
2013 struct mailimap_body * att_bodystructure,
2014 struct mailimap_body * att_body,
2015 struct mailimap_msg_att_body_section * att_body_section,
2016 uint32_t att_uid);
2017
2018void
2019mailimap_msg_att_static_free(struct mailimap_msg_att_static * item);
2020
2021
2022
2023/* this is the type of a response element */
2024
2025enum {
2026 MAILIMAP_RESP_ERROR, /* on parse error */
2027 MAILIMAP_RESP_CONT_REQ, /* continuation request */
2028 MAILIMAP_RESP_RESP_DATA, /* response data */
2029};
2030
2031/*
2032 mailimap_cont_req_or_resp_data is a response element
2033
2034 - type is the type of response, the value can be MAILIMAP_RESP_CONT_REQ
2035 or MAILIMAP_RESP_RESP_DATA
2036
2037 - cont_req is a continuation request
2038
2039 - resp_data is a reponse data
2040*/
2041
2042struct mailimap_cont_req_or_resp_data {
2043 int rsp_type;
2044 union {
2045 struct mailimap_continue_req * rsp_cont_req; /* can be NULL */
2046 struct mailimap_response_data * rsp_resp_data; /* can be NULL */
2047 } rsp_data;
2048};
2049
2050struct mailimap_cont_req_or_resp_data *
2051mailimap_cont_req_or_resp_data_new(int rsp_type,
2052 struct mailimap_continue_req * rsp_cont_req,
2053 struct mailimap_response_data * rsp_resp_data);
2054
2055void
2056mailimap_cont_req_or_resp_data_free(struct mailimap_cont_req_or_resp_data *
2057 cont_req_or_resp_data);
2058
2059
2060/*
2061 mailimap_response is a list of response elements
2062
2063 - cont_req_or_resp_data_list is a list of response elements
2064
2065 - resp_done is an ending response element
2066*/
2067
2068struct mailimap_response {
2069 clist * rsp_cont_req_or_resp_data_list;
2070 /* list of (struct mailiap_cont_req_or_resp_data *) */
2071 /* can be NULL */
2072 struct mailimap_response_done * rsp_resp_done; /* != NULL */
2073};
2074
2075struct mailimap_response *
2076mailimap_response_new(clist * rsp_cont_req_or_resp_data_list,
2077 struct mailimap_response_done * rsp_resp_done);
2078
2079void
2080mailimap_response_free(struct mailimap_response * resp);
2081
2082
2083
2084/* this is the type of an untagged response */
2085
2086enum {
2087 MAILIMAP_RESP_DATA_TYPE_ERROR, /* on parse error */
2088 MAILIMAP_RESP_DATA_TYPE_COND_STATE, /* condition state response */
2089 MAILIMAP_RESP_DATA_TYPE_COND_BYE, /* BYE response (server is about
2090 to close the connection) */
2091 MAILIMAP_RESP_DATA_TYPE_MAILBOX_DATA, /* response related to a mailbox */
2092 MAILIMAP_RESP_DATA_TYPE_MESSAGE_DATA, /* response related to a message */
2093 MAILIMAP_RESP_DATA_TYPE_CAPABILITY_DATA, /* capability information */
2094};
2095
2096/*
2097 mailimap_reponse_data is an untagged response
2098
2099 - type is the type of the untagged response, it can be
2100 MAILIMAP_RESP_DATA_COND_STATE, MAILIMAP_RESP_DATA_COND_BYE,
2101 MAILIMAP_RESP_DATA_MAILBOX_DATA, MAILIMAP_RESP_DATA_MESSAGE_DATA
2102 or MAILIMAP_RESP_DATA_CAPABILITY_DATA
2103
2104 - cond_state is a condition state response
2105
2106 - bye is a BYE response (server is about to close the connection)
2107
2108 - mailbox_data is a response related to a mailbox
2109
2110 - message_data is a response related to a message
2111
2112 - capability is information about capabilities
2113*/
2114
2115struct mailimap_response_data {
2116 int rsp_type;
2117 union {
2118 struct mailimap_resp_cond_state * rsp_cond_state; /* can be NULL */
2119 struct mailimap_resp_cond_bye * rsp_bye; /* can be NULL */
2120 struct mailimap_mailbox_data * rsp_mailbox_data; /* can be NULL */
2121 struct mailimap_message_data * rsp_message_data; /* can be NULL */
2122 struct mailimap_capability_data * rsp_capability_data; /* can be NULL */
2123 } rsp_data;
2124};
2125
2126struct mailimap_response_data *
2127mailimap_response_data_new(int rsp_type,
2128 struct mailimap_resp_cond_state * rsp_cond_state,
2129 struct mailimap_resp_cond_bye * rsp_bye,
2130 struct mailimap_mailbox_data * rsp_mailbox_data,
2131 struct mailimap_message_data * rsp_message_data,
2132 struct mailimap_capability_data * rsp_capability_data);
2133
2134void
2135mailimap_response_data_free(struct mailimap_response_data * resp_data);
2136
2137
2138
2139/* this is the type of an ending response */
2140
2141enum {
2142 MAILIMAP_RESP_DONE_TYPE_ERROR, /* on parse error */
2143 MAILIMAP_RESP_DONE_TYPE_TAGGED, /* tagged response */
2144 MAILIMAP_RESP_DONE_TYPE_FATAL, /* fatal error response */
2145};
2146
2147/*
2148 mailimap_response_done is an ending response
2149
2150 - type is the type of the ending response
2151
2152 - tagged is a tagged response
2153
2154 - fatal is a fatal error response
2155*/
2156
2157struct mailimap_response_done {
2158 int rsp_type;
2159 union {
2160 struct mailimap_response_tagged * rsp_tagged; /* can be NULL */
2161 struct mailimap_response_fatal * rsp_fatal; /* can be NULL */
2162 } rsp_data;
2163};
2164
2165struct mailimap_response_done *
2166mailimap_response_done_new(int rsp_type,
2167 struct mailimap_response_tagged * rsp_tagged,
2168 struct mailimap_response_fatal * rsp_fatal);
2169
2170void mailimap_response_done_free(struct mailimap_response_done *
2171 resp_done);
2172
2173
2174/*
2175 mailimap_response_fatal is a fatal error response
2176
2177 - bye is a BYE response text
2178*/
2179
2180struct mailimap_response_fatal {
2181 struct mailimap_resp_cond_bye * rsp_bye; /* != NULL */
2182};
2183
2184struct mailimap_response_fatal *
2185mailimap_response_fatal_new(struct mailimap_resp_cond_bye * rsp_bye);
2186
2187void mailimap_response_fatal_free(struct mailimap_response_fatal * resp_fatal);
2188
2189
2190
2191/*
2192 mailimap_response_tagged is a tagged response
2193
2194 - tag is the sent tag, should be allocated with malloc()
2195
2196 - cond_state is a condition state response
2197*/
2198
2199struct mailimap_response_tagged {
2200 char * rsp_tag; /* != NULL */
2201 struct mailimap_resp_cond_state * rsp_cond_state; /* != NULL */
2202};
2203
2204struct mailimap_response_tagged *
2205mailimap_response_tagged_new(char * rsp_tag,
2206 struct mailimap_resp_cond_state * rsp_cond_state);
2207
2208void
2209mailimap_response_tagged_free(struct mailimap_response_tagged * tagged);
2210
2211
2212/* this is the type of an authentication condition response */
2213
2214enum {
2215 MAILIMAP_RESP_COND_AUTH_ERROR, /* on parse error */
2216 MAILIMAP_RESP_COND_AUTH_OK, /* authentication is needed */
2217 MAILIMAP_RESP_COND_AUTH_PREAUTH, /* authentication is not needed */
2218};
2219
2220/*
2221 mailimap_resp_cond_auth is an authentication condition response
2222
2223 - type is the type of the authentication condition response,
2224 the value can be MAILIMAP_RESP_COND_AUTH_OK or
2225 MAILIMAP_RESP_COND_AUTH_PREAUTH
2226
2227 - text is a text response
2228*/
2229
2230struct mailimap_resp_cond_auth {
2231 int rsp_type;
2232 struct mailimap_resp_text * rsp_text; /* != NULL */
2233};
2234
2235struct mailimap_resp_cond_auth *
2236mailimap_resp_cond_auth_new(int rsp_type,
2237 struct mailimap_resp_text * rsp_text);
2238
2239void
2240mailimap_resp_cond_auth_free(struct mailimap_resp_cond_auth * cond_auth);
2241
2242
2243
2244/*
2245 mailimap_resp_cond_bye is a BYE response
2246
2247 - text is a text response
2248*/
2249
2250struct mailimap_resp_cond_bye {
2251 struct mailimap_resp_text * rsp_text; /* != NULL */
2252};
2253
2254struct mailimap_resp_cond_bye *
2255mailimap_resp_cond_bye_new(struct mailimap_resp_text * rsp_text);
2256
2257void
2258mailimap_resp_cond_bye_free(struct mailimap_resp_cond_bye * cond_bye);
2259
2260
2261
2262/* this is the type of a condition state response */
2263
2264enum {
2265 MAILIMAP_RESP_COND_STATE_OK,
2266 MAILIMAP_RESP_COND_STATE_NO,
2267 MAILIMAP_RESP_COND_STATE_BAD
2268};
2269
2270/*
2271 mailimap_resp_cond_state is a condition state reponse
2272
2273 - type is the type of the condition state response
2274
2275 - text is a text response
2276*/
2277
2278struct mailimap_resp_cond_state {
2279 int rsp_type;
2280 struct mailimap_resp_text * rsp_text; /* can be NULL */
2281};
2282
2283struct mailimap_resp_cond_state *
2284mailimap_resp_cond_state_new(int rsp_type,
2285 struct mailimap_resp_text * rsp_text);
2286
2287void
2288mailimap_resp_cond_state_free(struct mailimap_resp_cond_state * cond_state);
2289
2290
2291
2292/*
2293 mailimap_resp_text is a text response
2294
2295 - resp_code is a response code
2296
2297 - text is a human readable text, should be allocated with malloc()
2298*/
2299
2300struct mailimap_resp_text {
2301 struct mailimap_resp_text_code * rsp_code; /* can be NULL */
2302 char * rsp_text; /* can be NULL */
2303};
2304
2305struct mailimap_resp_text *
2306mailimap_resp_text_new(struct mailimap_resp_text_code * resp_code,
2307 char * rsp_text);
2308
2309void mailimap_resp_text_free(struct mailimap_resp_text * resp_text);
2310
2311
2312
2313/* this is the type of the response code */
2314
2315enum {
2316 MAILIMAP_RESP_TEXT_CODE_ALERT, /* ALERT response */
2317 MAILIMAP_RESP_TEXT_CODE_BADCHARSET, /* BADCHARSET response */
2318 MAILIMAP_RESP_TEXT_CODE_CAPABILITY_DATA, /* CAPABILITY response */
2319 MAILIMAP_RESP_TEXT_CODE_PARSE, /* PARSE response */
2320 MAILIMAP_RESP_TEXT_CODE_PERMANENTFLAGS, /* PERMANENTFLAGS response */
2321 MAILIMAP_RESP_TEXT_CODE_READ_ONLY, /* READONLY response */
2322 MAILIMAP_RESP_TEXT_CODE_READ_WRITE, /* READWRITE response */
2323 MAILIMAP_RESP_TEXT_CODE_TRY_CREATE, /* TRYCREATE response */
2324 MAILIMAP_RESP_TEXT_CODE_UIDNEXT, /* UIDNEXT response */
2325 MAILIMAP_RESP_TEXT_CODE_UIDVALIDITY, /* UIDVALIDITY response */
2326 MAILIMAP_RESP_TEXT_CODE_UNSEEN, /* UNSEEN response */
2327 MAILIMAP_RESP_TEXT_CODE_OTHER, /* other type of response */
2328};
2329
2330/*
2331 mailimap_resp_text_code is a response code
2332
2333 - type is the type of the response code, the value can be
2334 MAILIMAP_RESP_TEXT_CODE_ALERT, MAILIMAP_RESP_TEXT_CODE_BADCHARSET,
2335 MAILIMAP_RESP_TEXT_CODE_CAPABILITY_DATA, MAILIMAP_RESP_TEXT_CODE_PARSE,
2336 MAILIMAP_RESP_TEXT_CODE_PERMANENTFLAGS, MAILIMAP_RESP_TEXT_CODE_READ_ONLY,
2337 MAILIMAP_RESP_TEXT_CODE_READ_WRITE, MAILIMAP_RESP_TEXT_CODE_TRY_CREATE,
2338 MAILIMAP_RESP_TEXT_CODE_UIDNEXT, MAILIMAP_RESP_TEXT_CODE_UIDVALIDITY,
2339 MAILIMAP_RESP_TEXT_CODE_UNSEEN or MAILIMAP_RESP_TEXT_CODE_OTHER
2340
2341 - badcharset is a list of charsets if type
2342 is MAILIMAP_RESP_TEXT_CODE_BADCHARSET, each element should be
2343 allocated with malloc()
2344
2345 - cap_data is a list of capabilities
2346
2347 - perm_flags is a list of flags, this is the flags that can be changed
2348 permanently on the messages of the mailbox.
2349
2350 - uidnext is the next unique identifier of a message
2351
2352 - uidvalidity is the unique identifier validity value
2353
2354 - first_unseen is the number of the first message without the \Seen flag
2355
2356 - atom is a keyword for an extension response code, should be allocated
2357 with malloc()
2358
2359 - atom_value is the data related with the extension response code,
2360 should be allocated with malloc()
2361*/
2362
2363struct mailimap_resp_text_code {
2364 int rc_type;
2365 union {
2366 clist * rc_badcharset; /* list of astring (char *) */
2367 /* can be NULL */
2368 struct mailimap_capability_data * rc_cap_data; /* != NULL */
2369 clist * rc_perm_flags; /* list of (struct mailimap_flag_perm *) */
2370 /* can be NULL */
2371 uint32_t rc_uidnext;
2372 uint32_t rc_uidvalidity;
2373 uint32_t rc_first_unseen;
2374 struct {
2375 char * atom_name; /* can be NULL */
2376 char * atom_value; /* can be NULL */
2377 } rc_atom;
2378 } rc_data;
2379};
2380
2381struct mailimap_resp_text_code *
2382mailimap_resp_text_code_new(int rc_type, clist * rc_badcharset,
2383 struct mailimap_capability_data * rc_cap_data,
2384 clist * rc_perm_flags,
2385 uint32_t rc_uidnext, uint32_t rc_uidvalidity,
2386 uint32_t rc_first_unseen, char * rc_atom, char * rc_atom_value);
2387
2388void
2389mailimap_resp_text_code_free(struct mailimap_resp_text_code * resp_text_code);
2390
2391
2392/*
2393 mailimap_section is a MIME part section identifier
2394
2395 section_spec is the MIME section identifier
2396*/
2397
2398struct mailimap_section {
2399 struct mailimap_section_spec * sec_spec; /* can be NULL */
2400};
2401
2402struct mailimap_section *
2403mailimap_section_new(struct mailimap_section_spec * sec_spec);
2404
2405void mailimap_section_free(struct mailimap_section * section);
2406
2407
2408/* this is the type of the message/rfc822 part description */
2409
2410enum {
2411 MAILIMAP_SECTION_MSGTEXT_HEADER, /* header fields part of the
2412 message */
2413 MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS, /* given header fields of the
2414 message */
2415 MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS_NOT, /* header fields of the
2416 message except the given */
2417 MAILIMAP_SECTION_MSGTEXT_TEXT, /* text part */
2418};
2419
2420/*
2421 mailimap_section_msgtext is a message/rfc822 part description
2422
2423 - type is the type of the content part and the value can be
2424 MAILIMAP_SECTION_MSGTEXT_HEADER, MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS,
2425 MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS_NOT
2426 or MAILIMAP_SECTION_MSGTEXT_TEXT
2427
2428 - header_list is the list of headers when type is
2429 MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS or
2430 MAILIMAP_SECTION_MSGTEXT_HEADER_FIELDS_NOT
2431*/
2432
2433struct mailimap_section_msgtext {
2434 int sec_type;
2435 struct mailimap_header_list * sec_header_list; /* can be NULL */
2436};
2437
2438struct mailimap_section_msgtext *
2439mailimap_section_msgtext_new(int sec_type,
2440 struct mailimap_header_list * sec_header_list);
2441
2442void
2443mailimap_section_msgtext_free(struct mailimap_section_msgtext * msgtext);
2444
2445
2446
2447/*
2448 mailimap_section_part is the MIME part location in a message
2449
2450 - section_id is a list of number index of the sub-part in the mail structure,
2451 each element should be allocated with malloc()
2452
2453*/
2454
2455struct mailimap_section_part {
2456 clist * sec_id; /* list of nz-number (uint32_t *) */
2457 /* != NULL */
2458};
2459
2460struct mailimap_section_part *
2461mailimap_section_part_new(clist * sec_id);
2462
2463void
2464mailimap_section_part_free(struct mailimap_section_part * section_part);
2465
2466
2467
2468/* this is the type of section specification */
2469
2470enum {
2471 MAILIMAP_SECTION_SPEC_SECTION_MSGTEXT, /* if requesting data of the root
2472 MIME message/rfc822 part */
2473 MAILIMAP_SECTION_SPEC_SECTION_PART, /* location of the MIME part
2474 in the message */
2475};
2476
2477/*
2478 mailimap_section_spec is a section specification
2479
2480 - type is the type of the section specification, the value can be
2481 MAILIMAP_SECTION_SPEC_SECTION_MSGTEXT or
2482 MAILIMAP_SECTION_SPEC_SECTION_PART
2483
2484 - section_msgtext is a message/rfc822 part description if type is
2485 MAILIMAP_SECTION_SPEC_SECTION_MSGTEXT
2486
2487 - section_part is a body part location in the message if type is
2488 MAILIMAP_SECTION_SPEC_SECTION_PART
2489
2490 - section_text is a body part location for a given MIME part,
2491 this can be NULL if the body of the part is requested (and not
2492 the MIME header).
2493*/
2494
2495struct mailimap_section_spec {
2496 int sec_type;
2497 union {
2498 struct mailimap_section_msgtext * sec_msgtext; /* can be NULL */
2499 struct mailimap_section_part * sec_part; /* can be NULL */
2500 } sec_data;
2501 struct mailimap_section_text * sec_text; /* can be NULL */
2502};
2503
2504struct mailimap_section_spec *
2505mailimap_section_spec_new(int sec_type,
2506 struct mailimap_section_msgtext * sec_msgtext,
2507 struct mailimap_section_part * sec_part,
2508 struct mailimap_section_text * sec_text);
2509
2510void
2511mailimap_section_spec_free(struct mailimap_section_spec * section_spec);
2512
2513
2514
2515/* this is the type of body part location for a given MIME part */
2516
2517enum {
2518 MAILIMAP_SECTION_TEXT_ERROR, /* on parse error **/
2519 MAILIMAP_SECTION_TEXT_SECTION_MSGTEXT, /* if the MIME type is
2520 message/rfc822, headers or text
2521 can be requested */
2522 MAILIMAP_SECTION_TEXT_MIME, /* for all MIME types,
2523 MIME headers can be requested */
2524};
2525
2526/*
2527 mailimap_section_text is the body part location for a given MIME part
2528
2529 - type can be MAILIMAP_SECTION_TEXT_SECTION_MSGTEXT or
2530 MAILIMAP_SECTION_TEXT_MIME
2531
2532 - section_msgtext is the part of the MIME part when MIME type is
2533 message/rfc822 than can be requested, when type is
2534 MAILIMAP_TEXT_SECTION_MSGTEXT
2535*/
2536
2537struct mailimap_section_text {
2538 int sec_type;
2539 struct mailimap_section_msgtext * sec_msgtext; /* can be NULL */
2540};
2541
2542struct mailimap_section_text *
2543mailimap_section_text_new(int sec_type,
2544 struct mailimap_section_msgtext * sec_msgtext);
2545
2546void
2547mailimap_section_text_free(struct mailimap_section_text * section_text);
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558/* ************************************************************************* */
2559/* the following part concerns only the IMAP command that are sent */
2560
2561
2562/*
2563 mailimap_set_item is a message set
2564
2565 - first is the first message of the set
2566 - last is the last message of the set
2567
2568 this can be message numbers of message unique identifiers
2569*/
2570
2571struct mailimap_set_item {
2572 uint32_t set_first;
2573 uint32_t set_last;
2574};
2575
2576struct mailimap_set_item *
2577mailimap_set_item_new(uint32_t set_first, uint32_t set_last);
2578
2579void mailimap_set_item_free(struct mailimap_set_item * set_item);
2580
2581
2582
2583/*
2584 set is a list of message sets
2585
2586 - list is a list of message sets
2587*/
2588
2589struct mailimap_set {
2590 clist * set_list; /* list of (struct mailimap_set_item *) */
2591};
2592
2593struct mailimap_set * mailimap_set_new(clist * list);
2594
2595void mailimap_set_free(struct mailimap_set * set);
2596
2597
2598/*
2599 mailimap_date is a date
2600
2601 - day is the day in the month (1 to 31)
2602
2603 - month (1 to 12)
2604
2605 - year (4 digits)
2606*/
2607
2608struct mailimap_date {
2609 int dt_day;
2610 int dt_month;
2611 int dt_year;
2612};
2613
2614struct mailimap_date *
2615mailimap_date_new(int dt_day, int dt_month, int dt_year);
2616
2617void mailimap_date_free(struct mailimap_date * date);
2618
2619
2620
2621
2622/* this is the type of fetch attribute for a given message */
2623
2624enum {
2625 MAILIMAP_FETCH_ATT_ENVELOPE, /* to fetch the headers parsed by
2626 the IMAP server */
2627 MAILIMAP_FETCH_ATT_FLAGS, /* to fetch the flags */
2628 MAILIMAP_FETCH_ATT_INTERNALDATE, /* to fetch the date of the message
2629 kept by the server */
2630 MAILIMAP_FETCH_ATT_RFC822, /* to fetch the entire message */
2631 MAILIMAP_FETCH_ATT_RFC822_HEADER, /* to fetch the headers */
2632 MAILIMAP_FETCH_ATT_RFC822_SIZE, /* to fetch the size */
2633 MAILIMAP_FETCH_ATT_RFC822_TEXT, /* to fetch the text part */
2634 MAILIMAP_FETCH_ATT_BODY, /* to fetch the MIME structure */
2635 MAILIMAP_FETCH_ATT_BODYSTRUCTURE, /* to fetch the MIME structure with
2636 additional information */
2637 MAILIMAP_FETCH_ATT_UID, /* to fetch the unique identifier */
2638 MAILIMAP_FETCH_ATT_BODY_SECTION, /* to fetch a given part */
2639 MAILIMAP_FETCH_ATT_BODY_PEEK_SECTION, /* to fetch a given part without
2640 marking the message as read */
2641};
2642
2643
2644/*
2645 mailimap_fetch_att is the description of the fetch attribute
2646
2647 - type is the type of fetch attribute, the value can be
2648 MAILIMAP_FETCH_ATT_ENVELOPE, MAILIMAP_FETCH_ATT_FLAGS,
2649 MAILIMAP_FETCH_ATT_INTERNALDATE, MAILIMAP_FETCH_ATT_RFC822,
2650 MAILIMAP_FETCH_ATT_RFC822_HEADER, MAILIMAP_FETCH_ATT_RFC822_SIZE,
2651 MAILIMAP_FETCH_ATT_RFC822_TEXT, MAILIMAP_FETCH_ATT_BODY,
2652 MAILIMAP_FETCH_ATT_BODYSTRUCTURE, MAILIMAP_FETCH_ATT_UID,
2653 MAILIMAP_FETCH_ATT_BODY_SECTION or MAILIMAP_FETCH_ATT_BODY_PEEK_SECTION
2654
2655 - section is the location of the part to fetch if type is
2656 MAILIMAP_FETCH_ATT_BODY_SECTION or MAILIMAP_FETCH_ATT_BODY_PEEK_SECTION
2657
2658 - offset is the first byte to fetch in the given part
2659
2660 - size is the maximum size of the part to fetch
2661*/
2662
2663struct mailimap_fetch_att {
2664 int att_type;
2665 struct mailimap_section * att_section;
2666 uint32_t att_offset;
2667 uint32_t att_size;
2668};
2669
2670struct mailimap_fetch_att *
2671mailimap_fetch_att_new(int att_type, struct mailimap_section * att_section,
2672 uint32_t att_offset, uint32_t att_size);
2673
2674
2675void mailimap_fetch_att_free(struct mailimap_fetch_att * fetch_att);
2676
2677
2678/* this is the type of a FETCH operation */
2679
2680enum {
2681 MAILIMAP_FETCH_TYPE_ALL, /* equivalent to (FLAGS INTERNALDATE
2682 RFC822.SIZE ENVELOPE) */
2683 MAILIMAP_FETCH_TYPE_FULL, /* equivalent to (FLAGS INTERNALDATE
2684 RFC822.SIZE ENVELOPE BODY) */
2685 MAILIMAP_FETCH_TYPE_FAST, /* equivalent to (FLAGS INTERNALDATE
2686 RFC822.SIZE) */
2687 MAILIMAP_FETCH_TYPE_FETCH_ATT, /* when there is only of fetch
2688 attribute */
2689 MAILIMAP_FETCH_TYPE_FETCH_ATT_LIST, /* when there is a list of fetch
2690 attributes */
2691};
2692
2693/*
2694 mailimap_fetch_type is the description of the FETCH operation
2695
2696 - type can be MAILIMAP_FETCH_TYPE_ALL, MAILIMAP_FETCH_TYPE_FULL,
2697 MAILIMAP_FETCH_TYPE_FAST, MAILIMAP_FETCH_TYPE_FETCH_ATT or
2698 MAILIMAP_FETCH_TYPE_FETCH_ATT_LIST
2699
2700 - fetch_att is a fetch attribute if type is MAILIMAP_FETCH_TYPE_FETCH_ATT
2701
2702 - fetch_att_list is a list of fetch attributes if type is
2703 MAILIMAP_FETCH_TYPE_FETCH_ATT_LIST
2704*/
2705
2706struct mailimap_fetch_type {
2707 int ft_type;
2708 union {
2709 struct mailimap_fetch_att * ft_fetch_att;
2710 clist * ft_fetch_att_list; /* list of (struct mailimap_fetch_att *) */
2711 } ft_data;
2712};
2713
2714struct mailimap_fetch_type *
2715mailimap_fetch_type_new(int ft_type,
2716 struct mailimap_fetch_att * ft_fetch_att,
2717 clist * ft_fetch_att_list);
2718
2719
2720void mailimap_fetch_type_free(struct mailimap_fetch_type * fetch_type);
2721
2722
2723
2724/*
2725 mailimap_store_att_flags is the description of the STORE operation
2726 (change flags of a message)
2727
2728 - sign can be 0 (set flag), +1 (add flag) or -1 (remove flag)
2729
2730 - silent has a value of 1 if the flags are changed with no server
2731 response
2732
2733 - flag_list is the list of flags to change
2734*/
2735
2736struct mailimap_store_att_flags {
2737 int fl_sign;
2738 int fl_silent;
2739 struct mailimap_flag_list * fl_flag_list;
2740};
2741
2742struct mailimap_store_att_flags *
2743mailimap_store_att_flags_new(int fl_sign, int fl_silent,
2744 struct mailimap_flag_list * fl_flag_list);
2745
2746void mailimap_store_att_flags_free(struct mailimap_store_att_flags *
2747 store_att_flags);
2748
2749
2750
2751/* this is the condition of the SEARCH operation */
2752
2753enum {
2754 MAILIMAP_SEARCH_KEY_ALL, /* all messages */
2755 MAILIMAP_SEARCH_KEY_ANSWERED, /* messages with the flag \Answered */
2756 MAILIMAP_SEARCH_KEY_BCC, /* messages whose Bcc field contains the
2757 given string */
2758 MAILIMAP_SEARCH_KEY_BEFORE, /* messages whose internal date is earlier
2759 than the specified date */
2760 MAILIMAP_SEARCH_KEY_BODY, /* message that contains the given string
2761 (in header and text parts) */
2762 MAILIMAP_SEARCH_KEY_CC, /* messages whose Cc field contains the
2763 given string */
2764 MAILIMAP_SEARCH_KEY_DELETED, /* messages with the flag \Deleted */
2765 MAILIMAP_SEARCH_KEY_FLAGGED, /* messages with the flag \Flagged */
2766 MAILIMAP_SEARCH_KEY_FROM, /* messages whose From field contains the
2767 given string */
2768 MAILIMAP_SEARCH_KEY_KEYWORD, /* messages with the flag keyword set */
2769 MAILIMAP_SEARCH_KEY_NEW, /* messages with the flag \Recent and not
2770 the \Seen flag */
2771 MAILIMAP_SEARCH_KEY_OLD, /* messages that do not have the
2772 \Recent flag set */
2773 MAILIMAP_SEARCH_KEY_ON, /* messages whose internal date is the
2774 specified date */
2775 MAILIMAP_SEARCH_KEY_RECENT, /* messages with the flag \Recent */
2776 MAILIMAP_SEARCH_KEY_SEEN, /* messages with the flag \Seen */
2777 MAILIMAP_SEARCH_KEY_SINCE, /* messages whose internal date is later
2778 than specified date */
2779 MAILIMAP_SEARCH_KEY_SUBJECT, /* messages whose Subject field contains the
2780 given string */
2781 MAILIMAP_SEARCH_KEY_TEXT, /* messages whose text part contains the
2782 given string */
2783 MAILIMAP_SEARCH_KEY_TO, /* messages whose To field contains the
2784 given string */
2785 MAILIMAP_SEARCH_KEY_UNANSWERED, /* messages with no flag \Answered */
2786 MAILIMAP_SEARCH_KEY_UNDELETED, /* messages with no flag \Deleted */
2787 MAILIMAP_SEARCH_KEY_UNFLAGGED, /* messages with no flag \Flagged */
2788 MAILIMAP_SEARCH_KEY_UNKEYWORD, /* messages with no flag keyword */
2789 MAILIMAP_SEARCH_KEY_UNSEEN, /* messages with no flag \Seen */
2790 MAILIMAP_SEARCH_KEY_DRAFT, /* messages with no flag \Draft */
2791 MAILIMAP_SEARCH_KEY_HEADER, /* messages whose given field
2792 contains the given string */
2793 MAILIMAP_SEARCH_KEY_LARGER, /* messages whose size is larger then
2794 the given size */
2795 MAILIMAP_SEARCH_KEY_NOT, /* not operation of the condition */
2796 MAILIMAP_SEARCH_KEY_OR, /* or operation between two conditions */
2797 MAILIMAP_SEARCH_KEY_SENTBEFORE, /* messages whose date given in Date header
2798 is earlier than the specified date */
2799 MAILIMAP_SEARCH_KEY_SENTON, /* messages whose date given in Date header
2800 is the specified date */
2801 MAILIMAP_SEARCH_KEY_SENTSINCE, /* messages whose date given in Date header
2802 is later than specified date */
2803 MAILIMAP_SEARCH_KEY_SMALLER, /* messages whose size is smaller than
2804 the given size */
2805 MAILIMAP_SEARCH_KEY_UID, /* messages whose unique identifiers are
2806 in the given range */
2807 MAILIMAP_SEARCH_KEY_UNDRAFT, /* messages with no flag \Draft */
2808 MAILIMAP_SEARCH_KEY_SET, /* messages whose number (or unique
2809 identifiers in case of UID SEARCH) are
2810 in the given range */
2811 MAILIMAP_SEARCH_KEY_MULTIPLE, /* the boolean operator between the
2812 conditions is AND */
2813};
2814
2815/*
2816 mailimap_search_key is the condition on the messages to return
2817
2818 - type is the type of the condition
2819
2820 - bcc is the text to search in the Bcc field when type is
2821 MAILIMAP_SEARCH_KEY_BCC, should be allocated with malloc()
2822
2823 - before is a date when type is MAILIMAP_SEARCH_KEY_BEFORE
2824
2825 - body is the text to search in the message when type is
2826 MAILIMAP_SEARCH_KEY_BODY, should be allocated with malloc()
2827
2828 - cc is the text to search in the Cc field when type is
2829 MAILIMAP_SEARCH_KEY_CC, should be allocated with malloc()
2830
2831 - from is the text to search in the From field when type is
2832 MAILIMAP_SEARCH_KEY_FROM, should be allocated with malloc()
2833
2834 - keyword is the keyword flag name when type is MAILIMAP_SEARCH_KEY_KEYWORD,
2835 should be allocated with malloc()
2836
2837 - on is a date when type is MAILIMAP_SEARCH_KEY_ON
2838
2839 - since is a date when type is MAILIMAP_SEARCH_KEY_SINCE
2840
2841 - subject is the text to search in the Subject field when type is
2842 MAILIMAP_SEARCH_KEY_SUBJECT, should be allocated with malloc()
2843
2844 - text is the text to search in the text part of the message when
2845 type is MAILIMAP_SEARCH_KEY_TEXT, should be allocated with malloc()
2846
2847 - to is the text to search in the To field when type is
2848 MAILIMAP_SEARCH_KEY_TO, should be allocated with malloc()
2849
2850 - unkeyword is the keyword flag name when type is
2851 MAILIMAP_SEARCH_KEY_UNKEYWORD, should be allocated with malloc()
2852
2853 - header_name is the header name when type is MAILIMAP_SEARCH_KEY_HEADER,
2854 should be allocated with malloc()
2855
2856 - header_value is the text to search in the given header when type is
2857 MAILIMAP_SEARCH_KEY_HEADER, should be allocated with malloc()
2858
2859 - larger is a size when type is MAILIMAP_SEARCH_KEY_LARGER
2860
2861 - not is a condition when type is MAILIMAP_SEARCH_KEY_NOT
2862
2863 - or1 is a condition when type is MAILIMAP_SEARCH_KEY_OR
2864
2865 - or2 is a condition when type is MAILIMAP_SEARCH_KEY_OR
2866
2867 - sentbefore is a date when type is MAILIMAP_SEARCH_KEY_SENTBEFORE
2868
2869 - senton is a date when type is MAILIMAP_SEARCH_KEY_SENTON
2870
2871 - sentsince is a date when type is MAILIMAP_SEARCH_KEY_SENTSINCE
2872
2873 - smaller is a size when type is MAILIMAP_SEARCH_KEY_SMALLER
2874
2875 - uid is a set of messages when type is MAILIMAP_SEARCH_KEY_UID
2876
2877 - set is a set of messages when type is MAILIMAP_SEARCH_KEY_SET
2878
2879 - multiple is a set of message when type is MAILIMAP_SEARCH_KEY_MULTIPLE
2880*/
2881
2882struct mailimap_search_key {
2883 int sk_type;
2884 union {
2885 char * sk_bcc;
2886 struct mailimap_date * sk_before;
2887 char * sk_body;
2888 char * sk_cc;
2889 char * sk_from;
2890 char * sk_keyword;
2891 struct mailimap_date * sk_on;
2892 struct mailimap_date * sk_since;
2893 char * sk_subject;
2894 char * sk_text;
2895 char * sk_to;
2896 char * sk_unkeyword;
2897 struct {
2898 char * sk_header_name;
2899 char * sk_header_value;
2900 } sk_header;
2901 uint32_t sk_larger;
2902 struct mailimap_search_key * sk_not;
2903 struct {
2904 struct mailimap_search_key * sk_or1;
2905 struct mailimap_search_key * sk_or2;
2906 } sk_or;
2907 struct mailimap_date * sk_sentbefore;
2908 struct mailimap_date * sk_senton;
2909 struct mailimap_date * sk_sentsince;
2910 uint32_t sk_smaller;
2911 struct mailimap_set * sk_uid;
2912 struct mailimap_set * sk_set;
2913 clist * sk_multiple; /* list of (struct mailimap_search_key *) */
2914 } sk_data;
2915};
2916
2917struct mailimap_search_key *
2918mailimap_search_key_new(int sk_type,
2919 char * sk_bcc, struct mailimap_date * sk_before, char * sk_body,
2920 char * sk_cc, char * sk_from, char * sk_keyword,
2921 struct mailimap_date * sk_on, struct mailimap_date * sk_since,
2922 char * sk_subject, char * sk_text, char * sk_to,
2923 char * sk_unkeyword, char * sk_header_name,
2924 char * sk_header_value, uint32_t sk_larger,
2925 struct mailimap_search_key * sk_not,
2926 struct mailimap_search_key * sk_or1,
2927 struct mailimap_search_key * sk_or2,
2928 struct mailimap_date * sk_sentbefore,
2929 struct mailimap_date * sk_senton,
2930 struct mailimap_date * sk_sentsince,
2931 uint32_t sk_smaller, struct mailimap_set * sk_uid,
2932 struct mailimap_set * sk_set, clist * sk_multiple);
2933
2934
2935void mailimap_search_key_free(struct mailimap_search_key * key);
2936
2937
2938/*
2939 mailimap_status_att_list is a list of mailbox STATUS request type
2940
2941 - list is a list of mailbox STATUS request type
2942 (value of elements in the list can be MAILIMAP_STATUS_ATT_MESSAGES,
2943 MAILIMAP_STATUS_ATT_RECENT, MAILIMAP_STATUS_ATT_UIDNEXT,
2944 MAILIMAP_STATUS_ATT_UIDVALIDITY or MAILIMAP_STATUS_ATT_UNSEEN),
2945 each element should be allocated with malloc()
2946*/
2947
2948struct mailimap_status_att_list {
2949 clist * att_list; /* list of (uint32_t *) */
2950};
2951
2952struct mailimap_status_att_list *
2953mailimap_status_att_list_new(clist * att_list);
2954
2955void mailimap_status_att_list_free(struct mailimap_status_att_list *
2956 status_att_list);
2957
2958
2959
2960
2961/* internal use functions */
2962
2963
2964uint32_t * mailimap_number_alloc_new(uint32_t number);
2965
2966void mailimap_number_alloc_free(uint32_t * pnumber);
2967
2968
2969void mailimap_addr_host_free(char * addr_host);
2970
2971void mailimap_addr_mailbox_free(char * addr_mailbox);
2972
2973void mailimap_addr_adl_free(char * addr_adl);
2974
2975void mailimap_addr_name_free(char * addr_name);
2976
2977void mailimap_astring_free(char * astring);
2978
2979void mailimap_atom_free(char * atom);
2980
2981void mailimap_auth_type_free(char * auth_type);
2982
2983void mailimap_base64_free(char * base64);
2984
2985void mailimap_body_fld_desc_free(char * body_fld_desc);
2986
2987void mailimap_body_fld_id_free(char * body_fld_id);
2988
2989void mailimap_body_fld_md5_free(char * body_fld_md5);
2990
2991void mailimap_env_date_free(char * date);
2992
2993void mailimap_env_in_reply_to_free(char * in_reply_to);
2994
2995void mailimap_env_message_id_free(char * message_id);
2996
2997void mailimap_env_subject_free(char * subject);
2998
2999void mailimap_flag_extension_free(char * flag_extension);
3000
3001void mailimap_flag_keyword_free(char * flag_keyword);
3002
3003void
3004mailimap_header_fld_name_free(char * header_fld_name);
3005
3006void mailimap_literal_free(char * literal);
3007
3008void mailimap_mailbox_free(char * mailbox);
3009
3010void
3011mailimap_mailbox_data_search_free(clist * data_search);
3012
3013void mailimap_media_subtype_free(char * media_subtype);
3014
3015void mailimap_media_text_free(char * media_text);
3016
3017void mailimap_msg_att_envelope_free(struct mailimap_envelope * env);
3018
3019void
3020mailimap_msg_att_internaldate_free(struct mailimap_date_time * date_time);
3021
3022void
3023mailimap_msg_att_rfc822_free(char * str);
3024
3025void
3026mailimap_msg_att_rfc822_header_free(char * str);
3027
3028void
3029mailimap_msg_att_rfc822_text_free(char * str);
3030
3031void
3032mailimap_msg_att_body_free(struct mailimap_body * body);
3033
3034void
3035mailimap_msg_att_bodystructure_free(struct mailimap_body * body);
3036
3037void mailimap_nstring_free(char * str);
3038
3039void
3040mailimap_string_free(char * str);
3041
3042void mailimap_tag_free(char * tag);
3043
3044void mailimap_text_free(char * text);
3045
3046
3047
3048
3049
3050/* IMAP connection */
3051
3052/* this is the state of the IMAP connection */
3053
3054enum {
3055 MAILIMAP_STATE_DISCONNECTED,
3056 MAILIMAP_STATE_NON_AUTHENTICATED,
3057 MAILIMAP_STATE_AUTHENTICATED,
3058 MAILIMAP_STATE_SELECTED,
3059 MAILIMAP_STATE_LOGOUT
3060};
3061
3062/*
3063 mailimap is an IMAP connection
3064
3065 - response is a human readable message returned with a reponse,
3066 must be accessed read-only
3067
3068 - stream is the connection with the IMAP server
3069
3070 - stream_buffer is the buffer where the data to parse are stored
3071
3072 - state is the state of IMAP connection
3073
3074 - tag is the current tag being used in IMAP connection
3075
3076 - response_buffer is the buffer for response messages
3077
3078 - connection_info is the information returned in response
3079 for the last command about the connection
3080
3081 - selection_info is the information returned in response
3082 for the last command about the current selected mailbox
3083
3084 - response_info is the other information returned in response
3085 for the last command
3086*/
3087
3088struct mailimap {
3089 char * imap_response;
3090
3091 /* internals */
3092 mailstream * imap_stream;
3093
3094 size_t imap_progr_rate;
3095 progress_function * imap_progr_fun;
3096
3097 MMAPString * imap_stream_buffer;
3098 MMAPString * imap_response_buffer;
3099
3100 int imap_state;
3101 int imap_tag;
3102
3103 struct mailimap_connection_info * imap_connection_info;
3104 struct mailimap_selection_info * imap_selection_info;
3105 struct mailimap_response_info * imap_response_info;
3106};
3107
3108typedef struct mailimap mailimap;
3109
3110
3111/*
3112 mailimap_connection_info is the information about the connection
3113
3114 - capability is the list of capability of the IMAP server
3115*/
3116
3117struct mailimap_connection_info {
3118 struct mailimap_capability_data * imap_capability;
3119};
3120
3121struct mailimap_connection_info *
3122mailimap_connection_info_new(void);
3123
3124void
3125mailimap_connection_info_free(struct mailimap_connection_info * conn_info);
3126
3127
3128/* this is the type of mailbox access */
3129
3130enum {
3131 MAILIMAP_MAILBOX_READONLY,
3132 MAILIMAP_MAILBOX_READWRITE
3133};
3134
3135/*
3136 mailimap_selection_info is information about the current selected mailbox
3137
3138 - perm_flags is a list of flags that can be changed permanently on the
3139 messages of the mailbox
3140
3141 - perm is the access on the mailbox, value can be
3142 MAILIMAP_MAILBOX_READONLY or MAILIMAP_MAILBOX_READWRITE
3143
3144 - uidnext is the next unique identifier
3145
3146 - uidvalidity is the unique identifiers validity
3147
3148 - first_unseen is the number of the first unseen message
3149
3150 - flags is a list of flags that can be used on the messages of
3151 the mailbox
3152
3153 - exists is the number of messages in the mailbox
3154
3155 - recent is the number of recent messages in the mailbox
3156
3157 - unseen is the number of unseen messages in the mailbox
3158*/
3159
3160struct mailimap_selection_info {
3161 clist * sel_perm_flags; /* list of (struct flag_perm *) */
3162 int sel_perm;
3163 uint32_t sel_uidnext;
3164 uint32_t sel_uidvalidity;
3165 uint32_t sel_first_unseen;
3166 struct mailimap_flag_list * sel_flags;
3167 uint32_t sel_exists;
3168 uint32_t sel_recent;
3169 uint32_t sel_unseen;
3170};
3171
3172struct mailimap_selection_info *
3173mailimap_selection_info_new(void);
3174
3175void
3176mailimap_selection_info_free(struct mailimap_selection_info * sel_info);
3177
3178
3179/*
3180 mailimap_response_info is the other information returned in the
3181 response for a command
3182
3183 - alert is the human readable text returned with ALERT response
3184
3185 - parse is the human readable text returned with PARSE response
3186
3187 - badcharset is a list of charset returned with a BADCHARSET response
3188
3189 - trycreate is set to 1 if a trycreate response was returned
3190
3191 - mailbox_list is a list of mailboxes
3192
3193 - mailbox_lsub is a list of subscribed mailboxes
3194
3195 - search_result is a list of message numbers or unique identifiers
3196
3197 - status is a STATUS response
3198
3199 - expunged is a list of message numbers
3200
3201 - fetch_list is a list of fetch response
3202*/
3203
3204struct mailimap_response_info {
3205 char * rsp_alert;
3206 char * rsp_parse;
3207 clist * rsp_badcharset; /* list of (char *) */
3208 int rsp_trycreate;
3209 clist * rsp_mailbox_list; /* list of (struct mailimap_mailbox_list *) */
3210 clist * rsp_mailbox_lsub; /* list of (struct mailimap_mailbox_list *) */
3211 clist * rsp_search_result; /* list of (uint32_t *) */
3212 struct mailimap_mailbox_data_status * rsp_status;
3213 clist * rsp_expunged; /* list of (uint32_t 32 *) */
3214 clist * rsp_fetch_list; /* list of (struct mailimap_msg_att *) */
3215};
3216
3217struct mailimap_response_info *
3218mailimap_response_info_new(void);
3219
3220void
3221mailimap_response_info_free(struct mailimap_response_info * resp_info);
3222
3223
3224/* these are the possible returned error codes */
3225
3226enum {
3227 MAILIMAP_NO_ERROR = 0,
3228 MAILIMAP_NO_ERROR_AUTHENTICATED = 1,
3229 MAILIMAP_NO_ERROR_NON_AUTHENTICATED = 2,
3230 MAILIMAP_ERROR_BAD_STATE,
3231 MAILIMAP_ERROR_STREAM,
3232 MAILIMAP_ERROR_PARSE,
3233 MAILIMAP_ERROR_CONNECTION_REFUSED,
3234 MAILIMAP_ERROR_MEMORY,
3235 MAILIMAP_ERROR_FATAL,
3236 MAILIMAP_ERROR_PROTOCOL,
3237 MAILIMAP_ERROR_DONT_ACCEPT_CONNECTION,
3238 MAILIMAP_ERROR_APPEND,
3239 MAILIMAP_ERROR_NOOP,
3240 MAILIMAP_ERROR_LOGOUT,
3241 MAILIMAP_ERROR_CAPABILITY,
3242 MAILIMAP_ERROR_CHECK,
3243 MAILIMAP_ERROR_CLOSE,
3244 MAILIMAP_ERROR_EXPUNGE,
3245 MAILIMAP_ERROR_COPY,
3246 MAILIMAP_ERROR_UID_COPY,
3247 MAILIMAP_ERROR_CREATE,
3248 MAILIMAP_ERROR_DELETE,
3249 MAILIMAP_ERROR_EXAMINE,
3250 MAILIMAP_ERROR_FETCH,
3251 MAILIMAP_ERROR_UID_FETCH,
3252 MAILIMAP_ERROR_LIST,
3253 MAILIMAP_ERROR_LOGIN,
3254 MAILIMAP_ERROR_LSUB,
3255 MAILIMAP_ERROR_RENAME,
3256 MAILIMAP_ERROR_SEARCH,
3257 MAILIMAP_ERROR_UID_SEARCH,
3258 MAILIMAP_ERROR_SELECT,
3259 MAILIMAP_ERROR_STATUS,
3260 MAILIMAP_ERROR_STORE,
3261 MAILIMAP_ERROR_UID_STORE,
3262 MAILIMAP_ERROR_SUBSCRIBE,
3263 MAILIMAP_ERROR_UNSUBSCRIBE,
3264 MAILIMAP_ERROR_STARTTLS,
3265 MAILIMAP_ERROR_INVAL,
3266};
3267
3268
3269#ifdef __cplusplus
3270}
3271#endif
3272
3273#endif
3274
diff --git a/kmicromail/libetpan/include/libetpan/mailimap_types_helper.h b/kmicromail/libetpan/include/libetpan/mailimap_types_helper.h
new file mode 100644
index 0000000..bb0bb99
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimap_types_helper.h
@@ -0,0 +1,758 @@
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 MAILIMAP_TYPES_HELPER_H
37
38#define MAILIMAP_TYPES_HELPER_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailimap_types.h>
45
46/*
47 IMPORTANT NOTE:
48
49 All allocation functions will take as argument allocated data
50 and will store these data in the structure they will allocate.
51 Data should be persistant during all the use of the structure
52 and will be freed by the free function of the structure
53
54 allocation functions will return NULL on failure
55*/
56
57/*
58 this function creates a new set item with a single message
59 given by index
60*/
61
62struct mailimap_set_item * mailimap_set_item_new_single(uint32_t index);
63
64/*
65 this function creates a new set with one set item
66 */
67
68struct mailimap_set *
69mailimap_set_new_single_item(struct mailimap_set_item * item);
70
71/*
72 this function creates a set with a single interval
73*/
74
75struct mailimap_set * mailimap_set_new_interval(uint32_t first, uint32_t last);
76
77/*
78 this function creates a set with a single message
79*/
80
81struct mailimap_set * mailimap_set_new_single(uint32_t index);
82
83/*
84 this function creates an empty set of messages
85*/
86
87struct mailimap_set * mailimap_set_new_empty(void);
88
89/*
90 this function adds a set item to the set of messages
91
92 @return MAILIMAP_NO_ERROR will be returned on success,
93 other code will be returned otherwise
94*/
95
96int mailimap_set_add(struct mailimap_set * set,
97 struct mailimap_set_item * set_item);
98
99/*
100 this function adds an interval to the set
101
102 @return MAILIMAP_NO_ERROR will be returned on success,
103 other code will be returned otherwise
104*/
105
106int mailimap_set_add_interval(struct mailimap_set * set,
107 uint32_t first, uint32_t last);
108
109/*
110 this function adds a single message to the set
111
112 @return MAILIMAP_NO_ERROR will be returned on success,
113 other code will be returned otherwise
114*/
115
116int mailimap_set_add_single(struct mailimap_set * set,
117 uint32_t index);
118
119/*
120 this function creates a mailimap_section structure to request
121 the header of a message
122*/
123
124struct mailimap_section * mailimap_section_new_header(void);
125
126/*
127 this functions creates a mailimap_section structure to describe
128 a list of headers
129*/
130
131struct mailimap_section *
132mailimap_section_new_header_fields(struct mailimap_header_list * header_list);
133
134/*
135 this functions creates a mailimap_section structure to describe headers
136 other than those given
137*/
138
139struct mailimap_section *
140mailimap_section_new_header_fields_not(struct mailimap_header_list * header_list);
141
142/*
143 this function creates a mailimap_section structure to describe the
144 text of a message
145 */
146
147struct mailimap_section * mailimap_section_new_text(void);
148
149/*
150 this function creates a mailimap_section structure to describe the
151 content of a MIME part
152*/
153
154struct mailimap_section *
155mailimap_section_new_part(struct mailimap_section_part * part);
156
157/*
158 this function creates a mailimap_section structure to describe the
159 MIME fields of a MIME part
160*/
161
162struct mailimap_section *
163mailimap_section_new_part_mime(struct mailimap_section_part * part);
164
165/*
166 this function creates a mailimap_section structure to describe the
167 headers of a MIME part if the MIME type is a message/rfc822
168*/
169
170struct mailimap_section *
171mailimap_section_new_part_header(struct mailimap_section_part * part);
172
173/*
174 this function creates a mailimap_section structure to describe
175 a list of headers of a MIME part if the MIME type is a message/rfc822
176*/
177
178struct mailimap_section *
179mailimap_section_new_part_header_fields(struct mailimap_section_part *
180 part,
181 struct mailimap_header_list *
182 header_list);
183
184/*
185 this function creates a mailimap_section structure to describe
186 headers of a MIME part other than those given if the MIME type
187 is a message/rfc822
188*/
189
190struct mailimap_section *
191mailimap_section_new_part_header_fields_not(struct mailimap_section_part
192 * part,
193 struct mailimap_header_list
194 * header_list);
195
196/*
197 this function creates a mailimap_section structure to describe
198 text part of message if the MIME type is a message/rfc822
199*/
200
201struct mailimap_section *
202mailimap_section_new_part_text(struct mailimap_section_part * part);
203
204
205/*
206 this function creates a mailimap_fetch_att structure to request
207 envelope of a message
208*/
209
210struct mailimap_fetch_att *
211mailimap_fetch_att_new_envelope(void);
212
213
214/*
215 this function creates a mailimap_fetch_att structure to request
216 flags of a message
217*/
218
219struct mailimap_fetch_att *
220mailimap_fetch_att_new_flags(void);
221
222/*
223 this function creates a mailimap_fetch_att structure to request
224 internal date of a message
225*/
226
227struct mailimap_fetch_att *
228mailimap_fetch_att_new_internaldate(void);
229
230
231/*
232 this function creates a mailimap_fetch_att structure to request
233 text part of a message
234*/
235
236struct mailimap_fetch_att *
237mailimap_fetch_att_new_rfc822(void);
238
239
240/*
241 this function creates a mailimap_fetch_att structure to request
242 header of a message
243*/
244
245struct mailimap_fetch_att *
246mailimap_fetch_att_new_rfc822_header(void);
247
248/*
249 this function creates a mailimap_fetch_att structure to request
250 size of a message
251*/
252
253struct mailimap_fetch_att *
254mailimap_fetch_att_new_rfc822_size(void);
255
256/*
257 this function creates a mailimap_fetch_att structure to request
258 envelope of a message
259*/
260
261struct mailimap_fetch_att *
262mailimap_fetch_att_new_rfc822_text(void);
263
264/*
265 this function creates a mailimap_fetch_att structure to request
266 the MIME structure of a message
267*/
268
269struct mailimap_fetch_att *
270mailimap_fetch_att_new_body(void);
271
272/*
273 this function creates a mailimap_fetch_att structure to request
274 the MIME structure of a message and additional MIME information
275*/
276
277struct mailimap_fetch_att *
278mailimap_fetch_att_new_bodystructure(void);
279
280/*
281 this function creates a mailimap_fetch_att structure to request
282 unique identifier of a message
283*/
284
285struct mailimap_fetch_att *
286mailimap_fetch_att_new_uid(void);
287
288/*
289 this function creates a mailimap_fetch_att structure to request
290 a given section of a message
291*/
292
293struct mailimap_fetch_att *
294mailimap_fetch_att_new_body_section(struct mailimap_section * section);
295
296/*
297 this function creates a mailimap_fetch_att structure to request
298 a given section of a message without marking it as read
299*/
300
301struct mailimap_fetch_att *
302mailimap_fetch_att_new_body_peek_section(struct mailimap_section * section);
303
304/*
305 this function creates a mailimap_fetch_att structure to request
306 a part of a section of a message
307*/
308
309struct mailimap_fetch_att *
310mailimap_fetch_att_new_body_section_partial(struct mailimap_section * section,
311 uint32_t offset, uint32_t size);
312
313/*
314 this function creates a mailimap_fetch_att structure to request
315 a part of a section of a message without marking it as read
316*/
317
318struct mailimap_fetch_att *
319mailimap_fetch_att_new_body_peek_section_partial(struct mailimap_section * section,
320 uint32_t offset, uint32_t size);
321
322/*
323 this function creates a mailimap_fetch_type structure to request
324 (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE) of a message
325*/
326
327struct mailimap_fetch_type *
328mailimap_fetch_type_new_all(void);
329
330/*
331 this function creates a mailimap_fetch_type structure to request
332 (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY)
333*/
334
335struct mailimap_fetch_type *
336mailimap_fetch_type_new_full(void);
337
338/*
339 this function creates a mailimap_fetch_type structure to request
340 (FLAGS INTERNALDATE RFC822.SIZE)
341*/
342
343struct mailimap_fetch_type *
344mailimap_fetch_type_new_fast(void);
345
346/*
347 this function creates a mailimap_fetch_type structure to request
348 the given fetch attribute
349*/
350
351struct mailimap_fetch_type *
352mailimap_fetch_type_new_fetch_att(struct mailimap_fetch_att * fetch_att);
353
354/*
355 this function creates a mailimap_fetch_type structure to request
356 the list of fetch attributes
357*/
358
359struct mailimap_fetch_type *
360mailimap_fetch_type_new_fetch_att_list(clist * fetch_att_list);
361
362/*
363 this function creates a mailimap_fetch_type structure
364*/
365
366struct mailimap_fetch_type *
367mailimap_fetch_type_new_fetch_att_list_empty(void);
368
369/*
370 this function adds a given fetch attribute to the mailimap_fetch
371 structure
372
373 @return MAILIMAP_NO_ERROR will be returned on success,
374 other code will be returned otherwise
375*/
376
377int
378mailimap_fetch_type_new_fetch_att_list_add(struct mailimap_fetch_type *
379 fetch_type,
380 struct mailimap_fetch_att *
381 fetch_att);
382
383/*
384 this function creates a store attribute to set the given flags
385*/
386
387struct mailimap_store_att_flags *
388mailimap_store_att_flags_new_set_flags(struct mailimap_flag_list * flags);
389
390/*
391 this function creates a store attribute to silently set the given flags
392*/
393
394struct mailimap_store_att_flags *
395mailimap_store_att_flags_new_set_flags_silent(struct mailimap_flag_list *
396 flags);
397
398/*
399 this function creates a store attribute to add the given flags
400*/
401
402struct mailimap_store_att_flags *
403mailimap_store_att_flags_new_add_flags(struct mailimap_flag_list * flags);
404
405/*
406 this function creates a store attribute to add silently the given flags
407*/
408
409struct mailimap_store_att_flags *
410mailimap_store_att_flags_new_add_flags_silent(struct mailimap_flag_list *
411 flags);
412
413/*
414 this function creates a store attribute to remove the given flags
415*/
416
417struct mailimap_store_att_flags *
418mailimap_store_att_flags_new_remove_flags(struct mailimap_flag_list * flags);
419
420/*
421 this function creates a store attribute to remove silently the given flags
422*/
423
424struct mailimap_store_att_flags *
425mailimap_store_att_flags_new_remove_flags_silent(struct mailimap_flag_list *
426 flags);
427
428
429/*
430 this function creates a condition structure to match all messages
431*/
432
433struct mailimap_search_key *
434mailimap_search_key_new_all(void);
435
436/*
437 this function creates a condition structure to match messages with Bcc field
438
439 @param bcc this is the content of Bcc to match, it should be allocated
440 with malloc()
441*/
442
443struct mailimap_search_key *
444mailimap_search_key_new_bcc(char * sk_bcc);
445
446/*
447 this function creates a condition structure to match messages with
448 internal date
449*/
450
451struct mailimap_search_key *
452mailimap_search_key_new_before(struct mailimap_date * sk_before);
453
454/*
455 this function creates a condition structure to match messages with
456 message content
457
458 @param body this is the content of the message to match, it should
459 be allocated with malloc()
460*/
461
462struct mailimap_search_key *
463mailimap_search_key_new_body(char * sk_body);
464
465/*
466 this function creates a condition structure to match messages with
467 Cc field
468
469
470 @param cc this is the content of Cc to match, it should be allocated
471 with malloc()
472*/
473
474struct mailimap_search_key *
475mailimap_search_key_new_cc(char * sk_cc);
476
477/*
478 this function creates a condition structure to match messages with
479 From field
480
481 @param from this is the content of From to match, it should be allocated
482 with malloc()
483*/
484
485struct mailimap_search_key *
486mailimap_search_key_new_from(char * sk_from);
487
488/*
489 this function creates a condition structure to match messages with
490 a flag given by keyword
491*/
492
493struct mailimap_search_key *
494mailimap_search_key_new_keyword(char * sk_keyword);
495
496/*
497 this function creates a condition structure to match messages with
498 internal date
499*/
500
501struct mailimap_search_key *
502mailimap_search_key_new_on(struct mailimap_date * sk_on);
503
504/*
505 this function creates a condition structure to match messages with
506 internal date
507*/
508
509struct mailimap_search_key *
510mailimap_search_key_new_since(struct mailimap_date * sk_since);
511
512/*
513 this function creates a condition structure to match messages with
514 Subject field
515
516 @param subject this is the content of Subject to match, it should
517 be allocated with malloc()
518*/
519
520struct mailimap_search_key *
521mailimap_search_key_new_subject(char * sk_subject);
522
523/*
524 this function creates a condition structure to match messages with
525 message text part
526
527 @param text this is the message text to match, it should
528 be allocated with malloc()
529*/
530
531struct mailimap_search_key *
532mailimap_search_key_new_text(char * sk_text);
533
534/*
535 this function creates a condition structure to match messages with
536 To field
537
538 @param to this is the content of To to match, it should be allocated
539 with malloc()
540*/
541
542struct mailimap_search_key *
543mailimap_search_key_new_to(char * sk_to);
544
545/*
546 this function creates a condition structure to match messages with
547 no a flag given by unkeyword
548*/
549
550struct mailimap_search_key *
551mailimap_search_key_new_unkeyword(char * sk_unkeyword);
552
553/*
554 this function creates a condition structure to match messages with
555 the given field
556
557 @param header_name this is the name of the field to match, it
558 should be allocated with malloc()
559
560 @param header_value this is the content, it should be allocated
561 with malloc()
562*/
563
564struct mailimap_search_key *
565mailimap_search_key_new_header(char * sk_header_name, char * sk_header_value);
566
567
568/*
569 this function creates a condition structure to match messages with size
570*/
571
572struct mailimap_search_key *
573mailimap_search_key_new_larger(uint32_t sk_larger);
574
575/*
576 this function creates a condition structure to match messages that
577 do not match the given condition
578*/
579
580struct mailimap_search_key *
581mailimap_search_key_new_not(struct mailimap_search_key * sk_not);
582
583/*
584 this function creates a condition structure to match messages that
585 match one of the given conditions
586*/
587
588struct mailimap_search_key *
589mailimap_search_key_new_or(struct mailimap_search_key * sk_or1,
590 struct mailimap_search_key * sk_or2);
591
592/*
593 this function creates a condition structure to match messages
594 with Date field
595*/
596
597struct mailimap_search_key *
598mailimap_search_key_new_sentbefore(struct mailimap_date * sk_sentbefore);
599
600/*
601 this function creates a condition structure to match messages
602 with Date field
603*/
604
605struct mailimap_search_key *
606mailimap_search_key_new_senton(struct mailimap_date * sk_senton);
607
608/*
609 this function creates a condition structure to match messages
610 with Date field
611*/
612
613struct mailimap_search_key *
614mailimap_search_key_new_sentsince(struct mailimap_date * sk_sentsince);
615
616/*
617 this function creates a condition structure to match messages with size
618*/
619
620struct mailimap_search_key *
621mailimap_search_key_new_smaller(uint32_t sk_smaller);
622
623/*
624 this function creates a condition structure to match messages with unique
625 identifier
626*/
627
628struct mailimap_search_key *
629mailimap_search_key_new_uid(struct mailimap_set * sk_uid);
630
631/*
632 this function creates a condition structure to match messages with number
633 or unique identifier (depending whether SEARCH or UID SEARCH is used)
634*/
635
636struct mailimap_search_key *
637mailimap_search_key_new_set(struct mailimap_set * sk_set);
638
639/*
640 this function creates a condition structure to match messages that match
641 all the conditions given in the list
642*/
643
644struct mailimap_search_key *
645mailimap_search_key_new_multiple(clist * sk_multiple);
646
647
648/*
649 same as previous but the list is empty
650*/
651
652struct mailimap_search_key *
653mailimap_search_key_new_multiple_empty(void);
654
655/*
656 this function adds a condition to the condition list
657
658 @return MAILIMAP_NO_ERROR will be returned on success,
659 other code will be returned otherwise
660*/
661
662int
663mailimap_search_key_multiple_add(struct mailimap_search_key * keys,
664 struct mailimap_search_key * key_item);
665
666
667/*
668 this function creates an empty list of flags
669*/
670
671struct mailimap_flag_list *
672mailimap_flag_list_new_empty(void);
673
674/*
675 this function adds a flag to the list of flags
676
677 @return MAILIMAP_NO_ERROR will be returned on success,
678 other code will be returned otherwise
679*/
680
681int mailimap_flag_list_add(struct mailimap_flag_list * flag_list,
682 struct mailimap_flag * f);
683
684/*
685 this function creates a \Answered flag
686*/
687
688struct mailimap_flag * mailimap_flag_new_answered(void);
689
690/*
691 this function creates a \Flagged flag
692*/
693
694struct mailimap_flag * mailimap_flag_new_flagged(void);
695
696/*
697 this function creates a \Deleted flag
698*/
699
700struct mailimap_flag * mailimap_flag_new_deleted(void);
701
702/*
703 this function creates a \Seen flag
704*/
705
706struct mailimap_flag * mailimap_flag_new_seen(void);
707
708/*
709 this function creates a \Draft flag
710*/
711
712struct mailimap_flag * mailimap_flag_new_draft(void);
713
714/*
715 this function creates a keyword flag
716
717 @param flag_keyword this should be allocated with malloc()
718*/
719
720struct mailimap_flag * mailimap_flag_new_flag_keyword(char * flag_keyword);
721
722
723/*
724 this function creates an extension flag
725
726 @param flag_extension this should be allocated with malloc()
727*/
728
729struct mailimap_flag * mailimap_flag_new_flag_extension(char * flag_extension);
730
731/*
732 this function creates an empty list of status attributes
733*/
734
735struct mailimap_status_att_list * mailimap_status_att_list_new_empty(void);
736
737/*
738 this function adds status attributes to the list
739
740 @return MAILIMAP_NO_ERROR will be returned on success,
741 other code will be returned otherwise
742*/
743
744int
745mailimap_status_att_list_add(struct mailimap_status_att_list * sa_list,
746 int status_att);
747
748/* return mailimap_section_part from a given mailimap_body */
749
750int mailimap_get_section_part_from_body(struct mailimap_body * root_part,
751 struct mailimap_body * part,
752 struct mailimap_section_part ** result);
753
754#ifdef __cplusplus
755}
756#endif
757
758#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimf.h b/kmicromail/libetpan/include/libetpan/mailimf.h
new file mode 100644
index 0000000..3248e73
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimf.h
@@ -0,0 +1,345 @@
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 MAILIMF_H
37
38#define MAILIMF_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailimf_types.h>
45#include <libetpan/mailimf_write.h>
46#include <libetpan/mailimf_types_helper.h>
47
48#include <inttypes.h>
49#include <sys/types.h>
50
51/*
52 mailimf_message_parse will parse the given message
53
54 @param message this is a string containing the message content
55 @param length this is the size of the given string
56 @param index this is a pointer to the start of the message in
57 the given string, (* index) is modified to point at the end
58 of the parsed data
59 @param result the result of the parse operation is stored in
60 (* result)
61
62 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
63*/
64
65int mailimf_message_parse(const char * message, size_t length,
66 size_t * index,
67 struct mailimf_message ** result);
68
69/*
70 mailimf_body_parse will parse the given text part of a message
71
72 @param message this is a string containing the message text part
73 @param length this is the size of the given string
74 @param index this is a pointer to the start of the message text part in
75 the given string, (* index) is modified to point at the end
76 of the parsed data
77 @param result the result of the parse operation is stored in
78 (* result)
79
80 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
81*/
82
83int mailimf_body_parse(const char * message, size_t length,
84 size_t * index,
85 struct mailimf_body ** result);
86
87/*
88 mailimf_fields_parse will parse the given header fields
89
90 @param message this is a string containing the header fields
91 @param length this is the size of the given string
92 @param index this is a pointer to the start of the header fields in
93 the given string, (* index) is modified to point at the end
94 of the parsed data
95 @param result the result of the parse operation is stored in
96 (* result)
97
98 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
99*/
100
101int mailimf_fields_parse(const char * message, size_t length,
102 size_t * index,
103 struct mailimf_fields ** result);
104
105/*
106 mailimf_mailbox_list_parse will parse the given mailbox list
107
108 @param message this is a string containing the mailbox list
109 @param length this is the size of the given string
110 @param index this is a pointer to the start of the mailbox list in
111 the given string, (* index) is modified to point at the end
112 of the parsed data
113 @param result the result of the parse operation is stored in
114 (* result)
115
116 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
117*/
118
119int
120mailimf_mailbox_list_parse(const char * message, size_t length,
121 size_t * index,
122 struct mailimf_mailbox_list ** result);
123
124/*
125 mailimf_address_list_parse will parse the given address list
126
127 @param message this is a string containing the address list
128 @param length this is the size of the given string
129 @param index this is a pointer to the start of the address list in
130 the given string, (* index) is modified to point at the end
131 of the parsed data
132 @param result the result of the parse operation is stored in
133 (* result)
134
135 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
136*/
137
138int
139mailimf_address_list_parse(const char * message, size_t length,
140 size_t * index,
141 struct mailimf_address_list ** result);
142
143/*
144 mailimf_address_parse will parse the given address
145
146 @param message this is a string containing the address
147 @param length this is the size of the given string
148 @param index this is a pointer to the start of the address in
149 the given string, (* index) is modified to point at the end
150 of the parsed data
151 @param result the result of the parse operation is stored in
152 (* result)
153
154 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
155*/
156
157int mailimf_address_parse(const char * message, size_t length,
158 size_t * index,
159 struct mailimf_address ** result);
160
161/*
162 mailimf_mailbox_parse will parse the given address
163
164 @param message this is a string containing the mailbox
165 @param length this is the size of the given string
166 @param index this is a pointer to the start of the mailbox in
167 the given string, (* index) is modified to point at the end
168 of the parsed data
169 @param result the result of the parse operation is stored in
170 (* result)
171
172 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
173*/
174
175int mailimf_mailbox_parse(const char * message, size_t length,
176 size_t * index,
177 struct mailimf_mailbox ** result);
178
179/*
180 mailimf_date_time_parse will parse the given RFC 2822 date
181
182 @param message this is a string containing the date
183 @param length this is the size of the given string
184 @param index this is a pointer to the start of the date in
185 the given string, (* index) is modified to point at the end
186 of the parsed data
187 @param result the result of the parse operation is stored in
188 (* result)
189
190 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
191*/
192
193int mailimf_date_time_parse(const char * message, size_t length,
194 size_t * index,
195 struct mailimf_date_time ** result);
196
197/*
198 mailimf_envelope_fields_parse will parse the given fields (Date,
199 From, Sender, Reply-To, To, Cc, Bcc, Message-ID, In-Reply-To,
200 References and Subject)
201
202 @param message this is a string containing the header fields
203 @param length this is the size of the given string
204 @param index this is a pointer to the start of the header fields in
205 the given string, (* index) is modified to point at the end
206 of the parsed data
207 @param result the result of the parse operation is stored in
208 (* result)
209
210 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
211*/
212
213int mailimf_envelope_fields_parse(const char * message, size_t length,
214 size_t * index,
215 struct mailimf_fields ** result);
216
217/*
218 mailimf_ignore_field_parse will skip the given field
219
220 @param message this is a string containing the header field
221 @param length this is the size of the given string
222 @param index this is a pointer to the start of the header field in
223 the given string, (* index) is modified to point at the end
224 of the parsed data
225
226 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
227*/
228
229
230int mailimf_ignore_field_parse(const char * message, size_t length,
231 size_t * index);
232
233/*
234 mailimf_envelope_fields will parse the given fields (Date,
235 From, Sender, Reply-To, To, Cc, Bcc, Message-ID, In-Reply-To,
236 References and Subject), other fields will be added as optional
237 fields.
238
239 @param message this is a string containing the header fields
240 @param length this is the size of the given string
241 @param index this is a pointer to the start of the header fields in
242 the given string, (* index) is modified to point at the end
243 of the parsed data
244 @param result the result of the parse operation is stored in
245 (* result)
246
247 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
248*/
249
250
251int
252mailimf_envelope_and_optional_fields_parse(const char * message, size_t length,
253 size_t * index,
254 struct mailimf_fields ** result);
255
256/*
257 mailimf_envelope_fields will parse the given fields as optional
258 fields.
259
260 @param message this is a string containing the header fields
261 @param length this is the size of the given string
262 @param index this is a pointer to the start of the header fields in
263 the given string, (* index) is modified to point at the end
264 of the parsed data
265 @param result the result of the parse operation is stored in
266 (* result)
267
268 @return MAILIMF_NO_ERROR on success, MAILIMF_ERROR_XXX on error
269*/
270
271int
272mailimf_optional_fields_parse(const char * message, size_t length,
273 size_t * index,
274 struct mailimf_fields ** result);
275
276
277/* internal use, exported for MIME */
278
279int mailimf_fws_parse(const char * message, size_t length, size_t * index);
280
281int mailimf_cfws_parse(const char * message, size_t length,
282 size_t * index);
283
284int mailimf_char_parse(const char * message, size_t length,
285 size_t * index, char token);
286
287int mailimf_unstrict_char_parse(const char * message, size_t length,
288 size_t * index, char token);
289
290int mailimf_crlf_parse(const char * message, size_t length, size_t * index);
291
292int
293mailimf_custom_string_parse(const char * message, size_t length,
294 size_t * index, char ** result,
295 int (* is_custom_char)(char));
296
297int
298mailimf_token_case_insensitive_len_parse(const char * message, size_t length,
299 size_t * index, char * token,
300 size_t token_length);
301
302#define mailimf_token_case_insensitive_parse(message, length, index, token) \
303 mailimf_token_case_insensitive_len_parse(message, length, index, token, \
304 sizeof(token) - 1)
305
306int mailimf_quoted_string_parse(const char * message, size_t length,
307 size_t * index, char ** result);
308
309int
310mailimf_number_parse(const char * message, size_t length,
311 size_t * index, uint32_t * result);
312
313int mailimf_msg_id_parse(const char * message, size_t length,
314 size_t * index,
315 char ** result);
316
317int mailimf_msg_id_list_parse(const char * message, size_t length,
318 size_t * index, clist ** result);
319
320int mailimf_word_parse(const char * message, size_t length,
321 size_t * index, char ** result);
322
323int mailimf_atom_parse(const char * message, size_t length,
324 size_t * index, char ** result);
325
326int mailimf_fws_atom_parse(const char * message, size_t length,
327 size_t * index, char ** result);
328
329int mailimf_fws_word_parse(const char * message, size_t length,
330 size_t * index, char ** result);
331
332int mailimf_fws_quoted_string_parse(const char * message, size_t length,
333 size_t * index, char ** result);
334
335/* exported for IMAP */
336
337int mailimf_references_parse(const char * message, size_t length,
338 size_t * index,
339 struct mailimf_references ** result);
340
341#ifdef __cplusplus
342}
343#endif
344
345#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimf_types.h b/kmicromail/libetpan/include/libetpan/mailimf_types.h
new file mode 100644
index 0000000..288feb6
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimf_types.h
@@ -0,0 +1,793 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001 - 2003 - 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/*
34 * $Id$
35 */
36
37#ifndef MAILIMF_TYPES_H
38
39#define MAILIMF_TYPES_H
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#include <libetpan/clist.h>
46#include <sys/types.h>
47
48/*
49 IMPORTANT NOTE:
50
51 All allocation functions will take as argument allocated data
52 and will store these data in the structure they will allocate.
53 Data should be persistant during all the use of the structure
54 and will be freed by the free function of the structure
55
56 allocation functions will return NULL on failure
57*/
58
59/*
60 mailimf_date_time is a date
61
62 - day is the day of month (1 to 31)
63
64 - month (1 to 12)
65
66 - year (4 digits)
67
68 - hour (0 to 23)
69
70 - min (0 to 59)
71
72 - sec (0 to 59)
73
74 - zone (this is the decimal value that we can read, for example:
75 for "-0200", the value is -200)
76*/
77
78struct mailimf_date_time {
79 int dt_day;
80 int dt_month;
81 int dt_year;
82 int dt_hour;
83 int dt_min;
84 int dt_sec;
85 int dt_zone;
86};
87
88struct mailimf_date_time *
89mailimf_date_time_new(int dt_day, int dt_month, int dt_year,
90 int dt_hour, int dt_min, int dt_sec, int dt_zone);
91
92void mailimf_date_time_free(struct mailimf_date_time * date_time);
93
94
95
96/* this is the type of address */
97
98enum {
99 MAILIMF_ADDRESS_ERROR, /* on parse error */
100 MAILIMF_ADDRESS_MAILBOX, /* if this is a mailbox (mailbox@domain) */
101 MAILIMF_ADDRESS_GROUP, /* if this is a group
102 (group_name: address1@domain1,
103 address2@domain2; ) */
104};
105
106/*
107 mailimf_address is an address
108
109 - type can be MAILIMF_ADDRESS_MAILBOX or MAILIMF_ADDRESS_GROUP
110
111 - mailbox is a mailbox if type is MAILIMF_ADDRESS_MAILBOX
112
113 - group is a group if type is MAILIMF_ADDRESS_GROUP
114*/
115
116struct mailimf_address {
117 int ad_type;
118 union {
119 struct mailimf_mailbox * ad_mailbox; /* can be NULL */
120 struct mailimf_group * ad_group; /* can be NULL */
121 } ad_data;
122};
123
124
125struct mailimf_address *
126mailimf_address_new(int ad_type, struct mailimf_mailbox * ad_mailbox,
127 struct mailimf_group * ad_group);
128
129void mailimf_address_free(struct mailimf_address * address);
130
131
132
133/*
134 mailimf_mailbox is a mailbox
135
136 - display_name is the name that will be displayed for this mailbox,
137 for example 'name' in '"name" <mailbox@domain>,
138 should be allocated with malloc()
139
140 - addr_spec is the mailbox, for example 'mailbox@domain'
141 in '"name" <mailbox@domain>, should be allocated with malloc()
142*/
143
144struct mailimf_mailbox {
145 char * mb_display_name; /* can be NULL */
146 char * mb_addr_spec; /* != NULL */
147};
148
149struct mailimf_mailbox *
150mailimf_mailbox_new(char * mb_display_name, char * mb_addr_spec);
151
152void mailimf_mailbox_free(struct mailimf_mailbox * mailbox);
153
154
155
156/*
157 mailimf_group is a group
158
159 - display_name is the name that will be displayed for this group,
160 for example 'group_name' in
161 'group_name: address1@domain1, address2@domain2;', should be allocated
162 with malloc()
163
164 - mb_list is a list of mailboxes
165*/
166
167struct mailimf_group {
168 char * grp_display_name; /* != NULL */
169 struct mailimf_mailbox_list * grp_mb_list; /* can be NULL */
170};
171
172struct mailimf_group *
173mailimf_group_new(char * grp_display_name,
174 struct mailimf_mailbox_list * grp_mb_list);
175
176void mailimf_group_free(struct mailimf_group * group);
177
178
179
180/*
181 mailimf_mailbox_list is a list of mailboxes
182
183 - list is a list of mailboxes
184*/
185
186struct mailimf_mailbox_list {
187 clist * mb_list; /* list of (struct mailimf_mailbox *), != NULL */
188};
189
190struct mailimf_mailbox_list *
191mailimf_mailbox_list_new(clist * mb_list);
192
193void mailimf_mailbox_list_free(struct mailimf_mailbox_list * mb_list);
194
195
196
197/*
198 mailimf_address_list is a list of addresses
199
200 - list is a list of addresses
201*/
202
203struct mailimf_address_list {
204 clist * ad_list; /* list of (struct mailimf_address *), != NULL */
205};
206
207struct mailimf_address_list *
208mailimf_address_list_new(clist * ad_list);
209
210void mailimf_address_list_free(struct mailimf_address_list * addr_list);
211
212
213
214
215
216/*
217 mailimf_body is the text part of a message
218
219 - text is the beginning of the text part, it is a substring
220 of an other string
221
222 - size is the size of the text part
223*/
224
225struct mailimf_body {
226 const char * bd_text; /* != NULL */
227 size_t bd_size;
228};
229
230struct mailimf_body * mailimf_body_new(const char * bd_text, size_t bd_size);
231
232void mailimf_body_free(struct mailimf_body * body);
233
234
235
236
237/*
238 mailimf_message is the content of the message
239
240 - msg_fields is the header fields of the message
241
242 - msg_body is the text part of the message
243*/
244
245struct mailimf_message {
246 struct mailimf_fields * msg_fields; /* != NULL */
247 struct mailimf_body * msg_body; /* != NULL */
248};
249
250struct mailimf_message *
251mailimf_message_new(struct mailimf_fields * msg_fields,
252 struct mailimf_body * msg_body);
253
254void mailimf_message_free(struct mailimf_message * message);
255
256
257
258
259/*
260 mailimf_fields is a list of header fields
261
262 - fld_list is a list of header fields
263*/
264
265struct mailimf_fields {
266 clist * fld_list; /* list of (struct mailimf_field *), != NULL */
267};
268
269struct mailimf_fields * mailimf_fields_new(clist * fld_list);
270
271void mailimf_fields_free(struct mailimf_fields * fields);
272
273
274
275/* this is a type of field */
276
277enum {
278 MAILIMF_FIELD_NONE, /* on parse error */
279 MAILIMF_FIELD_RETURN_PATH, /* Return-Path */
280 MAILIMF_FIELD_RESENT_DATE, /* Resent-Date */
281 MAILIMF_FIELD_RESENT_FROM, /* Resent-From */
282 MAILIMF_FIELD_RESENT_SENDER, /* Resent-Sender */
283 MAILIMF_FIELD_RESENT_TO, /* Resent-To */
284 MAILIMF_FIELD_RESENT_CC, /* Resent-Cc */
285 MAILIMF_FIELD_RESENT_BCC, /* Resent-Bcc */
286 MAILIMF_FIELD_RESENT_MSG_ID, /* Resent-Message-ID */
287 MAILIMF_FIELD_ORIG_DATE, /* Date */
288 MAILIMF_FIELD_FROM, /* From */
289 MAILIMF_FIELD_SENDER, /* Sender */
290 MAILIMF_FIELD_REPLY_TO, /* Reply-To */
291 MAILIMF_FIELD_TO, /* To */
292 MAILIMF_FIELD_CC, /* Cc */
293 MAILIMF_FIELD_BCC, /* Bcc */
294 MAILIMF_FIELD_MESSAGE_ID, /* Message-ID */
295 MAILIMF_FIELD_IN_REPLY_TO, /* In-Reply-To */
296 MAILIMF_FIELD_REFERENCES, /* References */
297 MAILIMF_FIELD_SUBJECT, /* Subject */
298 MAILIMF_FIELD_COMMENTS, /* Comments */
299 MAILIMF_FIELD_KEYWORDS, /* Keywords */
300 MAILIMF_FIELD_OPTIONAL_FIELD, /* other field */
301};
302
303/*
304 mailimf_field is a field
305
306 - fld_type is the type of the field
307
308 - fld_data.fld_return_path is the parsed content of the Return-Path
309 field if type is MAILIMF_FIELD_RETURN_PATH
310
311 - fld_data.fld_resent_date is the parsed content of the Resent-Date field
312 if type is MAILIMF_FIELD_RESENT_DATE
313
314 - fld_data.fld_resent_from is the parsed content of the Resent-From field
315
316 - fld_data.fld_resent_sender is the parsed content of the Resent-Sender field
317
318 - fld_data.fld_resent_to is the parsed content of the Resent-To field
319
320 - fld_data.fld_resent_cc is the parsed content of the Resent-Cc field
321
322 - fld_data.fld_resent_bcc is the parsed content of the Resent-Bcc field
323
324 - fld_data.fld_resent_msg_id is the parsed content of the Resent-Message-ID
325 field
326
327 - fld_data.fld_orig_date is the parsed content of the Date field
328
329 - fld_data.fld_from is the parsed content of the From field
330
331 - fld_data.fld_sender is the parsed content of the Sender field
332
333 - fld_data.fld_reply_to is the parsed content of the Reply-To field
334
335 - fld_data.fld_to is the parsed content of the To field
336
337 - fld_data.fld_cc is the parsed content of the Cc field
338
339 - fld_data.fld_bcc is the parsed content of the Bcc field
340
341 - fld_data.fld_message_id is the parsed content of the Message-ID field
342
343 - fld_data.fld_in_reply_to is the parsed content of the In-Reply-To field
344
345 - fld_data.fld_references is the parsed content of the References field
346
347 - fld_data.fld_subject is the content of the Subject field
348
349 - fld_data.fld_comments is the content of the Comments field
350
351 - fld_data.fld_keywords is the parsed content of the Keywords field
352
353 - fld_data.fld_optional_field is an other field and is not parsed
354*/
355
356#define LIBETPAN_MAILIMF_FIELD_UNION
357
358struct mailimf_field {
359 int fld_type;
360 union {
361 struct mailimf_return * fld_return_path; /* can be NULL */
362 struct mailimf_orig_date * fld_resent_date; /* can be NULL */
363 struct mailimf_from * fld_resent_from; /* can be NULL */
364 struct mailimf_sender * fld_resent_sender; /* can be NULL */
365 struct mailimf_to * fld_resent_to; /* can be NULL */
366 struct mailimf_cc * fld_resent_cc; /* can be NULL */
367 struct mailimf_bcc * fld_resent_bcc; /* can be NULL */
368 struct mailimf_message_id * fld_resent_msg_id; /* can be NULL */
369 struct mailimf_orig_date * fld_orig_date; /* can be NULL */
370 struct mailimf_from * fld_from; /* can be NULL */
371 struct mailimf_sender * fld_sender; /* can be NULL */
372 struct mailimf_reply_to * fld_reply_to; /* can be NULL */
373 struct mailimf_to * fld_to; /* can be NULL */
374 struct mailimf_cc * fld_cc; /* can be NULL */
375 struct mailimf_bcc * fld_bcc; /* can be NULL */
376 struct mailimf_message_id * fld_message_id; /* can be NULL */
377 struct mailimf_in_reply_to * fld_in_reply_to; /* can be NULL */
378 struct mailimf_references * fld_references; /* can be NULL */
379 struct mailimf_subject * fld_subject; /* can be NULL */
380 struct mailimf_comments * fld_comments; /* can be NULL */
381 struct mailimf_keywords * fld_keywords; /* can be NULL */
382 struct mailimf_optional_field * fld_optional_field; /* can be NULL */
383 } fld_data;
384};
385
386struct mailimf_field *
387mailimf_field_new(int fld_type,
388 struct mailimf_return * fld_return_path,
389 struct mailimf_orig_date * fld_resent_date,
390 struct mailimf_from * fld_resent_from,
391 struct mailimf_sender * fld_resent_sender,
392 struct mailimf_to * fld_resent_to,
393 struct mailimf_cc * fld_resent_cc,
394 struct mailimf_bcc * fld_resent_bcc,
395 struct mailimf_message_id * fld_resent_msg_id,
396 struct mailimf_orig_date * fld_orig_date,
397 struct mailimf_from * fld_from,
398 struct mailimf_sender * fld_sender,
399 struct mailimf_reply_to * fld_reply_to,
400 struct mailimf_to * fld_to,
401 struct mailimf_cc * fld_cc,
402 struct mailimf_bcc * fld_bcc,
403 struct mailimf_message_id * fld_message_id,
404 struct mailimf_in_reply_to * fld_in_reply_to,
405 struct mailimf_references * fld_references,
406 struct mailimf_subject * fld_subject,
407 struct mailimf_comments * fld_comments,
408 struct mailimf_keywords * fld_keywords,
409 struct mailimf_optional_field * fld_optional_field);
410
411void mailimf_field_free(struct mailimf_field * field);
412
413
414
415/*
416 mailimf_orig_date is the parsed Date field
417
418 - date_time is the parsed date
419*/
420
421struct mailimf_orig_date {
422 struct mailimf_date_time * dt_date_time; /* != NULL */
423};
424
425struct mailimf_orig_date * mailimf_orig_date_new(struct mailimf_date_time *
426 dt_date_time);
427
428void mailimf_orig_date_free(struct mailimf_orig_date * orig_date);
429
430
431
432
433/*
434 mailimf_from is the parsed From field
435
436 - mb_list is the parsed mailbox list
437*/
438
439struct mailimf_from {
440 struct mailimf_mailbox_list * frm_mb_list; /* != NULL */
441};
442
443struct mailimf_from *
444mailimf_from_new(struct mailimf_mailbox_list * frm_mb_list);
445
446void mailimf_from_free(struct mailimf_from * from);
447
448
449
450/*
451 mailimf_sender is the parsed Sender field
452
453 - snd_mb is the parsed mailbox
454*/
455
456struct mailimf_sender {
457 struct mailimf_mailbox * snd_mb; /* != NULL */
458};
459
460struct mailimf_sender * mailimf_sender_new(struct mailimf_mailbox * snd_mb);
461
462void mailimf_sender_free(struct mailimf_sender * sender);
463
464
465
466
467/*
468 mailimf_reply_to is the parsed Reply-To field
469
470 - rt_addr_list is the parsed address list
471 */
472
473struct mailimf_reply_to {
474 struct mailimf_address_list * rt_addr_list; /* != NULL */
475};
476
477struct mailimf_reply_to *
478mailimf_reply_to_new(struct mailimf_address_list * rt_addr_list);
479
480void mailimf_reply_to_free(struct mailimf_reply_to * reply_to);
481
482
483
484
485/*
486 mailimf_to is the parsed To field
487
488 - to_addr_list is the parsed address list
489*/
490
491struct mailimf_to {
492 struct mailimf_address_list * to_addr_list; /* != NULL */
493};
494
495struct mailimf_to * mailimf_to_new(struct mailimf_address_list * to_addr_list);
496
497void mailimf_to_free(struct mailimf_to * to);
498
499
500
501
502/*
503 mailimf_cc is the parsed Cc field
504
505 - cc_addr_list is the parsed addres list
506*/
507
508struct mailimf_cc {
509 struct mailimf_address_list * cc_addr_list; /* != NULL */
510};
511
512struct mailimf_cc * mailimf_cc_new(struct mailimf_address_list * cc_addr_list);
513
514void mailimf_cc_free(struct mailimf_cc * cc);
515
516
517
518
519/*
520 mailimf_bcc is the parsed Bcc field
521
522 - bcc_addr_list is the parsed addres list
523*/
524
525struct mailimf_bcc {
526 struct mailimf_address_list * bcc_addr_list; /* can be NULL */
527};
528
529struct mailimf_bcc *
530mailimf_bcc_new(struct mailimf_address_list * bcc_addr_list);
531
532void mailimf_bcc_free(struct mailimf_bcc * bcc);
533
534
535
536/*
537 mailimf_message_id is the parsed Message-ID field
538
539 - mid_value is the message identifier
540*/
541
542struct mailimf_message_id {
543 char * mid_value; /* != NULL */
544};
545
546struct mailimf_message_id * mailimf_message_id_new(char * mid_value);
547
548void mailimf_message_id_free(struct mailimf_message_id * message_id);
549
550
551
552
553/*
554 mailimf_in_reply_to is the parsed In-Reply-To field
555
556 - mid_list is the list of message identifers
557*/
558
559struct mailimf_in_reply_to {
560 clist * mid_list; /* list of (char *), != NULL */
561};
562
563struct mailimf_in_reply_to * mailimf_in_reply_to_new(clist * mid_list);
564
565void mailimf_in_reply_to_free(struct mailimf_in_reply_to * in_reply_to);
566
567
568
569/*
570 mailimf_references is the parsed References field
571
572 - msg_id_list is the list of message identifiers
573 */
574
575struct mailimf_references {
576 clist * mid_list; /* list of (char *) */
577 /* != NULL */
578};
579
580struct mailimf_references * mailimf_references_new(clist * mid_list);
581
582void mailimf_references_free(struct mailimf_references * references);
583
584
585
586/*
587 mailimf_subject is the parsed Subject field
588
589 - sbj_value is the value of the field
590*/
591
592struct mailimf_subject {
593 char * sbj_value; /* != NULL */
594};
595
596struct mailimf_subject * mailimf_subject_new(char * sbj_value);
597
598void mailimf_subject_free(struct mailimf_subject * subject);
599
600
601/*
602 mailimf_comments is the parsed Comments field
603
604 - cm_value is the value of the field
605*/
606
607struct mailimf_comments {
608 char * cm_value; /* != NULL */
609};
610
611struct mailimf_comments * mailimf_comments_new(char * cm_value);
612
613void mailimf_comments_free(struct mailimf_comments * comments);
614
615
616/*
617 mailimf_keywords is the parsed Keywords field
618
619 - kw_list is the list of keywords
620*/
621
622struct mailimf_keywords {
623 clist * kw_list; /* list of (char *), != NULL */
624};
625
626struct mailimf_keywords * mailimf_keywords_new(clist * kw_list);
627
628void mailimf_keywords_free(struct mailimf_keywords * keywords);
629
630
631/*
632 mailimf_return is the parsed Return-Path field
633
634 - ret_path is the parsed value of Return-Path
635*/
636
637struct mailimf_return {
638 struct mailimf_path * ret_path; /* != NULL */
639};
640
641struct mailimf_return *
642mailimf_return_new(struct mailimf_path * ret_path);
643
644void mailimf_return_free(struct mailimf_return * return_path);
645
646
647/*
648 mailimf_path is the parsed value of Return-Path
649
650 - pt_addr_spec is a mailbox
651*/
652
653struct mailimf_path {
654 char * pt_addr_spec; /* can be NULL */
655};
656
657struct mailimf_path * mailimf_path_new(char * pt_addr_spec);
658
659void mailimf_path_free(struct mailimf_path * path);
660
661
662/*
663 mailimf_optional_field is a non-parsed field
664
665 - fld_name is the name of the field
666
667 - fld_value is the value of the field
668*/
669
670struct mailimf_optional_field {
671 char * fld_name; /* != NULL */
672 char * fld_value; /* != NULL */
673};
674
675struct mailimf_optional_field *
676mailimf_optional_field_new(char * fld_name, char * fld_value);
677
678void mailimf_optional_field_free(struct mailimf_optional_field * opt_field);
679
680
681/*
682 mailimf_fields is the native structure that IMF module will use,
683 this module will provide an easier structure to use when parsing fields.
684
685 mailimf_single_fields is an easier structure to get parsed fields,
686 rather than iteration over the list of fields
687
688 - fld_orig_date is the parsed "Date" field
689
690 - fld_from is the parsed "From" field
691
692 - fld_sender is the parsed "Sender "field
693
694 - fld_reply_to is the parsed "Reply-To" field
695
696 - fld_to is the parsed "To" field
697
698 - fld_cc is the parsed "Cc" field
699
700 - fld_bcc is the parsed "Bcc" field
701
702 - fld_message_id is the parsed "Message-ID" field
703
704 - fld_in_reply_to is the parsed "In-Reply-To" field
705
706 - fld_references is the parsed "References" field
707
708 - fld_subject is the parsed "Subject" field
709
710 - fld_comments is the parsed "Comments" field
711
712 - fld_keywords is the parsed "Keywords" field
713*/
714
715struct mailimf_single_fields {
716 struct mailimf_orig_date * fld_orig_date; /* can be NULL */
717 struct mailimf_from * fld_from; /* can be NULL */
718 struct mailimf_sender * fld_sender; /* can be NULL */
719 struct mailimf_reply_to * fld_reply_to; /* can be NULL */
720 struct mailimf_to * fld_to; /* can be NULL */
721 struct mailimf_cc * fld_cc; /* can be NULL */
722 struct mailimf_bcc * fld_bcc; /* can be NULL */
723 struct mailimf_message_id * fld_message_id; /* can be NULL */
724 struct mailimf_in_reply_to * fld_in_reply_to; /* can be NULL */
725 struct mailimf_references * fld_references; /* can be NULL */
726 struct mailimf_subject * fld_subject; /* can be NULL */
727 struct mailimf_comments * fld_comments; /* can be NULL */
728 struct mailimf_keywords * fld_keywords; /* can be NULL */
729};
730
731
732
733
734
735
736/* internal use */
737
738void mailimf_atom_free(char * atom);
739
740void mailimf_dot_atom_free(char * dot_atom);
741
742void mailimf_dot_atom_text_free(char * dot_atom);
743
744void mailimf_quoted_string_free(char * quoted_string);
745
746void mailimf_word_free(char * word);
747
748void mailimf_phrase_free(char * phrase);
749
750void mailimf_unstructured_free(char * unstructured);
751
752void mailimf_angle_addr_free(char * angle_addr);
753
754void mailimf_display_name_free(char * display_name);
755
756void mailimf_addr_spec_free(char * addr_spec);
757
758void mailimf_local_part_free(char * local_part);
759
760void mailimf_domain_free(char * domain);
761
762void mailimf_domain_literal_free(char * domain);
763
764void mailimf_msg_id_free(char * msg_id);
765
766void mailimf_id_left_free(char * id_left);
767
768void mailimf_id_right_free(char * id_right);
769
770void mailimf_no_fold_quote_free(char * nfq);
771
772void mailimf_no_fold_literal_free(char * nfl);
773
774void mailimf_field_name_free(char * field_name);
775
776
777
778/* these are the possible returned error codes */
779
780enum {
781 MAILIMF_NO_ERROR = 0,
782 MAILIMF_ERROR_PARSE,
783 MAILIMF_ERROR_MEMORY,
784 MAILIMF_ERROR_INVAL,
785 MAILIMF_ERROR_FILE,
786};
787
788
789#ifdef __cplusplus
790}
791#endif
792
793#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimf_types_helper.h b/kmicromail/libetpan/include/libetpan/mailimf_types_helper.h
new file mode 100644
index 0000000..e542b4b
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimf_types_helper.h
@@ -0,0 +1,370 @@
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 MAILIMF_TYPES_HELPER
37
38#define MAILIMF_TYPES_HELPER
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailimf_types.h>
45
46/*
47 IMPORTANT NOTE:
48
49 All allocation functions will take as argument allocated data
50 and will store these data in the structure they will allocate.
51 Data should be persistant during all the use of the structure
52 and will be freed by the free function of the structure
53
54 allocation functions will return NULL on failure
55*/
56
57/*
58 mailimf_mailbox_list_new_empty creates an empty list of mailboxes
59*/
60
61struct mailimf_mailbox_list *
62mailimf_mailbox_list_new_empty();
63
64/*
65 mailimf_mailbox_list_add adds a mailbox to the list of mailboxes
66
67 @return MAILIMF_NO_ERROR will be returned on success,
68 other code will be returned otherwise
69*/
70
71int mailimf_mailbox_list_add(struct mailimf_mailbox_list * mailbox_list,
72 struct mailimf_mailbox * mb);
73
74/*
75 mailimf_mailbox_list_add_parse parse the given string
76 into a mailimf_mailbox structure and adds it to the list of mailboxes
77
78 @return MAILIMF_NO_ERROR will be returned on success,
79 other code will be returned otherwise
80*/
81
82int mailimf_mailbox_list_add_parse(struct mailimf_mailbox_list * mailbox_list,
83 char * mb_str);
84
85/*
86 mailimf_mailbox creates a mailimf_mailbox structure with the given
87 arguments and adds it to the list of mailboxes
88
89 - display_name is the name that will be displayed for this mailbox,
90 for example 'name' in '"name" <mailbox@domain>,
91 should be allocated with malloc()
92
93 - address is the mailbox, for example 'mailbox@domain'
94 in '"name" <mailbox@domain>, should be allocated with malloc()
95
96 @return MAILIMF_NO_ERROR will be returned on success,
97 other code will be returned otherwise
98*/
99
100int mailimf_mailbox_list_add_mb(struct mailimf_mailbox_list * mailbox_list,
101 char * display_name, char * address);
102
103/*
104 mailimf_address_list_new_empty creates an empty list of addresses
105*/
106
107struct mailimf_address_list *
108mailimf_address_list_new_empty();
109
110/*
111 mailimf_address_list_add adds a mailbox to the list of addresses
112
113 @return MAILIMF_NO_ERROR will be returned on success,
114 other code will be returned otherwise
115*/
116
117int mailimf_address_list_add(struct mailimf_address_list * address_list,
118 struct mailimf_address * addr);
119
120/*
121 mailimf_address_list_add_parse parse the given string
122 into a mailimf_address structure and adds it to the list of addresses
123
124 @return MAILIMF_NO_ERROR will be returned on success,
125 other code will be returned otherwise
126*/
127
128int mailimf_address_list_add_parse(struct mailimf_address_list * address_list,
129 char * addr_str);
130
131/*
132 mailimf_address_list_add_mb creates a mailbox mailimf_address
133 with the given arguments and adds it to the list of addresses
134
135 - display_name is the name that will be displayed for this mailbox,
136 for example 'name' in '"name" <mailbox@domain>,
137 should be allocated with malloc()
138
139 - address is the mailbox, for example 'mailbox@domain'
140 in '"name" <mailbox@domain>, should be allocated with malloc()
141
142 @return MAILIMF_NO_ERROR will be returned on success,
143 other code will be returned otherwise
144*/
145
146int mailimf_address_list_add_mb(struct mailimf_address_list * address_list,
147 char * display_name, char * address);
148
149/*
150 mailimf_resent_fields_add_data adds a set of resent fields in the
151 given mailimf_fields structure.
152
153 if you don't want a given field in the set to be added in the list
154 of fields, you can give NULL as argument
155
156 @param resent_msg_id sould be allocated with malloc()
157
158 @return MAILIMF_NO_ERROR will be returned on success,
159 other code will be returned otherwise
160*/
161
162int
163mailimf_resent_fields_add_data(struct mailimf_fields * fields,
164 struct mailimf_date_time * resent_date,
165 struct mailimf_mailbox_list * resent_from,
166 struct mailimf_mailbox * resent_sender,
167 struct mailimf_address_list * resent_to,
168 struct mailimf_address_list * resent_cc,
169 struct mailimf_address_list * resent_bcc,
170 char * resent_msg_id);
171
172/*
173 mailimf_resent_fields_new_with_data_all creates a new mailimf_fields
174 structure with a set of resent fields
175
176 if you don't want a given field in the set to be added in the list
177 of fields, you can give NULL as argument
178
179 @param resent_msg_id sould be allocated with malloc()
180
181 @return MAILIMF_NO_ERROR will be returned on success,
182 other code will be returned otherwise
183*/
184
185struct mailimf_fields *
186mailimf_resent_fields_new_with_data_all(struct mailimf_date_time *
187 resent_date, struct mailimf_mailbox_list * resent_from,
188 struct mailimf_mailbox * resent_sender,
189 struct mailimf_address_list * resent_to,
190 struct mailimf_address_list * resent_cc,
191 struct mailimf_address_list * resent_bcc,
192 char * resent_msg_id);
193
194/*
195 mailimf_resent_fields_new_with_data_all creates a new mailimf_fields
196 structure with a set of resent fields.
197 Resent-Date and Resent-Message-ID fields will be generated for you.
198
199 if you don't want a given field in the set to be added in the list
200 of fields, you can give NULL as argument
201
202 @return MAILIMF_NO_ERROR will be returned on success,
203 other code will be returned otherwise
204*/
205
206struct mailimf_fields *
207mailimf_resent_fields_new_with_data(struct mailimf_mailbox_list * from,
208 struct mailimf_mailbox * sender,
209 struct mailimf_address_list * to,
210 struct mailimf_address_list * cc,
211 struct mailimf_address_list * bcc);
212
213/*
214 this function creates a new mailimf_fields structure with no fields
215*/
216
217struct mailimf_fields *
218mailimf_fields_new_empty(void);
219
220
221/*
222 this function adds a field to the mailimf_fields structure
223
224 @return MAILIMF_NO_ERROR will be returned on success,
225 other code will be returned otherwise
226*/
227
228int mailimf_fields_add(struct mailimf_fields * fields,
229 struct mailimf_field * field);
230
231
232/*
233 mailimf_fields_add_data adds a set of fields in the
234 given mailimf_fields structure.
235
236 if you don't want a given field in the set to be added in the list
237 of fields, you can give NULL as argument
238
239 @param msg_id sould be allocated with malloc()
240 @param subject should be allocated with malloc()
241 @param in_reply_to each elements of this list should be allocated
242 with malloc()
243 @param references each elements of this list should be allocated
244 with malloc()
245
246 @return MAILIMF_NO_ERROR will be returned on success,
247 other code will be returned otherwise
248*/
249
250int mailimf_fields_add_data(struct mailimf_fields * fields,
251 struct mailimf_date_time * date,
252 struct mailimf_mailbox_list * from,
253 struct mailimf_mailbox * sender,
254 struct mailimf_address_list * reply_to,
255 struct mailimf_address_list * to,
256 struct mailimf_address_list * cc,
257 struct mailimf_address_list * bcc,
258 char * msg_id,
259 clist * in_reply_to,
260 clist * references,
261 char * subject);
262
263/*
264 mailimf_fields_new_with_data_all creates a new mailimf_fields
265 structure with a set of fields
266
267 if you don't want a given field in the set to be added in the list
268 of fields, you can give NULL as argument
269
270 @param message_id sould be allocated with malloc()
271 @param subject should be allocated with malloc()
272 @param in_reply_to each elements of this list should be allocated
273 with malloc()
274 @param references each elements of this list should be allocated
275 with malloc()
276
277 @return MAILIMF_NO_ERROR will be returned on success,
278 other code will be returned otherwise
279*/
280
281struct mailimf_fields *
282mailimf_fields_new_with_data_all(struct mailimf_date_time * date,
283 struct mailimf_mailbox_list * from,
284 struct mailimf_mailbox * sender,
285 struct mailimf_address_list * reply_to,
286 struct mailimf_address_list * to,
287 struct mailimf_address_list * cc,
288 struct mailimf_address_list * bcc,
289 char * message_id,
290 clist * in_reply_to,
291 clist * references,
292 char * subject);
293
294/*
295 mailimf_fields_new_with_data creates a new mailimf_fields
296 structure with a set of fields
297 Date and Message-ID fields will be generated for you.
298
299 if you don't want a given field in the set to be added in the list
300 of fields, you can give NULL as argument
301
302 @param subject should be allocated with malloc()
303 @param in_reply_to each elements of this list should be allocated
304 with malloc()
305 @param references each elements of this list should be allocated
306 with malloc()
307
308 @return MAILIMF_NO_ERROR will be returned on success,
309 other code will be returned otherwise
310*/
311
312struct mailimf_fields *
313mailimf_fields_new_with_data(struct mailimf_mailbox_list * from,
314 struct mailimf_mailbox * sender,
315 struct mailimf_address_list * reply_to,
316 struct mailimf_address_list * to,
317 struct mailimf_address_list * cc,
318 struct mailimf_address_list * bcc,
319 clist * in_reply_to,
320 clist * references,
321 char * subject);
322
323/*
324 this function returns an allocated message identifier to
325 use in a Message-ID or Resent-Message-ID field
326*/
327
328char * mailimf_get_message_id(void);
329
330/*
331 this function returns a mailimf_date_time structure to
332 use in a Date or Resent-Date field
333*/
334
335struct mailimf_date_time * mailimf_get_current_date(void);
336
337
338/*
339 mailimf_single_fields_init fills a mailimf_single_fields structure
340 with the content of a mailimf_fields structure
341*/
342
343void mailimf_single_fields_init(struct mailimf_single_fields * single_fields,
344 struct mailimf_fields * fields);
345
346/*
347 mailimf_single_fields_new creates a new mailimf_single_fields and
348 fills the structure with mailimf_fields
349*/
350
351struct mailimf_single_fields *
352mailimf_single_fields_new(struct mailimf_fields * fields);
353
354void mailimf_single_fields_free(struct mailimf_single_fields *
355 single_fields);
356
357/*
358 mailimf_field_new_custom creates a new field of type optional
359
360 @param name should be allocated with malloc()
361 @param value should be allocated with malloc()
362*/
363
364struct mailimf_field * mailimf_field_new_custom(char * name, char * value);
365
366#ifdef __cplusplus
367}
368#endif
369
370#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailimf_write.h b/kmicromail/libetpan/include/libetpan/mailimf_write.h
new file mode 100644
index 0000000..b3e61ab
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailimf_write.h
@@ -0,0 +1,134 @@
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 MAILIMF_WRITE_H
37
38#define MAILIMF_WRITE_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <stdio.h>
45#include <libetpan/mailimf_types.h>
46
47/*
48 mailimf_string_write writes a string to a given stream
49
50 @param f is the stream
51 @param col (* col) is the column number where we will start to
52 write the text, the ending column will be stored in (* col)
53 @param str is the string to write
54*/
55
56int mailimf_string_write(FILE * f, int * col,
57 const char * str, size_t length);
58
59
60/*
61 mailimf_fields_write writes the fields to a given stream
62
63 @param f is the stream
64 @param col (* col) is the column number where we will start to
65 write the text, the ending column will be stored in (* col)
66 @param fields is the fields to write
67*/
68
69int mailimf_fields_write(FILE * f, int * col,
70 struct mailimf_fields * fields);
71
72
73/*
74 mailimf_envelope_fields_write writes only some fields to a given stream
75
76 @param f is the stream
77 @param col (* col) is the column number where we will start to
78 write the text, the ending column will be stored in (* col)
79 @param fields is the fields to write
80*/
81
82int mailimf_envelope_fields_write(FILE * f, int * col,
83 struct mailimf_fields * fields);
84
85
86/*
87 mailimf_field_write writes a field to a given stream
88
89 @param f is the stream
90 @param col (* col) is the column number where we will start to
91 write the text, the ending column will be stored in (* col)
92 @param field is the field to write
93*/
94
95int mailimf_field_write(FILE * f, int * col,
96 struct mailimf_field * field);
97
98/*
99 mailimf_quoted_string_write writes a string that is quoted
100 to a given stream
101
102 @param f is the stream
103 @param col (* col) is the column number where we will start to
104 write the text, the ending column will be stored in (* col)
105 @param string is the string to quote and write
106*/
107
108int mailimf_quoted_string_write(FILE * f, int * col,
109 const char * string, size_t len);
110
111int mailimf_address_list_write(FILE * f, int * col,
112 struct mailimf_address_list * addr_list);
113
114int mailimf_mailbox_list_write(FILE * f, int * col,
115 struct mailimf_mailbox_list * mb_list);
116
117/*
118 mailimf_header_string_write writes a header value and fold the header
119 if needed.
120
121 @param f is the stream
122 @param col (* col) is the column number where we will start to
123 write the text, the ending column will be stored in (* col)
124 @param str is the string to write
125*/
126
127int mailimf_header_string_write(FILE * f, int * col,
128 const char * str, size_t length);
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmbox.h b/kmicromail/libetpan/include/libetpan/mailmbox.h
new file mode 100644
index 0000000..8be086c
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/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
diff --git a/kmicromail/libetpan/include/libetpan/mailmbox_types.h b/kmicromail/libetpan/include/libetpan/mailmbox_types.h
new file mode 100644
index 0000000..dd6758c
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmbox_types.h
@@ -0,0 +1,142 @@
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_TYPES_H
37
38#define MAILMBOX_TYPES_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <sys/types.h>
45
46#include <libetpan/libetpan-config.h>
47
48#include <libetpan/mailimf.h>
49#include <libetpan/carray.h>
50#include <libetpan/chash.h>
51
52enum {
53 MAILMBOX_NO_ERROR = 0,
54 MAILMBOX_ERROR_PARSE,
55 MAILMBOX_ERROR_INVAL,
56 MAILMBOX_ERROR_FILE_NOT_FOUND,
57 MAILMBOX_ERROR_MEMORY,
58 MAILMBOX_ERROR_TEMPORARY_FILE,
59 MAILMBOX_ERROR_FILE,
60 MAILMBOX_ERROR_MSG_NOT_FOUND,
61 MAILMBOX_ERROR_READONLY,
62};
63
64
65struct mailmbox_folder {
66 char mb_filename[PATH_MAX];
67
68 time_t mb_mtime;
69
70 int mb_fd;
71 int mb_read_only;
72 int mb_no_uid;
73
74 int mb_changed;
75 unsigned int mb_deleted_count;
76
77 char * mb_mapping;
78 size_t mb_mapping_size;
79
80 uint32_t mb_written_uid;
81 uint32_t mb_max_uid;
82
83 chash * mb_hash;
84 carray * mb_tab;
85};
86
87struct mailmbox_folder * mailmbox_folder_new(const char * mb_filename);
88void mailmbox_folder_free(struct mailmbox_folder * folder);
89
90
91struct mailmbox_msg_info {
92 unsigned int msg_index;
93 uint32_t msg_uid;
94 int msg_written_uid;
95 int msg_deleted;
96
97 size_t msg_start;
98 size_t msg_start_len;
99
100 size_t msg_headers;
101 size_t msg_headers_len;
102
103 size_t msg_body;
104 size_t msg_body_len;
105
106 size_t msg_size;
107
108 size_t msg_padding;
109};
110
111
112int mailmbox_msg_info_update(struct mailmbox_folder * folder,
113 size_t msg_start, size_t msg_start_len,
114 size_t msg_headers, size_t msg_headers_len,
115 size_t msg_body, size_t msg_body_len,
116 size_t msg_size, size_t msg_padding,
117 uint32_t msg_uid);
118
119struct mailmbox_msg_info *
120mailmbox_msg_info_new(size_t msg_start, size_t msg_start_len,
121 size_t msg_headers, size_t msg_headers_len,
122 size_t msg_body, size_t msg_body_len,
123 size_t msg_size, size_t msg_padding,
124 uint32_t msg_uid);
125
126void mailmbox_msg_info_free(struct mailmbox_msg_info * info);
127
128struct mailmbox_append_info {
129 const char * ai_message;
130 size_t ai_size;
131};
132
133struct mailmbox_append_info *
134mailmbox_append_info_new(const char * ai_message, size_t ai_size);
135
136void mailmbox_append_info_free(struct mailmbox_append_info * info);
137
138#ifdef __cplusplus
139}
140#endif
141
142#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmessage.h b/kmicromail/libetpan/include/libetpan/mailmessage.h
new file mode 100644
index 0000000..df9b790
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmessage.h
@@ -0,0 +1,379 @@
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#include <libetpan/mailmessage_types.h>
37
38#ifndef MAILMESSAGE_H
39
40#define MAILMESSAGE_H
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 mailmessage_new
48
49 This function will initializes a new empty message.
50
51 @return a new empty message will be returned.
52*/
53
54mailmessage * mailmessage_new(void);
55
56/*
57 mailmessage_free
58
59 This function will release the memory used by this message.
60*/
61
62void mailmessage_free(mailmessage * info);
63
64/*
65 mailmessage_init
66
67 This function will initializes a mailmessage structure
68 with a message from a given session.
69
70 @param msg_info This is the message to initialize.
71
72 @param session This is the source session of the message. It
73 can be NULL if the message does not get the information
74 through the session.
75
76 @param driver This is the driver to use for the message.
77
78 @param index This is the message number in the session. 0 can
79 be given if the message is not attached to a session.
80
81 @param size is an optional parameter, 0 can be given.
82 This is informational. This is the size of message content.
83
84 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
85 on error
86*/
87
88int mailmessage_init(mailmessage * msg_info,
89 mailsession * session,
90 mailmessage_driver * driver,
91 uint32_t index, size_t size);
92
93/*
94 mailmessage_flush
95
96 This function will release all the temporary resources that are not
97 necessary to use the mailmessage structure from memory. These
98 resources are for example cached information, such as the MIME
99 structure.
100
101 @param info is the message to clean.
102
103 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
104 on error. We can assume that MAIL_NO_ERROR is always returned.
105*/
106
107int mailmessage_flush(mailmessage * info);
108
109/*
110 mailmessage_check
111
112 This function will notify the new value of the flags to the session,
113 it must be called before mailsession_check_folder() in case the flags have
114 been changed.
115
116 @param info is the message to checkpoint.
117
118 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
119 on error. We can assume that MAIL_NO_ERROR is always returned.
120*/
121
122int mailmessage_check(mailmessage * info);
123
124/*
125 mailmessage_fetch_result_free
126
127 This function releases the memory used by a message returned
128 by any of the fetch function that returns a (char *).
129
130 @param msg_info is the message which the given buffer is from.
131
132 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
133 on error. We can assume that MAIL_NO_ERROR is always returned.
134*/
135
136int mailmessage_fetch_result_free(mailmessage * msg_info,
137 char * msg);
138
139/*
140 mailmessage_fetch
141
142 This function returns the content of the message (headers and text).
143
144 @param msg_info is the message from which we want to fetch information.
145
146 @param result The content of the message is returned in (* result)
147
148 @param result_len The length of the returned string is stored
149 in (* result_len).
150
151 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
152 on error.
153*/
154
155int mailmessage_fetch(mailmessage * msg_info,
156 char ** result,
157 size_t * result_len);
158
159/*
160 mailmessage_fetch_header
161
162 This function returns the header of the message as a string.
163
164 @param msg_info is the message from which we want to fetch information.
165
166 @param result The header of the message is returned in (* result)
167
168 @param result_len The length of the returned string is stored
169 in (* result_len).
170
171 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
172 on error.
173*/
174
175int mailmessage_fetch_header(mailmessage * msg_info,
176 char ** result,
177 size_t * result_len);
178
179/*
180 mailmessage_fetch_body
181
182 This function returns the content of the message (without headers).
183
184 @param msg_info is the message from which we want to fetch information.
185 @param result The message text (without headers) is returned
186 in (* result)
187 @param result_len The length of the returned string is stored
188 in (* result_len).
189
190 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
191 on error.
192*/
193
194int mailmessage_fetch_body(mailmessage * msg_info,
195 char ** result, size_t * result_len);
196
197/*
198 mailmessage_fetch_size
199
200 This function returns the size of the message content.
201
202 @param msg_info is the message from which we want to fetch information.
203
204 @param result The length of the message content is stored in (* result).
205
206 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
207 on error.
208*/
209
210int mailmessage_fetch_size(mailmessage * msg_info,
211 size_t * result);
212
213/*
214 mailmessage_get_bodystructure
215
216 This functions returns the MIME structure of the message.
217 The returned information MUST not be freed by hand. It is freed by
218 mailmessage_flush() or mailmessage_free().
219
220 @param msg_info is the message from which we want to fetch information.
221
222 @param result The MIME structure is stored in (* result).
223
224 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
225 on error.
226*/
227
228int mailmessage_get_bodystructure(mailmessage * msg_info,
229 struct mailmime ** result);
230
231/*
232 mailmessage_fetch_section
233
234 This function returns the content of a MIME part.
235
236 @param msg_info is the message from which we want to fetch information.
237
238 @param mime is the MIME part identifier.
239
240 @param result The content is returned in (* result)
241
242 @param result_len The length of the returned string is stored
243 in (* result_len).
244
245 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
246 on error.
247 */
248
249int mailmessage_fetch_section(mailmessage * msg_info,
250 struct mailmime * mime,
251 char ** result, size_t * result_len);
252
253/*
254 mailmessage_fetch_section_header
255
256 This function returns the header of the message contained
257 in the given MIME part.
258
259 @param msg_info is the message from which we want to fetch information.
260
261 @param mime is the MIME part identifier.
262
263 @param result The header is returned in (* result)
264
265 @param result_len The length of the returned string is stored
266 in (* result_len).
267
268 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
269 on error.
270*/
271
272int mailmessage_fetch_section_header(mailmessage * msg_info,
273 struct mailmime * mime,
274 char ** result,
275 size_t * result_len);
276
277/*
278 mailmessage_fetch_section_mime
279
280 This function returns the MIME header of the given MIME part.
281
282 @param msg_info is the message from which we want to fetch information.
283
284 @param mime is the MIME part identifier.
285
286 @param result The MIME header is returned in (* result)
287
288 @param result_len The length of the returned string is stored
289 in (* result_len).
290
291 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
292 on error.
293*/
294
295int mailmessage_fetch_section_mime(mailmessage * msg_info,
296 struct mailmime * mime,
297 char ** result,
298 size_t * result_len);
299
300/*
301 mailmessage_fetch_section_body
302
303 This function returns the text part of the message contained
304 in the given MIME part.
305
306 @param msg_info is the message from which we want to fetch information.
307
308 @param mime is the MIME part identifier.
309
310 @param result The message text is returned in (* result)
311
312 @param result_len The length of the returned string is stored
313 in (* result_len).
314
315 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
316 on error.
317 */
318
319int mailmessage_fetch_section_body(mailmessage * msg_info,
320 struct mailmime * mime,
321 char ** result,
322 size_t * result_len);
323
324/*
325 mailmessage_fetch_envelope
326
327 This function returns a list of parsed fields of the message,
328 chosen by the driver.
329 The returned structure must be freed with mailimf_fields_free().
330
331 @param msg_info is the message from which we want to fetch information.
332
333 @param result The headers list is returned in (* result)
334
335 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
336 on error.
337 */
338
339int mailmessage_fetch_envelope(mailmessage * msg_info,
340 struct mailimf_fields ** result);
341
342
343/*
344 mailmessage_get_flags
345
346 This function returns the flags related to the message.
347 The returned information MUST not be freed by hand. It is freed by
348 mailmessage_free().
349
350 @param msg_info is the message from which we want to fetch information.
351
352 @param result The flags are stored in (* result).
353
354 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
355 on error.
356*/
357
358int mailmessage_get_flags(mailmessage * msg_info,
359 struct mail_flags ** result);
360
361/*
362 mailmessage_resolve_single_fields
363
364 This function will use the fields information to fill the single_fields
365 structure in the mailmessage structure.
366
367 @param msg_info This is the msg_info to process.
368
369 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
370 on error.
371*/
372
373void mailmessage_resolve_single_fields(mailmessage * msg_info);
374
375#ifdef __cplusplus
376}
377#endif
378
379#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmessage_types.h b/kmicromail/libetpan/include/libetpan/mailmessage_types.h
new file mode 100644
index 0000000..655ed2c
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmessage_types.h
@@ -0,0 +1,50 @@
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 MAILMESSAGE_TYPES_H
37
38#define MAILMESSAGE_TYPES_H
39
40#include <libetpan/maildriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmh.h b/kmicromail/libetpan/include/libetpan/mailmh.h
new file mode 100644
index 0000000..40432cb
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmh.h
@@ -0,0 +1,143 @@
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 MAILMH_H
37
38#define MAILMH_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <sys/types.h>
45#include <inttypes.h>
46#include <libetpan/carray.h>
47#include <libetpan/cinthash.h>
48#include <libetpan/chash.h>
49
50enum {
51 MAILMH_NO_ERROR = 0,
52 MAILMH_ERROR_FOLDER,
53 MAILMH_ERROR_MEMORY,
54 MAILMH_ERROR_FILE,
55 MAILMH_ERROR_COULD_NOT_ALLOC_MSG,
56 MAILMH_ERROR_RENAME,
57 MAILMH_ERROR_MSG_NOT_FOUND,
58};
59
60struct mailmh {
61 struct mailmh_folder * mh_main;
62};
63
64struct mailmh_msg_info {
65 unsigned int msg_array_index;
66 uint32_t msg_index;
67 size_t msg_size;
68 time_t msg_mtime;
69};
70
71struct mailmh_folder {
72 char * fl_filename;
73 unsigned int fl_array_index;
74
75 char * fl_name;
76 time_t fl_mtime;
77 struct mailmh_folder * fl_parent;
78 uint32_t fl_max_index;
79
80 carray * fl_msgs_tab;
81#if 0
82 cinthash_t * fl_msgs_hash;
83#endif
84 chash * fl_msgs_hash;
85
86 carray * fl_subfolders_tab;
87 chash * fl_subfolders_hash;
88};
89
90struct mailmh * mailmh_new(const char * foldername);
91void mailmh_free(struct mailmh * f);
92
93struct mailmh_msg_info *
94mailmh_msg_info_new(uint32_t index, size_t size, time_t mtime);
95void mailmh_msg_info_free(struct mailmh_msg_info * msg_info);
96
97struct mailmh_folder * mailmh_folder_new(struct mailmh_folder * parent,
98 const char * name);
99void mailmh_folder_free(struct mailmh_folder * folder);
100
101int mailmh_folder_add_subfolder(struct mailmh_folder * parent,
102 const char * name);
103
104struct mailmh_folder * mailmh_folder_find(struct mailmh_folder * root,
105 const char * filename);
106
107int mailmh_folder_remove_subfolder(struct mailmh_folder * folder);
108
109int mailmh_folder_rename_subfolder(struct mailmh_folder * src_folder,
110 struct mailmh_folder * dst_folder,
111 const char * new_name);
112
113int mailmh_folder_get_message_filename(struct mailmh_folder * folder,
114 uint32_t index, char ** result);
115
116int mailmh_folder_get_message_fd(struct mailmh_folder * folder,
117 uint32_t index, int flags, int * result);
118
119int mailmh_folder_get_message_size(struct mailmh_folder * folder,
120 uint32_t index, size_t * result);
121
122int mailmh_folder_add_message(struct mailmh_folder * folder,
123 const char * message, size_t size);
124
125int mailmh_folder_add_message_file(struct mailmh_folder * folder,
126 int fd);
127
128int mailmh_folder_remove_message(struct mailmh_folder * folder,
129 uint32_t index);
130
131int mailmh_folder_move_message(struct mailmh_folder * dest_folder,
132 struct mailmh_folder * src_folder,
133 uint32_t index);
134
135int mailmh_folder_update(struct mailmh_folder * folder);
136
137unsigned int mailmh_folder_get_message_number(struct mailmh_folder * folder);
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmime.h b/kmicromail/libetpan/include/libetpan/mailmime.h
new file mode 100644
index 0000000..c834967
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmime.h
@@ -0,0 +1,100 @@
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 MAILMIME_H
37
38#define MAILMIME_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailimf.h>
45#include <libetpan/mailmime_types.h>
46#include <libetpan/mailmime_types_helper.h>
47#include <libetpan/mailmime_content.h>
48#include <libetpan/mailmime_decode.h>
49#include <libetpan/mailmime_disposition.h>
50#include <libetpan/mailmime_write.h>
51
52int mailmime_content_parse(const char * message, size_t length,
53 size_t * index,
54 struct mailmime_content ** result);
55
56int mailmime_description_parse(const char * message, size_t length,
57 size_t * index,
58 char ** result);
59
60int mailmime_encoding_parse(const char * message, size_t length,
61 size_t * index,
62 struct mailmime_mechanism ** result);
63
64int
65mailmime_field_parse(struct mailimf_optional_field * field,
66 struct mailmime_field ** result);
67
68int mailmime_id_parse(const char * message, size_t length,
69 size_t * index, char ** result);
70
71int
72mailmime_fields_parse(struct mailimf_fields *
73 fields,
74 struct mailmime_fields **
75 result);
76
77int mailmime_version_parse(const char * message, size_t length,
78 size_t * index,
79 uint32_t * result);
80
81int
82mailmime_extension_token_parse(const char * message, size_t length,
83 size_t * index, char ** result);
84
85int mailmime_parameter_parse(const char * message, size_t length,
86 size_t * index,
87 struct mailmime_parameter ** result);
88
89int mailmime_value_parse(const char * message, size_t length,
90 size_t * index, char ** result);
91
92int mailmime_language_parse(const char * message, size_t length,
93 size_t * index,
94 struct mailmime_language ** result);
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmime_content.h b/kmicromail/libetpan/include/libetpan/mailmime_content.h
new file mode 100644
index 0000000..df4b232
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmime_content.h
@@ -0,0 +1,89 @@
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 MAILMIME_CONTENT_H
37
38#define MAILMIME_CONTENT_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailmime_types.h>
45
46char * mailmime_content_charset_get(struct mailmime_content * content);
47
48char * mailmime_content_param_get(struct mailmime_content * content,
49 char * name);
50
51int mailmime_parse(const char * message, size_t length,
52 size_t * index, struct mailmime ** result);
53
54int mailmime_get_section(struct mailmime * mime,
55 struct mailmime_section * section,
56 struct mailmime ** result);
57
58
59char * mailmime_extract_boundary(struct mailmime_content * content_type);
60
61
62/* decode */
63
64int mailmime_base64_body_parse(const char * message, size_t length,
65 size_t * index, char ** result,
66 size_t * result_len);
67
68int mailmime_quoted_printable_body_parse(const char * message, size_t length,
69 size_t * index, char ** result,
70 size_t * result_len, int in_header);
71
72
73int mailmime_binary_body_parse(const char * message, size_t length,
74 size_t * index, char ** result,
75 size_t * result_len);
76
77int mailmime_part_parse(const char * message, size_t length,
78 size_t * index,
79 int encoding, char ** result, size_t * result_len);
80
81
82int mailmime_get_section_id(struct mailmime * mime,
83 struct mailmime_section ** result);
84
85#ifdef __cplusplus
86}
87#endif
88
89#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmime_decode.h b/kmicromail/libetpan/include/libetpan/mailmime_decode.h
new file mode 100644
index 0000000..034db6f
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmime_decode.h
@@ -0,0 +1,55 @@
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 MAILMIME_DECODE_H
37
38#define MAILMIME_DECODE_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailmime_types.h>
45
46int mailmime_encoded_phrase_parse(const char * default_fromcode,
47 const char * message, size_t length,
48 size_t * index, const char * tocode,
49 char ** result);
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmime_disposition.h b/kmicromail/libetpan/include/libetpan/mailmime_disposition.h
new file mode 100644
index 0000000..e3bba15
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmime_disposition.h
@@ -0,0 +1,62 @@
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 MAILMIME_DISPOSITION_H
37
38#define MAILMIME_DISPOSITION_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailmime_types.h>
45
46int mailmime_disposition_parse(const char * message, size_t length,
47 size_t * index,
48 struct mailmime_disposition ** result);
49
50int
51mailmime_disposition_type_parse(const char * message, size_t length,
52 size_t * index,
53 struct mailmime_disposition_type ** result);
54
55int mailmime_disposition_guess_type(const char * message, size_t length,
56 size_t index);
57
58#ifdef __cplusplus
59}
60#endif
61
62#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmime_types.h b/kmicromail/libetpan/include/libetpan/mailmime_types.h
new file mode 100644
index 0000000..3bb3b10
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmime_types.h
@@ -0,0 +1,440 @@
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 MAILMIME_TYPES_H
37
38#define MAILMIME_TYPES_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45#include <libetpan/mailimf.h>
46#include <libetpan/clist.h>
47
48enum {
49 MAILMIME_COMPOSITE_TYPE_ERROR,
50 MAILMIME_COMPOSITE_TYPE_MESSAGE,
51 MAILMIME_COMPOSITE_TYPE_MULTIPART,
52 MAILMIME_COMPOSITE_TYPE_EXTENSION
53};
54
55struct mailmime_composite_type {
56 int ct_type;
57 char * ct_token;
58};
59
60
61struct mailmime_content {
62 struct mailmime_type * ct_type;
63 char * ct_subtype;
64 clist * ct_parameters; /* elements are (struct mailmime_parameter *) */
65};
66
67
68enum {
69 MAILMIME_DISCRETE_TYPE_ERROR,
70 MAILMIME_DISCRETE_TYPE_TEXT,
71 MAILMIME_DISCRETE_TYPE_IMAGE,
72 MAILMIME_DISCRETE_TYPE_AUDIO,
73 MAILMIME_DISCRETE_TYPE_VIDEO,
74 MAILMIME_DISCRETE_TYPE_APPLICATION,
75 MAILMIME_DISCRETE_TYPE_EXTENSION
76};
77
78struct mailmime_discrete_type {
79 int dt_type;
80 char * dt_extension;
81};
82
83enum {
84 MAILMIME_FIELD_NONE,
85 MAILMIME_FIELD_TYPE,
86 MAILMIME_FIELD_TRANSFER_ENCODING,
87 MAILMIME_FIELD_ID,
88 MAILMIME_FIELD_DESCRIPTION,
89 MAILMIME_FIELD_VERSION,
90 MAILMIME_FIELD_DISPOSITION,
91 MAILMIME_FIELD_LANGUAGE,
92};
93
94struct mailmime_field {
95 int fld_type;
96 union {
97 struct mailmime_content * fld_content;
98 struct mailmime_mechanism * fld_encoding;
99 char * fld_id;
100 char * fld_description;
101 uint32_t fld_version;
102 struct mailmime_disposition * fld_disposition;
103 struct mailmime_language * fld_language;
104 } fld_data;
105};
106
107enum {
108 MAILMIME_MECHANISM_ERROR,
109 MAILMIME_MECHANISM_7BIT,
110 MAILMIME_MECHANISM_8BIT,
111 MAILMIME_MECHANISM_BINARY,
112 MAILMIME_MECHANISM_QUOTED_PRINTABLE,
113 MAILMIME_MECHANISM_BASE64,
114 MAILMIME_MECHANISM_TOKEN
115};
116
117struct mailmime_mechanism {
118 int enc_type;
119 char * enc_token;
120};
121
122
123struct mailmime_fields {
124 clist * fld_list; /* list of (struct mailmime_field *) */
125};
126
127
128struct mailmime_parameter {
129 char * pa_name;
130 char * pa_value;
131};
132
133enum {
134 MAILMIME_TYPE_ERROR,
135 MAILMIME_TYPE_DISCRETE_TYPE,
136 MAILMIME_TYPE_COMPOSITE_TYPE
137};
138
139struct mailmime_type {
140 int tp_type;
141 union {
142 struct mailmime_discrete_type * tp_discrete_type;
143 struct mailmime_composite_type * tp_composite_type;
144 } tp_data;
145};
146
147void mailmime_attribute_free(char * attribute);
148
149struct mailmime_composite_type *
150mailmime_composite_type_new(int ct_type, char * ct_token);
151
152void mailmime_composite_type_free(struct mailmime_composite_type * ct);
153
154struct mailmime_content *
155mailmime_content_new(struct mailmime_type * ct_type,
156 char * ct_subtype,
157 clist * ct_parameters);
158
159void mailmime_content_free(struct mailmime_content * content);
160
161void mailmime_description_free(char * description);
162
163struct mailmime_discrete_type *
164mailmime_discrete_type_new(int dt_type, char * dt_extension);
165
166void mailmime_discrete_type_free(struct mailmime_discrete_type *
167 discrete_type);
168
169void mailmime_encoding_free(struct mailmime_mechanism * encoding);
170
171void mailmime_extension_token_free(char * extension);
172
173void mailmime_id_free(char * id);
174
175struct mailmime_mechanism * mailmime_mechanism_new(int enc_type, char * enc_token);
176
177void mailmime_mechanism_free(struct mailmime_mechanism * mechanism);
178
179struct mailmime_parameter *
180mailmime_parameter_new(char * pa_name, char * pa_value);
181
182void mailmime_parameter_free(struct mailmime_parameter * parameter);
183
184void mailmime_subtype_free(char * subtype);
185
186void mailmime_token_free(char * token);
187
188struct mailmime_type *
189mailmime_type_new(int tp_type,
190 struct mailmime_discrete_type * tp_discrete_type,
191 struct mailmime_composite_type * tp_composite_type);
192
193void mailmime_type_free(struct mailmime_type * type);
194
195void mailmime_value_free(char * value);
196
197
198
199struct mailmime_language {
200 clist * lg_list; /* atom (char *) */
201};
202
203struct mailmime_language * mailmime_language_new(clist * lg_list);
204
205void mailmime_language_free(struct mailmime_language * lang);
206
207
208/*
209void mailmime_x_token_free(gchar * x_token);
210*/
211
212struct mailmime_field *
213mailmime_field_new(int fld_type,
214 struct mailmime_content * fld_content,
215 struct mailmime_mechanism * fld_encoding,
216 char * fld_id,
217 char * fld_description,
218 uint32_t fld_version,
219 struct mailmime_disposition * fld_disposition,
220 struct mailmime_language * fld_language);
221
222void mailmime_field_free(struct mailmime_field * field);
223
224struct mailmime_fields * mailmime_fields_new(clist * fld_list);
225
226void mailmime_fields_free(struct mailmime_fields * fields);
227
228
229struct mailmime_multipart_body {
230 clist * bd_list;
231};
232
233struct mailmime_multipart_body *
234mailmime_multipart_body_new(clist * bd_list);
235
236void mailmime_multipart_body_free(struct mailmime_multipart_body * mp_body);
237
238
239enum {
240 MAILMIME_DATA_TEXT,
241 MAILMIME_DATA_FILE,
242};
243
244struct mailmime_data {
245 int dt_type;
246 int dt_encoding;
247 int dt_encoded;
248 union {
249 struct {
250 const char * dt_data;
251 size_t dt_length;
252 } dt_text;
253 char * dt_filename;
254 } dt_data;
255};
256
257struct mailmime_data * mailmime_data_new(int dt_type, int dt_encoding,
258 int dt_encoded, const char * dt_data, size_t dt_length,
259 char * dt_filename);
260
261void mailmime_data_free(struct mailmime_data * mime_data);
262
263
264enum {
265 MAILMIME_NONE,
266 MAILMIME_SINGLE,
267 MAILMIME_MULTIPLE,
268 MAILMIME_MESSAGE,
269};
270
271struct mailmime {
272 /* parent information */
273 int mm_parent_type;
274 struct mailmime * mm_parent;
275 clistiter * mm_multipart_pos;
276
277 int mm_type;
278 const char * mm_mime_start;
279 size_t mm_length;
280
281 struct mailmime_fields * mm_mime_fields;
282 struct mailmime_content * mm_content_type;
283
284 struct mailmime_data * mm_body;
285 union {
286 /* single part */
287 struct mailmime_data * mm_single; /* XXX - was body */
288
289 /* multi-part */
290 struct {
291 struct mailmime_data * mm_preamble;
292 struct mailmime_data * mm_epilogue;
293 clist * mm_mp_list;
294 } mm_multipart;
295
296 /* message */
297 struct {
298 struct mailimf_fields * mm_fields;
299 struct mailmime * mm_msg_mime;
300 } mm_message;
301
302 } mm_data;
303};
304
305struct mailmime * mailmime_new(int mm_type,
306 const char * mm_mime_start, size_t mm_length,
307 struct mailmime_fields * mm_mime_fields,
308 struct mailmime_content * mm_content_type,
309 struct mailmime_data * mm_body,
310 struct mailmime_data * mm_preamble,
311 struct mailmime_data * mm_epilogue,
312 clist * mm_mp_list,
313 struct mailimf_fields * mm_fields,
314 struct mailmime * mm_msg_mime);
315
316void mailmime_free(struct mailmime * mime);
317
318struct mailmime_encoded_word {
319 char * wd_charset;
320 char * wd_text;
321};
322
323struct mailmime_encoded_word *
324mailmime_encoded_word_new(char * wd_charset, char * wd_text);
325
326void mailmime_encoded_word_free(struct mailmime_encoded_word * ew);
327
328void mailmime_charset_free(char * charset);
329
330void mailmime_encoded_text_free(char * text);
331
332
333struct mailmime_disposition {
334 struct mailmime_disposition_type * dsp_type;
335 clist * dsp_parms; /* struct mailmime_disposition_parm */
336};
337
338
339enum {
340 MAILMIME_DISPOSITION_TYPE_ERROR,
341 MAILMIME_DISPOSITION_TYPE_INLINE,
342 MAILMIME_DISPOSITION_TYPE_ATTACHMENT,
343 MAILMIME_DISPOSITION_TYPE_EXTENSION
344};
345
346struct mailmime_disposition_type {
347 int dsp_type;
348 char * dsp_extension;
349};
350
351
352enum {
353 MAILMIME_DISPOSITION_PARM_FILENAME,
354 MAILMIME_DISPOSITION_PARM_CREATION_DATE,
355 MAILMIME_DISPOSITION_PARM_MODIFICATION_DATE,
356 MAILMIME_DISPOSITION_PARM_READ_DATE,
357 MAILMIME_DISPOSITION_PARM_SIZE,
358 MAILMIME_DISPOSITION_PARM_PARAMETER
359};
360
361struct mailmime_disposition_parm {
362 int pa_type;
363 union {
364 char * pa_filename;
365 char * pa_creation_date;
366 char * pa_modification_date;
367 char * pa_read_date;
368 size_t pa_size;
369 struct mailmime_parameter * pa_parameter;
370 } pa_data;
371};
372
373struct mailmime_disposition *
374mailmime_disposition_new(struct mailmime_disposition_type * dsp_type,
375 clist * dsp_parms);
376
377void mailmime_disposition_free(struct mailmime_disposition * dsp);
378
379struct mailmime_disposition_type *
380mailmime_disposition_type_new(int dt_type, char * dt_extension);
381
382void mailmime_disposition_type_free(struct mailmime_disposition_type * dsp_type);
383
384struct mailmime_disposition_parm *
385mailmime_disposition_parm_new(int pa_type,
386 char * pa_filename,
387 char * pa_creation_date,
388 char * pa_modification_date,
389 char * pa_read_date,
390 size_t pa_size,
391 struct mailmime_parameter * pa_parameter);
392
393void mailmime_disposition_parm_free(struct mailmime_disposition_parm *
394 dsp_parm);
395
396void mailmime_filename_parm_free(char * filename);
397
398void mailmime_creation_date_parm_free(char * date);
399
400void mailmime_modification_date_parm_free(char * date);
401
402void mailmime_read_date_parm_free(char * date);
403
404void mailmime_quoted_date_time_free(char * date);
405
406struct mailmime_section {
407 clist * sec_list; /* list of (uint32 *) */
408};
409
410struct mailmime_section * mailmime_section_new(clist * list);
411
412void mailmime_section_free(struct mailmime_section * section);
413
414
415void mailmime_decoded_part_free(char * part);
416
417struct mailmime_single_fields {
418 struct mailmime_content * fld_content;
419 char * fld_content_charset;
420 char * fld_content_boundary;
421 char * fld_content_name;
422 struct mailmime_mechanism * fld_encoding;
423 char * fld_id;
424 char * fld_description;
425 uint32_t fld_version;
426 struct mailmime_disposition * fld_disposition;
427 char * fld_disposition_filename;
428 char * fld_disposition_creation_date;
429 char * fld_disposition_modification_date;
430 char * fld_disposition_read_date;
431 size_t fld_disposition_size;
432 struct mailmime_language * fld_language;
433};
434
435#ifdef __cplusplus
436}
437#endif
438
439#endif
440
diff --git a/kmicromail/libetpan/include/libetpan/mailmime_types_helper.h b/kmicromail/libetpan/include/libetpan/mailmime_types_helper.h
new file mode 100644
index 0000000..608acca
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmime_types_helper.h
@@ -0,0 +1,165 @@
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 MAILMIME_TYPES_HELPER_H
37
38#define MAILMIME_TYPES_HELPER_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailmime_types.h>
45
46int mailmime_transfer_encoding_get(struct mailmime_fields * fields);
47
48struct mailmime_disposition *
49mailmime_disposition_new_filename(int type, char * filename);
50
51struct mailmime_fields * mailmime_fields_new_empty(void);
52
53int mailmime_fields_add(struct mailmime_fields * fields,
54 struct mailmime_field * field);
55
56struct mailmime_fields *
57mailmime_fields_new_with_data(struct mailmime_mechanism * encoding,
58 char * id,
59 char * description,
60 struct mailmime_disposition * disposition,
61 struct mailmime_language * language);
62
63struct mailmime_fields *
64mailmime_fields_new_with_version(struct mailmime_mechanism * encoding,
65 char * id,
66 char * description,
67 struct mailmime_disposition * disposition,
68 struct mailmime_language * language);
69
70struct mailmime_content * mailmime_get_content_message(void);
71struct mailmime_content * mailmime_get_content_text(void);
72/* struct mailmime_content * mailmime_get_content(char * mime_type); */
73
74#define mailmime_get_content mailmime_content_new_with_str
75
76struct mailmime_data *
77mailmime_data_new_data(int encoding, int encoded,
78 const char * data, size_t length);
79
80struct mailmime_data *
81mailmime_data_new_file(int encoding, int encoded,
82 char * filename);
83
84#if 0
85struct mailmime *
86mailmime_new_message_file(char * filename);
87
88struct mailmime *
89mailmime_new_message_text(char * data_str, size_t length);
90#endif
91
92struct mailmime *
93mailmime_new_message_data(struct mailmime * msg_mime);
94
95struct mailmime *
96mailmime_new_empty(struct mailmime_content * content,
97 struct mailmime_fields * mime_fields);
98
99int
100mailmime_new_with_content(const char * content_type,
101 struct mailmime_fields * mime_fields,
102 struct mailmime ** result);
103
104int mailmime_set_preamble_file(struct mailmime * build_info,
105 char * filename);
106
107int mailmime_set_epilogue_file(struct mailmime * build_info,
108 char * filename);
109
110int mailmime_set_preamble_text(struct mailmime * build_info,
111 char * data_str, size_t length);
112
113int mailmime_set_epilogue_text(struct mailmime * build_info,
114 char * data_str, size_t length);
115
116int mailmime_set_body_file(struct mailmime * build_info,
117 char * filename);
118
119int mailmime_set_body_text(struct mailmime * build_info,
120 char * data_str, size_t length);
121
122int mailmime_add_part(struct mailmime * build_info,
123 struct mailmime * part);
124
125void mailmime_remove_part(struct mailmime * mime);
126
127void mailmime_set_imf_fields(struct mailmime * build_info,
128 struct mailimf_fields * fields);
129
130
131struct mailmime_disposition *
132mailmime_disposition_new_with_data(int type,
133 char * filename, char * creation_date, char * modification_date,
134 char * read_date, size_t size);
135
136void mailmime_single_fields_init(struct mailmime_single_fields * single_fields,
137 struct mailmime_fields * fld_fields,
138 struct mailmime_content * fld_content);
139
140struct mailmime_single_fields *
141mailmime_single_fields_new(struct mailmime_fields * fld_fields,
142 struct mailmime_content * fld_content);
143
144void mailmime_single_fields_free(struct mailmime_single_fields *
145 single_fields);
146
147int mailmime_smart_add_part(struct mailmime * mime,
148 struct mailmime * mime_sub);
149
150int mailmime_smart_remove_part(struct mailmime * mime);
151
152struct mailmime_content * mailmime_content_new_with_str(const char * str);
153
154struct mailmime_fields * mailmime_fields_new_encoding(int type);
155
156struct mailmime * mailmime_multiple_new(const char * type);
157
158struct mailmime_fields * mailmime_fields_new_filename(int dsp_type,
159 char * filename, int encoding_type);
160
161#ifdef __cplusplus
162}
163#endif
164
165#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailmime_write.h b/kmicromail/libetpan/include/libetpan/mailmime_write.h
new file mode 100644
index 0000000..96f8777
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailmime_write.h
@@ -0,0 +1,73 @@
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 MAILMIME_WRITE_H
37
38#define MAILMIME_WRITE_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailmime_types.h>
45#include <stdio.h>
46
47int mailmime_fields_write(FILE * f, int * col,
48 struct mailmime_fields * fields);
49
50int mailmime_content_write(FILE * f, int * col,
51 struct mailmime_content * content);
52
53int mailmime_content_type_write(FILE * f, int * col,
54 struct mailmime_content * content);
55
56int mailmime_write(FILE * f, int * col,
57 struct mailmime * build_info);
58
59int mailmime_quoted_printable_write(FILE * f, int * col, int istext,
60 const char * text, size_t size);
61
62int mailmime_base64_write(FILE * f, int * col,
63 const char * text, size_t size);
64
65int mailmime_data_write(FILE * f, int * col,
66 struct mailmime_data * data,
67 int istext);
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailpop3.h b/kmicromail/libetpan/include/libetpan/mailpop3.h
new file mode 100644
index 0000000..b8552ab
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailpop3.h
@@ -0,0 +1,100 @@
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 MAILPOP3_H
37
38#define MAILPOP3_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailpop3_types.h>
45
46#include <libetpan/mailpop3_helper.h>
47
48#include <libetpan/mailpop3_socket.h>
49#include <libetpan/mailpop3_ssl.h>
50
51#define POP3_STRING_SIZE 513
52
53mailpop3 * mailpop3_new(size_t pop3_progr_rate,
54 progress_function * pop3_progr_fun);
55
56void mailpop3_free(mailpop3 * f);
57
58int mailpop3_connect(mailpop3 * f, mailstream * s);
59
60int mailpop3_quit(mailpop3 * f);
61
62
63int mailpop3_apop(mailpop3 * f, const char * user, const char * password);
64
65int mailpop3_user(mailpop3 * f, const char * user);
66
67int mailpop3_pass(mailpop3 * f, const char * password);
68
69void mailpop3_list(mailpop3 * f, carray ** result);
70
71int mailpop3_retr(mailpop3 * f, uint32_t index, char ** result,
72 size_t * result_len);
73
74int mailpop3_top(mailpop3 * f, uint32_t index, uint32_t count,
75 char ** result, size_t * result_len);
76
77int mailpop3_dele(mailpop3 * f, uint32_t index);
78
79int mailpop3_noop(mailpop3 * f);
80
81int mailpop3_rset(mailpop3 * f);
82
83void mailpop3_top_free(char * str);
84
85void mailpop3_retr_free(char * str);
86
87int mailpop3_get_msg_info(mailpop3 * f, uint32_t index,
88 struct mailpop3_msg_info ** result);
89
90int mailpop3_capa(mailpop3 * f, clist ** result);
91
92void mailpop3_capa_resp_free(clist * capa_list);
93
94int mailpop3_stls(mailpop3 * f);
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailpop3_helper.h b/kmicromail/libetpan/include/libetpan/mailpop3_helper.h
new file mode 100644
index 0000000..7337ad8
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailpop3_helper.h
@@ -0,0 +1,64 @@
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 MAILPOP3_HELPER_H
37
38#define MAILPOP3_HELPER_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include "mailpop3.h"
45
46int mailpop3_login_apop(mailpop3 * f,
47 char * user,
48 char * password);
49
50int mailpop3_login(mailpop3 * f,
51 char * user,
52 char * password);
53
54int mailpop3_header(mailpop3 * f, uint32_t index, char ** result,
55 size_t * result_len);
56
57void mailpop3_header_free(char * str);
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif
64
diff --git a/kmicromail/libetpan/include/libetpan/mailpop3_socket.h b/kmicromail/libetpan/include/libetpan/mailpop3_socket.h
new file mode 100644
index 0000000..06f16f5
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailpop3_socket.h
@@ -0,0 +1,54 @@
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 MAILPOP3_SOCKET_H
37
38#define MAILPOP3_SOCKET_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45
46#include <libetpan/mailpop3_types.h>
47
48int mailpop3_socket_connect(mailpop3 * f, const char * server, uint16_t port);
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailpop3_ssl.h b/kmicromail/libetpan/include/libetpan/mailpop3_ssl.h
new file mode 100644
index 0000000..926001c
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailpop3_ssl.h
@@ -0,0 +1,54 @@
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 MAILPOP3_SSL_H
37
38#define MAILPOP3_SSL_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45
46#include <libetpan/mailpop3_types.h>
47
48int mailpop3_ssl_connect(mailpop3 * f, const char * server, uint16_t port);
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailpop3_types.h b/kmicromail/libetpan/include/libetpan/mailpop3_types.h
new file mode 100644
index 0000000..20500f6
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailpop3_types.h
@@ -0,0 +1,107 @@
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 MAILPOP3_TYPES_H
37
38#define MAILPOP3_TYPES_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailstream.h>
45#include <libetpan/mmapstring.h>
46#include <libetpan/carray.h>
47#include <libetpan/clist.h>
48
49#include <inttypes.h>
50
51enum {
52 MAILPOP3_NO_ERROR = 0,
53 MAILPOP3_ERROR_BAD_STATE,
54 MAILPOP3_ERROR_UNAUTHORIZED,
55 MAILPOP3_ERROR_STREAM,
56 MAILPOP3_ERROR_DENIED,
57 MAILPOP3_ERROR_BAD_USER,
58 MAILPOP3_ERROR_BAD_PASSWORD,
59 MAILPOP3_ERROR_CANT_LIST,
60 MAILPOP3_ERROR_NO_SUCH_MESSAGE,
61 MAILPOP3_ERROR_MEMORY,
62 MAILPOP3_ERROR_CONNECTION_REFUSED,
63 MAILPOP3_ERROR_APOP_NOT_SUPPORTED,
64 MAILPOP3_ERROR_CAPA_NOT_SUPPORTED,
65 MAILPOP3_ERROR_STLS_NOT_SUPPORTED,
66};
67
68struct mailpop3
69{
70 char * pop3_response; /* response message */
71 char * pop3_timestamp; /* connection timestamp */
72
73 /* internals */
74 mailstream * pop3_stream;
75 size_t pop3_progr_rate;
76 progress_function * pop3_progr_fun;
77
78 MMAPString * pop3_stream_buffer; /* buffer for lines reading */
79 MMAPString * pop3_response_buffer; /* buffer for responses */
80
81 carray * pop3_msg_tab; /* list of pop3_msg_info structures */
82 int pop3_state; /* state */
83
84 unsigned int pop3_deleted_count;
85};
86
87typedef struct mailpop3 mailpop3;
88
89struct mailpop3_msg_info
90{
91 unsigned int msg_index;
92 uint32_t msg_size;
93 char * msg_uidl;
94 int msg_deleted;
95};
96
97
98struct mailpop3_capa {
99 char * cap_name;
100 clist * cap_param; /* (char *) */
101};
102
103#ifdef __cplusplus
104}
105#endif
106
107#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailsmtp.h b/kmicromail/libetpan/include/libetpan/mailsmtp.h
new file mode 100644
index 0000000..548a5b7
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailsmtp.h
@@ -0,0 +1,94 @@
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 MAILSMTP_H
37
38#define MAILSMTP_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mailsmtp_types.h>
45#include <libetpan/mailsmtp_helper.h>
46#include <libetpan/mailsmtp_socket.h>
47#include <libetpan/mailsmtp_ssl.h>
48
49
50mailsmtp * mailsmtp_new(size_t progr_rate,
51 progress_function * progr_fun);
52void mailsmtp_free(mailsmtp * session);
53
54int mailsmtp_connect(mailsmtp * session, mailstream * s);
55int mailsmtp_quit(mailsmtp * session);
56
57/**
58 * Tries AUTH with detected method - "better" method first:
59 * CRAM-MD5 -> PLAIN -> LOGIN
60 */
61int mailsmtp_auth(mailsmtp * session, const char * user, const char * pass);
62
63/**
64 * tries to autenticate with the server using given auth-type
65 * returns MAILSMTP_NO_ERROR on success
66 */
67int mailsmtp_auth_type(mailsmtp * session,
68 const char * user, const char * pass, int type);
69
70int mailsmtp_helo(mailsmtp * session);
71int mailsmtp_mail(mailsmtp * session, const char * from);
72int mailsmtp_rcpt(mailsmtp * session, const char * to);
73int mailsmtp_data(mailsmtp * session);
74int mailsmtp_data_message(mailsmtp * session,
75 const char * message,
76 size_t size);
77int mailesmtp_ehlo(mailsmtp * session);
78int mailesmtp_mail(mailsmtp * session,
79 const char * from,
80 int return_full,
81 const char * envid);
82int mailesmtp_rcpt(mailsmtp * session,
83 const char * to,
84 int notify,
85 const char * orcpt);
86int mailesmtp_starttls(mailsmtp * session);
87
88const char * mailsmtp_strerror(int errnum);
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailsmtp_helper.h b/kmicromail/libetpan/include/libetpan/mailsmtp_helper.h
new file mode 100644
index 0000000..6bbe3c9
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailsmtp_helper.h
@@ -0,0 +1,74 @@
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 MAILSMTP_HELPER_H
37
38#define MAILSMTP_HELPER_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include "mailsmtp_types.h"
45#include "clist.h"
46
47int mailsmtp_init(mailsmtp * session);
48
49int mailesmtp_send(mailsmtp * session,
50 const char * from,
51 int return_full,
52 const char * envid,
53 clist * addresses,
54 const char * message, size_t size);
55
56int mailsmtp_send(mailsmtp * session,
57 const char * from,
58 clist * addresses,
59 const char * message, size_t size);
60
61clist * esmtp_address_list_new();
62int esmtp_address_list_add(clist * list, char * address,
63 int notify, char * orcpt);
64void esmtp_address_list_free(clist * l);
65
66clist * smtp_address_list_new();
67int smtp_address_list_add(clist * list, char * address);
68void smtp_address_list_free(clist * l);
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailsmtp_socket.h b/kmicromail/libetpan/include/libetpan/mailsmtp_socket.h
new file mode 100644
index 0000000..6691d9e
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailsmtp_socket.h
@@ -0,0 +1,56 @@
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 MAILSMTP_SOCKET_H
37
38#define MAILSMTP_SOCKET_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45
46#include <libetpan/mailsmtp_types.h>
47
48int mailsmtp_socket_connect(mailsmtp * session,
49 const char * server, uint16_t port);
50int mailsmtp_socket_starttls(mailsmtp * session);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailsmtp_ssl.h b/kmicromail/libetpan/include/libetpan/mailsmtp_ssl.h
new file mode 100644
index 0000000..9de9732
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailsmtp_ssl.h
@@ -0,0 +1,55 @@
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 MAILSMTP_SSL_H
37
38#define MAILSMTP_SSL_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45
46#include <libetpan/mailsmtp_types.h>
47
48int mailsmtp_ssl_connect(mailsmtp * session,
49 const char * server, uint16_t port);
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailsmtp_types.h b/kmicromail/libetpan/include/libetpan/mailsmtp_types.h
new file mode 100644
index 0000000..b63d5ea
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailsmtp_types.h
@@ -0,0 +1,126 @@
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 MAILSMTP_TYPES_H
37
38#define MAILSMTP_TYPES_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include "mailstream.h"
45#include "mmapstring.h"
46
47enum {
48 MAILSMTP_NO_ERROR = 0,
49 MAILSMTP_ERROR_UNEXPECTED_CODE,
50 MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE,
51 MAILSMTP_ERROR_STREAM,
52 MAILSMTP_ERROR_HOSTNAME,
53 MAILSMTP_ERROR_NOT_IMPLEMENTED,
54 MAILSMTP_ERROR_ACTION_NOT_TAKEN,
55 MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION,
56 MAILSMTP_ERROR_IN_PROCESSING,
57 MAILSMTP_ERROR_INSUFFICIENT_SYSTEM_STORAGE,
58 MAILSMTP_ERROR_MAILBOX_UNAVAILABLE,
59 MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED,
60 MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND,
61 MAILSMTP_ERROR_USER_NOT_LOCAL,
62 MAILSMTP_ERROR_TRANSACTION_FAILED,
63 MAILSMTP_ERROR_MEMORY,
64 MAILSMTP_ERROR_AUTH_NOT_SUPPORTED,
65 MAILSMTP_ERROR_AUTH_LOGIN,
66 MAILSMTP_ERROR_AUTH_REQUIRED,
67 MAILSMTP_ERROR_AUTH_TOO_WEAK,
68 MAILSMTP_ERROR_AUTH_TRANSITION_NEEDED,
69 MAILSMTP_ERROR_AUTH_TEMPORARY_FAILTURE,
70 MAILSMTP_ERROR_AUTH_ENCRYPTION_REQUIRED,
71 MAILSMTP_ERROR_STARTTLS_TEMPORARY_FAILURE,
72 MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED,
73 MAILSMTP_ERROR_CONNECTION_REFUSED
74};
75
76enum {
77 MAILSMTP_AUTH_NOT_CHECKED = 0,
78 MAILSMTP_AUTH_CHECKED = 1,
79 MAILSMTP_AUTH_CRAM_MD5 = 2,
80 MAILSMTP_AUTH_PLAIN = 4,
81 MAILSMTP_AUTH_LOGIN = 8
82};
83
84enum {
85 MAILSMTP_ESMTP = 1,
86 MAILSMTP_ESMTP_EXPN = 2,
87 MAILSMTP_ESMTP_8BITMIME = 4,
88 MAILSMTP_ESMTP_SIZE = 8,
89 MAILSMTP_ESMTP_ETRN = 16,
90 MAILSMTP_ESMTP_STARTTLS = 32,
91 MAILSMTP_ESMTP_DSN = 64,
92};
93
94struct mailsmtp {
95 mailstream * stream;
96
97 size_t progr_rate;
98 progress_function * progr_fun;
99
100 char * response;
101
102 MMAPString * line_buffer;
103 MMAPString * response_buffer;
104
105 int esmtp; // contains flags MAILSMTP_ESMTP_*
106 int auth; // contains flags MAILSMTP_AUTH_*
107};
108
109typedef struct mailsmtp mailsmtp;
110
111#define MAILSMTP_DSN_NOTIFY_SUCCESS 1
112#define MAILSMTP_DSN_NOTIFY_FAILURE 2
113#define MAILSMTP_DSN_NOTIFY_DELAY 4
114#define MAILSMTP_DSN_NOTIFY_NEVER 8
115
116struct esmtp_address {
117 char * address;
118 int notify;
119 char * orcpt;
120};
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailstorage.h b/kmicromail/libetpan/include/libetpan/mailstorage.h
new file mode 100644
index 0000000..d56aef1
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailstorage.h
@@ -0,0 +1,98 @@
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 MAIL_STORAGE_H
37
38#define MAIL_STORAGE_H
39
40#include <libetpan/maildriver_types.h>
41#include <libetpan/mailstorage_types.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/* storage */
48
49/*
50 mailstorage_new
51
52 This function creates an empty storage. This storage have to be initialized.
53 The "driver" and "data" fields should be initialized.
54
55 @param id is the name of the storage. It can be NULL.
56 The given parameter is no more needed when the creation is finished.
57 The given string is duplicated.
58
59 @return The mail storage is returned.
60*/
61
62struct mailstorage * mailstorage_new(char * sto_id);
63
64void mailstorage_free(struct mailstorage * storage);
65
66/*
67 session will be initialized on success.
68*/
69
70int mailstorage_connect(struct mailstorage * storage);
71
72void mailstorage_disconnect(struct mailstorage * storage);
73
74
75/* folder */
76
77struct mailfolder * mailfolder_new(struct mailstorage * fld_storage,
78 char * fld_pathname, char * fld_virtual_name);
79
80void mailfolder_free(struct mailfolder * folder);
81
82int mailfolder_add_child(struct mailfolder * parent,
83 struct mailfolder * child);
84
85int mailfolder_detach_parent(struct mailfolder * folder);
86
87int mailfolder_connect(struct mailfolder * folder);
88
89void mailfolder_disconnect(struct mailfolder * folder);
90
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif
97
98
diff --git a/kmicromail/libetpan/include/libetpan/mailstorage_types.h b/kmicromail/libetpan/include/libetpan/mailstorage_types.h
new file mode 100644
index 0000000..5e08f80
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailstorage_types.h
@@ -0,0 +1,203 @@
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 MAILSTORAGE_TYPES_H
37
38#define MAILSTORAGE_TYPES_H
39
40#include <libetpan/maildriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46struct mailstorage;
47
48typedef struct mailstorage_driver mailstorage_driver;
49
50
51/*
52 There is three kinds of identities :
53 - storage
54 - folders
55 - session
56
57 A storage (struct mailstorage) represents whether a server or
58 a main path,
59
60 A storage can be an IMAP server, the root path of a MH or a mbox file.
61
62 Folders (struct mailfolder) are the mailboxes we can
63 choose in the server or as sub-folder of the main path.
64
65 Folders for IMAP are the IMAP mailboxes, for MH this is one of the
66 folder of the MH storage, for mbox, there is only one folder, the
67 mbox file content;
68
69 A mail session (struct mailsession) is whether a connection to a server
70 or a path that is open. It is the abstraction lower folders and storage.
71 It allow us to send commands.
72
73 We have a session driver for mail session for each kind of storage.
74
75 From a session, we can get a message (struct mailmessage) to read.
76 We have a message driver for each kind of storage.
77*/
78
79/*
80 mailstorage_driver is the driver structure for mail storages
81
82 - name is the name of the driver
83
84 - connect() connects the storage to the remote access or to
85 the path in the local filesystem.
86
87 - get_folder() can have two kinds of behaviour.
88 Either it creates a new session and independant from the session
89 used by the storage and select the given mailbox or
90 it selects the given mailbox in the current session.
91 It depends on the efficiency of the mail driver.
92
93 - uninitialize() frees the data created with mailstorage constructor.
94*/
95
96struct mailstorage_driver {
97 char * sto_name;
98 int (* sto_connect)(struct mailstorage * storage);
99 int (* sto_get_folder_session)(struct mailstorage * storage,
100 char * pathname, mailsession ** result);
101 void (* sto_uninitialize)(struct mailstorage * storage);
102};
103
104/*
105 mailstorage is the data structure for a storage
106
107 - id is the name of the storage, it can be NULL.
108
109 - data is the data specific to the driver.
110 This is the internal state of the storage.
111
112 - session is the session related to the storage.
113
114 - driver is the driver for the storage.
115
116 - shared_folders is the list of folders returned by the storage.
117*/
118
119struct mailstorage {
120 char * sto_id;
121 void * sto_data;
122 mailsession * sto_session;
123 mailstorage_driver * sto_driver;
124 clist * sto_shared_folders; /* list of (struct mailfolder *) */
125
126 void * sto_user_data;
127};
128
129
130
131/*
132 mailfolder is the data structure for a mailbox
133
134 - pathname is the path of the mailbox on the storage
135
136 - virtual_name is the folder identifier, it can be a path,
137 a name or NULL.
138
139 - storage is the storage to which the folder belongs to.
140
141 - session is the session related to the folder. It can be
142 different of the session of the storage.
143
144 - shared_session is != 0 if the session is the same as the
145 session of the storage.
146
147 - pos is the position of the folder in the "shared_folders" field
148 of the storage.
149
150 folders can be chained into a tree.
151
152 - parent is the parent of the folder.
153
154 - sibling_index is the index of the folder in the list of children
155 of the parent.
156
157 - children is the folder.
158*/
159
160struct mailfolder {
161 char * fld_pathname;
162 char * fld_virtual_name;
163
164 struct mailstorage * fld_storage;
165
166 mailsession * fld_session;
167 int fld_shared_session;
168 clistiter * fld_pos;
169
170 struct mailfolder * fld_parent;
171 unsigned int fld_sibling_index;
172 carray * fld_children; /* array of (struct mailfolder *) */
173
174 void * fld_user_data;
175};
176
177/*
178 this is the type of socket connection
179*/
180
181enum {
182 CONNECTION_TYPE_PLAIN, /* when the connection is plain text */
183 CONNECTION_TYPE_STARTTLS, /* when the connection is first plain,
184 then, we want to switch to
185 TLS (secure connection) */
186 CONNECTION_TYPE_TRY_STARTTLS, /* the connection is first plain,
187 then, we will try to switch to TLS */
188 CONNECTION_TYPE_TLS, /* the connection is over TLS */
189 CONNECTION_TYPE_COMMAND, /* the connection is over a shell command */
190 CONNECTION_TYPE_COMMAND_STARTTLS, /* the connection is over a shell
191 command and STARTTLS will be used */
192 CONNECTION_TYPE_COMMAND_TRY_STARTTLS, /* the connection is over
193 a shell command and STARTTLS will
194 be tried */
195 CONNECTION_TYPE_COMMAND_TLS, /* the connection is over a shell
196 command in TLS */
197};
198
199#ifdef __cplusplus
200}
201#endif
202
203#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailstream.h b/kmicromail/libetpan/include/libetpan/mailstream.h
new file mode 100644
index 0000000..a4e35cd
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailstream.h
@@ -0,0 +1,73 @@
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 MAILSTREAM_H
37
38#define MAILSTREAM_H
39
40#include <sys/time.h>
41
42#include <libetpan/mailstream_low.h>
43#include <libetpan/mailstream_helper.h>
44#include <libetpan/mailstream_socket.h>
45#include <libetpan/mailstream_ssl.h>
46#include <libetpan/mailstream_types.h>
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52mailstream * mailstream_new(mailstream_low * low, size_t buffer_size);
53ssize_t mailstream_write(mailstream * s, const void * buf, size_t count);
54ssize_t mailstream_read(mailstream * s, void * buf, size_t count);
55int mailstream_close(mailstream * s);
56int mailstream_flush(mailstream * s);
57ssize_t mailstream_feed_read_buffer(mailstream * s);
58mailstream_low * mailstream_get_low(mailstream * s);
59void mailstream_set_low(mailstream * s, mailstream_low * low);
60
61#ifdef LIBETPAN_MAILSTREAM_DEBUG
62extern int mailstream_debug;
63#endif
64
65#define LIBETPAN_MAILSTREAM_NETWORK_DELAY
66extern struct timeval mailstream_network_delay;
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif
73
diff --git a/kmicromail/libetpan/include/libetpan/mailstream_helper.h b/kmicromail/libetpan/include/libetpan/mailstream_helper.h
new file mode 100644
index 0000000..d030b1d
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailstream_helper.h
@@ -0,0 +1,70 @@
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 MAILSTREAM_HELPER_H
37
38#define MAILSTREAM_HELPER_H
39
40#include <libetpan/mmapstring.h>
41#include <libetpan/mailstream.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47char * mailstream_read_line(mailstream * stream, MMAPString * line);
48
49char * mailstream_read_line_append(mailstream * stream, MMAPString * line);
50
51char * mailstream_read_line_remove_eol(mailstream * stream, MMAPString * line);
52
53char * mailstream_read_multiline(mailstream * s, size_t size,
54 MMAPString * stream_buffer,
55 MMAPString * multiline_buffer,
56 size_t progr_rate,
57 progress_function * progr_fun);
58
59int mailstream_is_end_multiline(const char * line);
60
61int mailstream_send_data(mailstream * s, const char * message,
62 size_t size,
63 size_t progr_rate,
64 progress_function * progr_fun);
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailstream_low.h b/kmicromail/libetpan/include/libetpan/mailstream_low.h
new file mode 100644
index 0000000..fb8914c
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailstream_low.h
@@ -0,0 +1,62 @@
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 MAILSTREAM_LOW_H
37
38#define MAILSTREAM_LOW_H
39
40#include <sys/types.h>
41#include <libetpan/mailstream_types.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/* general functions */
48
49mailstream_low * mailstream_low_new(void * data,
50 mailstream_low_driver * driver);
51ssize_t mailstream_low_write(mailstream_low * s,
52 const void * buf, size_t count);
53ssize_t mailstream_low_read(mailstream_low * s, void * buf, size_t count);
54int mailstream_low_close(mailstream_low * s);
55int mailstream_low_get_fd(mailstream_low * s);
56void mailstream_low_free(mailstream_low * s);
57
58#ifdef __cplusplus
59}
60#endif
61
62#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailstream_socket.h b/kmicromail/libetpan/include/libetpan/mailstream_socket.h
new file mode 100644
index 0000000..6a26e33
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailstream_socket.h
@@ -0,0 +1,61 @@
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 MAILSTREAM_SOCKET_H
37
38#define MAILSTREAM_SOCKET_H
39
40#include <libetpan/mailstream.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/* socket */
47
48extern mailstream_low_driver * mailstream_socket_driver;
49
50mailstream_low * mailstream_low_socket_open(int fd);
51mailstream * mailstream_socket_open(int fd);
52
53struct mailstream_socket_data {
54 int fd;
55};
56
57#ifdef __cplusplus
58}
59#endif
60
61#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailstream_ssl.h b/kmicromail/libetpan/include/libetpan/mailstream_ssl.h
new file mode 100644
index 0000000..a37b3d4
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailstream_ssl.h
@@ -0,0 +1,59 @@
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 MAILSTREAM_SSL_H
37
38#define MAILSTREAM_SSL_H
39
40#include <libetpan/mailstream.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/* socket */
47
48#ifdef USE_SSL
49extern mailstream_low_driver * mailstream_ssl_driver;
50#endif
51
52mailstream_low * mailstream_low_ssl_open(int fd);
53mailstream * mailstream_ssl_open(int fd);
54
55#ifdef __cplusplus
56}
57#endif
58
59#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailstream_types.h b/kmicromail/libetpan/include/libetpan/mailstream_types.h
new file mode 100644
index 0000000..2165149
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailstream_types.h
@@ -0,0 +1,87 @@
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 MAILSTREAM_TYPES_H
37
38#define MAILSTREAM_TYPES_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#define LIBETPAN_MAILSTREAM_DEBUG
45
46struct _mailstream;
47
48typedef struct _mailstream mailstream;
49
50struct _mailstream_low;
51
52typedef struct _mailstream_low mailstream_low;
53
54struct _mailstream {
55 size_t buffer_max_size;
56
57 char * write_buffer;
58 size_t write_buffer_len;
59
60 char * read_buffer;
61 size_t read_buffer_len;
62
63 mailstream_low * low;
64};
65
66struct mailstream_low_driver {
67 ssize_t (* mailstream_read)(mailstream_low *, void *, size_t);
68 ssize_t (* mailstream_write)(mailstream_low *, const void *, size_t);
69 int (* mailstream_close)(mailstream_low *);
70 int (* mailstream_get_fd)(mailstream_low *);
71 void (* mailstream_free)(mailstream_low *);
72};
73
74typedef struct mailstream_low_driver mailstream_low_driver;
75
76struct _mailstream_low {
77 void * data;
78 mailstream_low_driver * driver;
79};
80
81typedef void progress_function(size_t current, size_t maximum);
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailthread.h b/kmicromail/libetpan/include/libetpan/mailthread.h
new file mode 100644
index 0000000..e4e33ff
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailthread.h
@@ -0,0 +1,108 @@
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 MAILTHREAD_H
37
38#define MAILTHREAD_H
39
40#include <libetpan/mailthread_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 mail_build_thread constructs a tree with the message using the
48 given style.
49
50 @param type is the type of threading to apply, the value can be
51 MAIL_THREAD_REFERENCES, MAIL_THREAD_REFERENCES_NO_SUBJECT or
52 MAIL_THREAD_ORDEREDSUBJECT.
53
54 @param default_from is the default charset to use whenever the
55 subject is not tagged with a charset. "US-ASCII" can be used
56 if you don't know what to use.
57
58 @param env_list is the message list (with header fields fetched)
59 to use to build the message tree.
60
61 @param result * result) will contain the resulting message tree.
62
63 @param if comp_func is NULL, no sorting algorithm is used.
64
65 @return MAIL_NO_ERROR is returned on success, MAIL_ERROR_XXX is returned
66 on error
67*/
68
69int mail_build_thread(int type, char * default_from,
70 struct mailmessage_list * env_list,
71 struct mailmessage_tree ** result,
72 int (* comp_func)(struct mailmessage_tree **,
73 struct mailmessage_tree **));
74
75/*
76 mail_thread_sort sort the messages in the message tree, using the
77 given sort function.
78
79 @param tree is the message tree to sort.
80
81 @param comp_func is the sort function to use (this is the same kind of
82 functions than those used for qsort()). mailthread_tree_timecomp can be
83 used for default sort.
84
85 @param sort_sub if this value is 0, only the children of the root message
86 are sorted.
87*/
88
89int mail_thread_sort(struct mailmessage_tree * tree,
90 int (* comp_func)(struct mailmessage_tree **,
91 struct mailmessage_tree **),
92 int sort_sub);
93
94/*
95 mailthread_tree_timecomp is the default sort function.
96
97 The message are compared by date, then by message numbers.
98 The tree are given in (* ptree1) and (* ptree2).
99*/
100
101int mailthread_tree_timecomp(struct mailmessage_tree ** ptree1,
102 struct mailmessage_tree ** ptree2);
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif
diff --git a/kmicromail/libetpan/include/libetpan/mailthread_types.h b/kmicromail/libetpan/include/libetpan/mailthread_types.h
new file mode 100644
index 0000000..5ef7b46
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mailthread_types.h
@@ -0,0 +1,63 @@
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 MAILTHREAD_TYPES_H
37
38#define MAILTHREAD_TYPES_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/maildriver_types.h>
45#include <libetpan/mailmessage_types.h>
46
47/*
48 This is the type of tree construction to apply.
49*/
50
51enum {
52 MAIL_THREAD_REFERENCES, /* this is threading using
53 References fields only) */
54 MAIL_THREAD_REFERENCES_NO_SUBJECT, /* this is threading using References
55 fields, then subject */
56 MAIL_THREAD_ORDEREDSUBJECT, /* this is threading using only subject */
57};
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif
diff --git a/kmicromail/libetpan/include/libetpan/mboxdriver.h b/kmicromail/libetpan/include/libetpan/mboxdriver.h
new file mode 100644
index 0000000..c598026
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mboxdriver.h
@@ -0,0 +1,52 @@
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 MBOXDRIVER_H
37
38#define MBOXDRIVER_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/mboxdriver_types.h>
45
46extern mailsession_driver * mbox_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/mboxdriver_cached.h b/kmicromail/libetpan/include/libetpan/mboxdriver_cached.h
new file mode 100644
index 0000000..b0d8dbf
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mboxdriver_cached.h
@@ -0,0 +1,54 @@
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 MBOXDRIVER_CACHED_H
37
38#define MBOXDRIVER_CACHED_H
39
40#include <libetpan/libetpan-config.h>
41
42#include <libetpan/mboxdriver_types.h>
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48extern mailsession_driver * mbox_cached_session_driver;
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif
diff --git a/kmicromail/libetpan/include/libetpan/mboxdriver_cached_message.h b/kmicromail/libetpan/include/libetpan/mboxdriver_cached_message.h
new file mode 100644
index 0000000..a6673b3
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mboxdriver_cached_message.h
@@ -0,0 +1,52 @@
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 MBOXDRIVER_CACHED_MESSAGE_H
37
38#define MBOXDRIVER_CACHED_MESSAGE_H
39
40#include <libetpan/mailmessage.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * mbox_cached_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/mboxdriver_message.h b/kmicromail/libetpan/include/libetpan/mboxdriver_message.h
new file mode 100644
index 0000000..cdabd23
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mboxdriver_message.h
@@ -0,0 +1,52 @@
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 MBOXDRIVER_MESSAGE_H
37
38#define MBOXDRIVER_MESSAGE_H
39
40#include <libetpan/mboxdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * mbox_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/mboxdriver_types.h b/kmicromail/libetpan/include/libetpan/mboxdriver_types.h
new file mode 100644
index 0000000..be31ea3
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mboxdriver_types.h
@@ -0,0 +1,107 @@
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 MBOXDRIVER_TYPES_H
37
38#define MBOXDRIVER_TYPES_H
39
40#include <libetpan/maildriver_types.h>
41#include <libetpan/mailmbox.h>
42#include <libetpan/mailstorage_types.h>
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/* mbox driver */
49
50enum {
51 MBOXDRIVER_SET_READ_ONLY = 1,
52 MBOXDRIVER_SET_NO_UID,
53};
54
55struct mbox_session_state_data {
56 struct mailmbox_folder * mbox_folder;
57 int mbox_force_read_only;
58 int mbox_force_no_uid;
59};
60
61/* cached version */
62
63enum {
64 /* the mapping of the parameters should be the same as for mbox */
65 MBOXDRIVER_CACHED_SET_READ_ONLY = 1,
66 MBOXDRIVER_CACHED_SET_NO_UID,
67 /* cache specific */
68 MBOXDRIVER_CACHED_SET_CACHE_DIRECTORY,
69 MBOXDRIVER_CACHED_SET_FLAGS_DIRECTORY,
70};
71
72struct mbox_cached_session_state_data {
73 mailsession * mbox_ancestor;
74 char * mbox_quoted_mb;
75 char mbox_cache_directory[PATH_MAX];
76 char mbox_flags_directory[PATH_MAX];
77 struct mail_flags_store * mbox_flags_store;
78};
79
80/* mbox storage */
81
82/*
83 mbox_mailstorage is the state data specific to the mbox storage.
84
85 - pathname is the filename that contains the mailbox.
86
87 - cached if this value is != 0, a persistant cache will be
88 stored on local system.
89
90 - cache_directory is the location of the cache.
91
92 - flags_directory is the location of the flags.
93*/
94
95struct mbox_mailstorage {
96 char * mbox_pathname;
97
98 int mbox_cached;
99 char * mbox_cache_directory;
100 char * mbox_flags_directory;
101};
102
103#ifdef __cplusplus
104}
105#endif
106
107#endif
diff --git a/kmicromail/libetpan/include/libetpan/mboxstorage.h b/kmicromail/libetpan/include/libetpan/mboxstorage.h
new file mode 100644
index 0000000..e5e83ce
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mboxstorage.h
@@ -0,0 +1,69 @@
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 MBOXSTORAGE_H
37
38#define MBOXSTORAGE_H
39
40#include <libetpan/mboxdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 mbox_mailstorage_init is the constructor for a mbox storage.
48
49 @param storage this is the storage to initialize.
50
51 @param pathname is the filename that contains the mailbox.
52
53 @param cached if this value is != 0, a persistant cache will be
54 stored on local system.
55
56 @param cache_directory is the location of the cache
57
58 @param flags_directory is the location of the flags
59*/
60
61int mbox_mailstorage_init(struct mailstorage * storage,
62 char * mb_pathname, int mb_cached,
63 char * mb_cache_directory, char * mb_flags_directory);
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif
diff --git a/kmicromail/libetpan/include/libetpan/mhdriver.h b/kmicromail/libetpan/include/libetpan/mhdriver.h
new file mode 100644
index 0000000..a82b9c1
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mhdriver.h
@@ -0,0 +1,52 @@
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 MHDRIVER_H
37
38#define MHDRIVER_H
39
40#include <libetpan/maildriver.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailsession_driver * mh_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/mhdriver_cached.h b/kmicromail/libetpan/include/libetpan/mhdriver_cached.h
new file mode 100644
index 0000000..4a07e7d
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mhdriver_cached.h
@@ -0,0 +1,52 @@
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 MHDRIVER_CACHED_H
37
38#define MHDRIVER_CACHED_H
39
40#include <libetpan/mhdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailsession_driver * mh_cached_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/mhdriver_cached_message.h b/kmicromail/libetpan/include/libetpan/mhdriver_cached_message.h
new file mode 100644
index 0000000..f3ed089
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mhdriver_cached_message.h
@@ -0,0 +1,52 @@
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 MHDRIVER_CACHED_MESSAGE_H
37
38#define MHDRIVER_CACHED_MESSAGE_H
39
40#include <libetpan/mhdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * mh_cached_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/mhdriver_message.h b/kmicromail/libetpan/include/libetpan/mhdriver_message.h
new file mode 100644
index 0000000..a7cb2cf
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mhdriver_message.h
@@ -0,0 +1,52 @@
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 MHDRIVER_MESSAGE_H
37
38#define MHDRIVER_MESSAGE_H
39
40#include <libetpan/mhdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * mh_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/mhdriver_types.h b/kmicromail/libetpan/include/libetpan/mhdriver_types.h
new file mode 100644
index 0000000..09c6cc6
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mhdriver_types.h
@@ -0,0 +1,100 @@
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 MHDRIVER_TYPES_H
37
38#define MHDRIVER_TYPES_H
39
40#include <libetpan/libetpan-config.h>
41
42#include <libetpan/maildriver_types.h>
43#include <libetpan/mailmh.h>
44#include <libetpan/clist.h>
45#include <libetpan/generic_cache_types.h>
46#include <libetpan/mailstorage_types.h>
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52struct mh_session_state_data {
53 struct mailmh * mh_session;
54
55 struct mailmh_folder * mh_cur_folder;
56
57 clist * mh_subscribed_list;
58};
59
60enum {
61 MHDRIVER_CACHED_SET_CACHE_DIRECTORY = 1,
62 MHDRIVER_CACHED_SET_FLAGS_DIRECTORY,
63};
64
65struct mh_cached_session_state_data {
66 mailsession * mh_ancestor;
67 char * mh_quoted_mb;
68 char mh_cache_directory[PATH_MAX];
69 char mh_flags_directory[PATH_MAX];
70 struct mail_flags_store * mh_flags_store;
71};
72
73/* mh storage */
74
75/*
76 mh_mailstorage is the state data specific to the MH storage.
77
78 - pathname is the root path of the MH storage.
79
80 - cached if this value is != 0, a persistant cache will be
81 stored on local system.
82
83 - cache_directory is the location of the cache.
84
85 - flags_directory is the location of the flags.
86*/
87
88struct mh_mailstorage {
89 char * mh_pathname;
90
91 int mh_cached;
92 char * mh_cache_directory;
93 char * mh_flags_directory;
94};
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif
diff --git a/kmicromail/libetpan/include/libetpan/mhstorage.h b/kmicromail/libetpan/include/libetpan/mhstorage.h
new file mode 100644
index 0000000..245bc81
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mhstorage.h
@@ -0,0 +1,67 @@
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 MHSTORAGE_H
37
38#define MHSTORAGE_H
39
40#include <libetpan/mhdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 mh_mailstorage_init is the constructor for a MH storage
48
49 @param pathname is the filename the root path of the MH storage.
50
51 @param cached if this value is != 0, a persistant cache will be
52 stored on local system.
53
54 @param cache_directory is the location of the cache.
55
56 @param flags_directory is the location of the flags.
57*/
58
59int mh_mailstorage_init(struct mailstorage * storage,
60 char * mh_pathname, int mh_cached,
61 char * mh_cache_directory, char * mh_flags_directory);
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif
diff --git a/kmicromail/libetpan/include/libetpan/mime_message_driver.h b/kmicromail/libetpan/include/libetpan/mime_message_driver.h
new file mode 100644
index 0000000..ffcdd5c
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mime_message_driver.h
@@ -0,0 +1,52 @@
1/*
2 * libEtPan! -- a mail stuff library
3 *
4 * Copyright (C) 2001 - 2003 - 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 MIME_MESSAGE_DRIVER_H
37
38#define MIME_MESSAGE_DRIVER_H
39
40#include <libetpan/mailmessage.h>
41
42#define LIBETPAN_MIME_MESSAGE
43
44extern mailmessage_driver * mime_message_driver;
45
46mailmessage * mime_message_init(struct mailmime * mime);
47
48void mime_message_detach_mime(mailmessage * msg);
49
50int mime_message_set_tmpdir(mailmessage * msg, char * tmpdir);
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/mmapstring.h b/kmicromail/libetpan/include/libetpan/mmapstring.h
new file mode 100644
index 0000000..6d7227d
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/mmapstring.h
@@ -0,0 +1,136 @@
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 __MMAP_STRING_H__
37
38#define __MMAP_STRING_H__
39
40#include <sys/types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47#define TMPDIR "/tmp"
48*/
49
50typedef struct _MMAPString MMAPString;
51
52struct _MMAPString
53{
54 char * str;
55 size_t len;
56 size_t allocated_len;
57 int fd;
58 size_t mmapped_size;
59 /*
60 char * old_non_mmapped_str;
61 */
62};
63
64/* configure location of mmaped files */
65
66void mmap_string_set_tmpdir(char * directory);
67
68/* Strings
69 */
70
71MMAPString * mmap_string_new (const char * init);
72
73MMAPString * mmap_string_new_len (const char * init,
74 size_t len);
75
76MMAPString * mmap_string_sized_new (size_t dfl_size);
77
78void mmap_string_free (MMAPString * string);
79
80MMAPString * mmap_string_assign (MMAPString * string,
81 const char * rval);
82
83MMAPString * mmap_string_truncate (MMAPString *string,
84 size_t len);
85
86MMAPString * mmap_string_set_size (MMAPString * string,
87 size_t len);
88
89MMAPString * mmap_string_insert_len (MMAPString * string,
90 size_t pos,
91 const char * val,
92 size_t len);
93
94MMAPString * mmap_string_append (MMAPString * string,
95 const char * val);
96
97MMAPString * mmap_string_append_len (MMAPString * string,
98 const char * val,
99 size_t len);
100
101MMAPString * mmap_string_append_c (MMAPString * string,
102 char c);
103
104MMAPString * mmap_string_prepend (MMAPString * string,
105 const char * val);
106
107MMAPString * mmap_string_prepend_c (MMAPString * string,
108 char c);
109
110MMAPString * mmap_string_prepend_len (MMAPString * string,
111 const char * val,
112 size_t len);
113
114MMAPString * mmap_string_insert (MMAPString * string,
115 size_t pos,
116 const char * val);
117
118MMAPString * mmap_string_insert_c (MMAPString *string,
119 size_t pos,
120 char c);
121
122MMAPString * mmap_string_erase(MMAPString * string,
123 size_t pos,
124 size_t len);
125
126void mmap_string_set_ceil(size_t ceil);
127
128int mmap_string_ref(MMAPString * string);
129int mmap_string_unref(char * str);
130
131#ifdef __cplusplus
132}
133#endif
134
135
136#endif /* __MMAP_STRING_H__ */
diff --git a/kmicromail/libetpan/include/libetpan/newsnntp.h b/kmicromail/libetpan/include/libetpan/newsnntp.h
new file mode 100644
index 0000000..13360d0
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/newsnntp.h
@@ -0,0 +1,188 @@
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 NEWSNNTP_H
37
38#define NEWSNNTP_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45#include <sys/types.h>
46#include <time.h>
47
48#include <libetpan/clist.h>
49#include <libetpan/mailstream.h>
50#include <libetpan/newsnntp_socket.h>
51#include <libetpan/newsnntp_ssl.h>
52#include <libetpan/newsnntp_types.h>
53
54
55newsnntp * newsnntp_new(size_t nntp_progr_rate,
56 progress_function * nntp_progr_fun);
57void newsnntp_free(newsnntp * f);
58
59int newsnntp_quit(newsnntp * f);
60int newsnntp_connect(newsnntp * f, mailstream * s);
61
62int newsnntp_head(newsnntp * f, uint32_t index, char ** result,
63 size_t * result_len);
64int newsnntp_article(newsnntp * f, uint32_t index, char ** result,
65 size_t * result_len);
66int newsnntp_body(newsnntp * f, uint32_t index, char ** result,
67 size_t * result_len);
68
69void newsnntp_head_free(char * str);
70void newsnntp_article_free(char * str);
71void newsnntp_body_free(char * str);
72
73int newsnntp_mode_reader(newsnntp * f);
74
75int newsnntp_date(newsnntp * f, struct tm * tm);
76
77int newsnntp_authinfo_generic(newsnntp * f, const char * authentificator,
78 const char * arguments);
79
80int newsnntp_authinfo_username(newsnntp * f, const char * username);
81int newsnntp_authinfo_password(newsnntp * f, const char * password);
82
83int newsnntp_post(newsnntp * f, const char * message, size_t size);
84
85
86
87
88
89
90/******************* requests ******************************/
91
92int newsnntp_group(newsnntp * f, const char * groupname,
93 struct newsnntp_group_info ** info);
94void newsnntp_group_free(struct newsnntp_group_info * info);
95
96/*
97 elements are struct newsnntp_group_info *
98 */
99
100int newsnntp_list(newsnntp * f, clist ** result);
101void newsnntp_list_free(clist * l);
102
103/*
104 elements are char *
105*/
106
107int newsnntp_list_overview_fmt(newsnntp * f, clist ** result);
108void newsnntp_list_overview_fmt_free(clist * l);
109
110/*
111 elements are struct newsnntp_group_info *
112*/
113
114int newsnntp_list_active(newsnntp * f, const char * wildcard, clist ** result);
115void newsnntp_list_active_free(clist * l);
116
117/*
118 elements are struct newsnntp_group_time *
119*/
120
121int newsnntp_list_active_times(newsnntp * f, clist ** result);
122void newsnntp_list_active_times_free(clist * l);
123
124/*
125 elements are struct newsnntp_distrib_value_meaning *
126*/
127
128int newsnntp_list_distribution(newsnntp * f, clist ** result);
129void newsnntp_list_distribution_free(clist * l);
130
131/*
132 elements are struct newsnntp_distrib_default_value *
133*/
134
135int newsnntp_list_distrib_pats(newsnntp * f, clist ** result);
136void newsnntp_list_distrib_pats_free(clist * l);
137
138/*
139 elements are struct newsnntp_group_description *
140*/
141
142int newsnntp_list_newsgroups(newsnntp * f, const char * pattern,
143 clist ** result);
144void newsnntp_list_newsgroups_free(clist * l);
145
146/*
147 elements are char *
148*/
149
150int newsnntp_list_subscriptions(newsnntp * f, clist ** result);
151void newsnntp_list_subscriptions_free(clist * l);
152
153/*
154 elements are uint32_t *
155*/
156
157int newsnntp_listgroup(newsnntp * f, const char * group_name,
158 clist ** result);
159void newsnntp_listgroup_free(clist * l);
160
161/*
162 elements are struct newsnntp_xhdr_resp_item *
163*/
164
165int newsnntp_xhdr_single(newsnntp * f, const char * header, uint32_t article,
166 clist ** result);
167int newsnntp_xhdr_range(newsnntp * f, const char * header,
168 uint32_t rangeinf, uint32_t rangesup,
169 clist ** result);
170void newsnntp_xhdr_free(clist * l);
171
172/*
173 elements are struct newsnntp_xover_resp_item *
174*/
175
176int newsnntp_xover_single(newsnntp * f, uint32_t article,
177 struct newsnntp_xover_resp_item ** result);
178int newsnntp_xover_range(newsnntp * f, uint32_t rangeinf, uint32_t rangesup,
179 clist ** result);
180void newsnntp_xover_free(clist * l);
181void xover_resp_item_free(struct newsnntp_xover_resp_item * n);
182void newsnntp_xover_resp_list_free(clist * l);
183
184#ifdef __cplusplus
185}
186#endif
187
188#endif
diff --git a/kmicromail/libetpan/include/libetpan/newsnntp_socket.h b/kmicromail/libetpan/include/libetpan/newsnntp_socket.h
new file mode 100644
index 0000000..fd44b44
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/newsnntp_socket.h
@@ -0,0 +1,55 @@
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 NEWSNNTP_SOCKET_H
37
38#define NEWSNNTP_SOCKET_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <sys/types.h>
45#include <inttypes.h>
46
47#include <libetpan/newsnntp_types.h>
48
49int newsnntp_socket_connect(newsnntp * f, const char * server, uint16_t port);
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif
diff --git a/kmicromail/libetpan/include/libetpan/newsnntp_ssl.h b/kmicromail/libetpan/include/libetpan/newsnntp_ssl.h
new file mode 100644
index 0000000..59eace5
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/newsnntp_ssl.h
@@ -0,0 +1,55 @@
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 NEWSNNTP_SSL_H
37
38#define NEWSNNTP_SSL_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <sys/types.h>
45#include <inttypes.h>
46
47#include <libetpan/newsnntp_types.h>
48
49int newsnntp_ssl_connect(newsnntp * f, const char * server, uint16_t port);
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif
diff --git a/kmicromail/libetpan/include/libetpan/newsnntp_types.h b/kmicromail/libetpan/include/libetpan/newsnntp_types.h
new file mode 100644
index 0000000..0501088
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/newsnntp_types.h
@@ -0,0 +1,144 @@
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 NEWSNNTP_TYPES_H
37
38#define NEWSNNTP_TYPES_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <inttypes.h>
45#include <libetpan/clist.h>
46
47#include <libetpan/mailstream.h>
48#include <libetpan/mmapstring.h>
49
50enum {
51 NEWSNNTP_NO_ERROR = 0,
52 NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_USERNAME,
53 NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_PASSWORD,
54 NEWSNNTP_ERROR_STREAM,
55 NEWSNNTP_ERROR_UNEXPECTED,
56 NEWSNNTP_ERROR_NO_NEWSGROUP_SELECTED,
57 NEWSNNTP_ERROR_NO_ARTICLE_SELECTED,
58 NEWSNNTP_ERROR_INVALID_ARTICLE_NUMBER,
59 NEWSNNTP_ERROR_ARTICLE_NOT_FOUND,
60 NEWSNNTP_ERROR_UNEXPECTED_RESPONSE,
61 NEWSNNTP_ERROR_INVALID_RESPONSE,
62 NEWSNNTP_ERROR_NO_SUCH_NEWS_GROUP,
63 NEWSNNTP_ERROR_POSTING_NOT_ALLOWED,
64 NEWSNNTP_ERROR_POSTING_FAILED,
65 NEWSNNTP_ERROR_PROGRAM_ERROR,
66 NEWSNNTP_ERROR_NO_PERMISSION,
67 NEWSNNTP_ERROR_COMMAND_NOT_UNDERSTOOD,
68 NEWSNNTP_ERROR_COMMAND_NOT_SUPPORTED,
69 NEWSNNTP_ERROR_CONNECTION_REFUSED,
70 NEWSNNTP_ERROR_MEMORY,
71 NEWSNNTP_ERROR_AUTHENTICATION_REJECTED,
72 NEWSNNTP_ERROR_BAD_STATE,
73};
74
75struct newsnntp
76{
77 mailstream * nntp_stream;
78
79 int nntp_readonly;
80
81 uint32_t nntp_progr_rate;
82 progress_function * nntp_progr_fun;
83
84 MMAPString * nntp_stream_buffer;
85 MMAPString * nntp_response_buffer;
86
87 char * nntp_response;
88};
89
90typedef struct newsnntp newsnntp;
91
92struct newsnntp_group_info
93{
94 char * grp_name;
95 uint32_t grp_first;
96 uint32_t grp_last;
97 uint32_t grp_count;
98 char grp_type;
99};
100
101struct newsnntp_group_time {
102 char * grp_name;
103 uint32_t grp_date;
104 char * grp_email;
105};
106
107struct newsnntp_distrib_value_meaning {
108 char * dst_value;
109 char * dst_meaning;
110};
111
112struct newsnntp_distrib_default_value {
113 uint32_t dst_weight;
114 char * dst_group_pattern;
115 char * dst_value;
116};
117
118struct newsnntp_group_description {
119 char * grp_name;
120 char * grp_description;
121};
122
123struct newsnntp_xhdr_resp_item {
124 uint32_t hdr_article;
125 char * hdr_value;
126};
127
128struct newsnntp_xover_resp_item {
129 uint32_t ovr_article;
130 char * ovr_subject;
131 char * ovr_author;
132 char * ovr_date;
133 char * ovr_message_id;
134 char * ovr_references;
135 size_t ovr_size;
136 uint32_t ovr_line_count;
137 clist * ovr_others;
138};
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif
diff --git a/kmicromail/libetpan/include/libetpan/nntpdriver.h b/kmicromail/libetpan/include/libetpan/nntpdriver.h
new file mode 100644
index 0000000..45bfeab
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/nntpdriver.h
@@ -0,0 +1,52 @@
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 NNTPDRIVER_H
37
38#define NNTPDRIVER_H
39
40#include <libetpan/nntpdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailsession_driver * nntp_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/nntpdriver_cached.h b/kmicromail/libetpan/include/libetpan/nntpdriver_cached.h
new file mode 100644
index 0000000..feb576b
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/nntpdriver_cached.h
@@ -0,0 +1,52 @@
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 NNTPDRIVER_CACHED_H
37
38#define NNTPDRIVER_CACHED_H
39
40#include <libetpan/nntpdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailsession_driver * nntp_cached_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/nntpdriver_cached_message.h b/kmicromail/libetpan/include/libetpan/nntpdriver_cached_message.h
new file mode 100644
index 0000000..c12f479
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/nntpdriver_cached_message.h
@@ -0,0 +1,52 @@
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#include <libetpan/mailmessage_types.h>
37
38#ifndef NNTPDRIVER_CACHED_MESSAGE_H
39
40#define NNTPDRIVER_CACHED_MESSAGE_H
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * nntp_cached_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/nntpdriver_message.h b/kmicromail/libetpan/include/libetpan/nntpdriver_message.h
new file mode 100644
index 0000000..3b12a2d
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/nntpdriver_message.h
@@ -0,0 +1,52 @@
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 NNTPDRIVER_MESSAGE_H
37
38#define NNTPDRIVER_MESSAGE_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/nntpdriver_types.h>
45
46extern mailmessage_driver * nntp_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/nntpdriver_types.h b/kmicromail/libetpan/include/libetpan/nntpdriver_types.h
new file mode 100644
index 0000000..6492788
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/nntpdriver_types.h
@@ -0,0 +1,146 @@
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 NNTPDRIVER_TYPES_H
37
38#define NNTPDRIVER_TYPES_H
39
40#include <libetpan/libetpan-config.h>
41
42#include <libetpan/maildriver_types.h>
43#include <libetpan/newsnntp.h>
44#include <libetpan/clist.h>
45#include <libetpan/generic_cache_types.h>
46#include <libetpan/mailstorage_types.h>
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/* NNTP driver for session */
53
54enum {
55 NNTPDRIVER_SET_MAX_ARTICLES = 1,
56};
57
58struct nntp_session_state_data {
59 newsnntp * nntp_session;
60 char * nntp_userid;
61 char * nntp_password;
62
63 struct newsnntp_group_info * nntp_group_info;
64 char * nntp_group_name;
65
66 clist * nntp_subscribed_list;
67
68 uint32_t nntp_max_articles;
69
70 int nntp_mode_reader;
71};
72
73/* cached NNTP driver for session */
74
75enum {
76 /* the mapping of the parameters should be the same as for nntp */
77 NNTPDRIVER_CACHED_SET_MAX_ARTICLES = 1,
78 /* cache specific */
79 NNTPDRIVER_CACHED_SET_CACHE_DIRECTORY,
80 NNTPDRIVER_CACHED_SET_FLAGS_DIRECTORY,
81};
82
83struct nntp_cached_session_state_data {
84 mailsession * nntp_ancestor;
85 char nntp_cache_directory[PATH_MAX];
86 char nntp_flags_directory[PATH_MAX];
87 struct mail_flags_store * nntp_flags_store;
88};
89
90
91/* nntp storage */
92
93/*
94 nntp_mailstorage is the state data specific to the IMAP4rev1 storage.
95
96 - storage this is the storage to initialize.
97
98 - servername this is the name of the NNTP server
99
100 - port is the port to connect to, on the server.
101 you give 0 to use the default port.
102
103 - connection_type is the type of socket layer to use.
104 The value can be CONNECTION_TYPE_PLAIN or CONNECTION_TYPE_TLS.
105
106 - auth_type is the authenticate mechanism to use.
107 The value can be NNTP_AUTH_TYPE_PLAIN.
108
109 - login is the login of the POP3 account.
110
111 - password is the password of the POP3 account.
112
113 - cached if this value is != 0, a persistant cache will be
114 stored on local system.
115
116 - cache_directory is the location of the cache
117
118 - flags_directory is the location of the flags
119*/
120
121struct nntp_mailstorage {
122 char * nntp_servername;
123 uint16_t nntp_port;
124 char * nntp_command;
125 int nntp_connection_type;
126
127 int nntp_auth_type;
128 char * nntp_login;
129 char * nntp_password;
130
131 int nntp_cached;
132 char * nntp_cache_directory;
133 char * nntp_flags_directory;
134};
135
136/* this is the type of NNTP authentication */
137
138enum {
139 NNTP_AUTH_TYPE_PLAIN, /* plain text authentication */
140};
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif
diff --git a/kmicromail/libetpan/include/libetpan/nntpstorage.h b/kmicromail/libetpan/include/libetpan/nntpstorage.h
new file mode 100644
index 0000000..794c717
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/nntpstorage.h
@@ -0,0 +1,93 @@
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 NNTPSTORAGE_H
37
38#define NNTPSTORAGE_H
39
40#include <libetpan/nntpdriver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46
47/*
48 nntp_mailstorage_init is the constructor for a NNTP storage
49
50 @param storage this is the storage to initialize.
51
52 @param servername this is the name of the NNTP server
53
54 @param port is the port to connect to, on the server.
55 you give 0 to use the default port.
56
57 @param command the command used to connect to the server instead of
58 allowing normal TCP connections to be used.
59
60 @param connection_type is the type of socket layer to use.
61 The value can be CONNECTION_TYPE_PLAIN, CONNECTION_TYPE_STARTTLS,
62 CONNECTION_TYPE_TRY_STARTTLS, CONNECTION_TYPE_TLS,
63 CONNECTION_TYPE_COMMAND, CONNECTION_TYPE_COMMAND_STARTTLS,
64 CONNECTION_TYPE_COMMAND_TRY_STARTTLS, CONNECTION_TYPE_COMMAND_TLS,.
65
66 @param auth_type is the authenticate mechanism to use.
67 The value can be NNTP_AUTH_TYPE_PLAIN.
68
69 @param login is the login of the POP3 account.
70
71 @param password is the password of the POP3 account.
72
73 @param cached if this value is != 0, a persistant cache will be
74 stored on local system.
75
76 @param cache_directory is the location of the cache
77
78 @param flags_directory is the location of the flags
79*/
80
81int nntp_mailstorage_init(struct mailstorage * storage,
82 char * nntp_servername, uint16_t nntp_port,
83 char * nntp_command,
84 int nntp_connection_type, int nntp_auth_type,
85 char * nntp_login, char * nntp_password,
86 int nntp_cached, char * nntp_cache_directory,
87 char * nntp_flags_directory);
88
89#ifdef __cplusplus
90}
91#endif
92
93#endif
diff --git a/kmicromail/libetpan/include/libetpan/pop3driver.h b/kmicromail/libetpan/include/libetpan/pop3driver.h
new file mode 100644
index 0000000..2df94db
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/pop3driver.h
@@ -0,0 +1,52 @@
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 POP3DRIVER_H
37
38#define POP3DRIVER_H
39
40#include <libetpan/pop3driver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailsession_driver * pop3_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/pop3driver_cached.h b/kmicromail/libetpan/include/libetpan/pop3driver_cached.h
new file mode 100644
index 0000000..953e699
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/pop3driver_cached.h
@@ -0,0 +1,52 @@
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 POP3DRIVER_CACHED_H
37
38#define POP3DRIVER_CACHED_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/pop3driver_types.h>
45
46extern mailsession_driver * pop3_cached_session_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/pop3driver_cached_message.h b/kmicromail/libetpan/include/libetpan/pop3driver_cached_message.h
new file mode 100644
index 0000000..d03f8e5
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/pop3driver_cached_message.h
@@ -0,0 +1,52 @@
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 POP3DRIVER_CACHED_MESSAGE_H
37
38#define POP3DRIVER_CACHED_MESSAGE_H
39
40#include <libetpan/pop3driver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * pop3_cached_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/pop3driver_message.h b/kmicromail/libetpan/include/libetpan/pop3driver_message.h
new file mode 100644
index 0000000..6281a39
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/pop3driver_message.h
@@ -0,0 +1,52 @@
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 POP3DRIVER_MESSAGE_H
37
38#define POP3DRIVER_MESSAGE_H
39
40#include <libetpan/pop3driver_types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46extern mailmessage_driver * pop3_message_driver;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif
diff --git a/kmicromail/libetpan/include/libetpan/pop3driver_types.h b/kmicromail/libetpan/include/libetpan/pop3driver_types.h
new file mode 100644
index 0000000..73286d8
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/pop3driver_types.h
@@ -0,0 +1,153 @@
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 POP3DRIVER_TYPES_H
37
38#define POP3DRIVER_TYPES_H
39
40#include <libetpan/libetpan-config.h>
41
42#include <libetpan/maildriver_types.h>
43#include <libetpan/mailpop3.h>
44#include <libetpan/maildriver_types.h>
45#include <libetpan/chash.h>
46#include <libetpan/mailstorage_types.h>
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/* POP3 driver for session */
53
54enum {
55 POP3DRIVER_SET_AUTH_TYPE = 1,
56};
57
58enum {
59 POP3DRIVER_AUTH_TYPE_PLAIN = 0,
60 POP3DRIVER_AUTH_TYPE_APOP,
61 POP3DRIVER_AUTH_TYPE_TRY_APOP,
62};
63
64struct pop3_session_state_data {
65 int pop3_auth_type;
66 mailpop3 * pop3_session;
67};
68
69/* cached POP3 driver for session */
70
71enum {
72 /* the mapping of the parameters should be the same as for pop3 */
73 POP3DRIVER_CACHED_SET_AUTH_TYPE = 1,
74 /* cache specific */
75 POP3DRIVER_CACHED_SET_CACHE_DIRECTORY,
76 POP3DRIVER_CACHED_SET_FLAGS_DIRECTORY,
77};
78
79struct pop3_cached_session_state_data {
80 mailsession * pop3_ancestor;
81 char pop3_cache_directory[PATH_MAX];
82 char pop3_flags_directory[PATH_MAX];
83 chash * pop3_flags_hash;
84 carray * pop3_flags_array;
85 struct mail_flags_store * pop3_flags_store;
86};
87
88/* pop3 storage */
89
90/*
91 pop3_mailstorage is the state data specific to the POP3 storage.
92
93 - servername this is the name of the POP3 server
94
95 - port is the port to connect to, on the server.
96 you give 0 to use the default port.
97
98 - connection_type is the type of socket layer to use.
99 The value can be CONNECTION_TYPE_PLAIN, CONNECTION_TYPE_STARTTLS,
100 CONNECTION_TYPE_TRY_STARTTLS or CONNECTION_TYPE_TLS.
101
102 - auth_type is the authenticate mechanism to use.
103 The value can be POP3_AUTH_TYPE_PLAIN, POP3_AUTH_TYPE_APOP
104 or POP3_AUTH_TYPE_TRY_APOP. Other values are not yet implemented.
105
106 - login is the login of the POP3 account.
107
108 - password is the password of the POP3 account.
109
110 - cached if this value is != 0, a persistant cache will be
111 stored on local system.
112
113 - cache_directory is the location of the cache.
114
115 - flags_directory is the location of the flags.
116*/
117
118struct pop3_mailstorage {
119 char * pop3_servername;
120 uint16_t pop3_port;
121 char * pop3_command;
122 int pop3_connection_type;
123
124 int pop3_auth_type;
125 char * pop3_login;
126 char * pop3_password;
127
128 int pop3_cached;
129 char * pop3_cache_directory;
130 char * pop3_flags_directory;
131};
132
133/* this is the type of POP3 authentication */
134
135enum {
136 POP3_AUTH_TYPE_PLAIN, /* plain text authentication */
137 POP3_AUTH_TYPE_APOP, /* APOP authentication */
138 POP3_AUTH_TYPE_TRY_APOP, /* first, try APOP, if it fails,
139 try plain text */
140 POP3_AUTH_TYPE_SASL_ANONYMOUS, /* SASL anonymous */
141 POP3_AUTH_TYPE_SASL_CRAM_MD5, /* SASL CRAM MD5 */
142 POP3_AUTH_TYPE_SASL_KERBEROS_V4, /* SASL KERBEROS V4 */
143 POP3_AUTH_TYPE_SASL_PLAIN, /* SASL plain */
144 POP3_AUTH_TYPE_SASL_SCRAM_MD5, /* SASL SCRAM MD5 */
145 POP3_AUTH_TYPE_SASL_GSSAPI, /* SASL GSSAPI */
146 POP3_AUTH_TYPE_SASL_DIGEST_MD5, /* SASL digest MD5 */
147};
148
149#ifdef __cplusplus
150}
151#endif
152
153#endif
diff --git a/kmicromail/libetpan/include/libetpan/pop3storage.h b/kmicromail/libetpan/include/libetpan/pop3storage.h
new file mode 100644
index 0000000..c2118b6
--- a/dev/null
+++ b/kmicromail/libetpan/include/libetpan/pop3storage.h
@@ -0,0 +1,95 @@
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 POP3STORAGE_H
37
38#define POP3STORAGE_H
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <libetpan/pop3driver_types.h>
45#include <libetpan/pop3driver.h>
46#include <libetpan/pop3driver_cached.h>
47
48/*
49 pop3_mailstorage_init is the constructor for a POP3 storage
50
51 @param storage this is the storage to initialize.
52
53 @param servername this is the name of the POP3 server
54
55 @param port is the port to connect to, on the server.
56 you give 0 to use the default port.
57
58 @param command the command used to connect to the server instead of
59 allowing normal TCP connections to be used.
60
61 @param connection_type is the type of socket layer to use.
62 The value can be CONNECTION_TYPE_PLAIN, CONNECTION_TYPE_STARTTLS,
63 CONNECTION_TYPE_TRY_STARTTLS, CONNECTION_TYPE_TLS,
64 CONNECTION_TYPE_COMMAND, CONNECTION_TYPE_COMMAND_STARTTLS,
65 CONNECTION_TYPE_COMMAND_TRY_STARTTLS, CONNECTION_TYPE_COMMAND_TLS,.
66
67 @param auth_type is the authenticate mechanism to use.
68 The value can be POP3_AUTH_TYPE_PLAIN, POP3_AUTH_TYPE_APOP
69 or POP3_AUTH_TYPE_TRY_APOP. Other values are not yet implemented.
70
71 @param login is the login of the POP3 account.
72
73 @param password is the password of the POP3 account.
74
75 @param cached if this value is != 0, a persistant cache will be
76 stored on local system.
77
78 @param cache_directory is the location of the cache
79
80 @param flags_directory is the location of the flags
81*/
82
83int pop3_mailstorage_init(struct mailstorage * storage,
84 char * pop3_servername, uint16_t pop3_port,
85 char * pop3_command,
86 int pop3_connection_type, int pop3_auth_type,
87 char * pop3_login, char * pop3_password,
88 int pop3_cached, char * pop3_cache_directory,
89 char * pop3_flags_directory);
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif