-
Notifications
You must be signed in to change notification settings - Fork 271
/
imap-bodystructure.h
52 lines (43 loc) · 1.98 KB
/
imap-bodystructure.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef IMAP_BODYSTRUCTURE_H
#define IMAP_BODYSTRUCTURE_H
struct message_part_data {
pool_t pool;
/* NOTE: all the strings are stored via imap_quote(), so they contain
"quoted-text" or {123}\r\nliterals */
const char *content_type, *content_subtype;
const char *content_type_params; /* "key" "value" "key2" "value2" .. */
const char *content_transfer_encoding;
const char *content_id;
const char *content_description;
const char *content_disposition;
const char *content_disposition_params; /* "key" "value" "key2" "value2" .. */
const char *content_md5;
const char *content_language; /* "lang1" "lang2" "lang3" .. */
const char *content_location;
/* either one of these is set, but not both: */
struct message_part_envelope_data *envelope;
const char *envelope_str;
};
struct message_part;
struct message_header_line;
/* Parse a single header. Note that this modifies part->data. */
void imap_bodystructure_parse_header(pool_t pool, struct message_part *part,
struct message_header_line *hdr);
/* Returns TRUE if BODYSTRUCTURE is
("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" n n NIL NIL NIL) */
bool imap_bodystructure_is_plain_7bit(const struct message_part *part)
ATTR_PURE;
/* Write a BODY/BODYSTRUCTURE from given message_part. The message_part->data
field must be set. part->body_size.virtual_size and .lines are also used
for writing it. */
void imap_bodystructure_write(const struct message_part *part,
string_t *dest, bool extended);
/* Parse BODYSTRUCTURE and save the contents to message_part->data for each
message tree node. Returns 0 if ok, -1 if bodystructure wasn't valid. */
int imap_bodystructure_parse(const char *bodystructure, pool_t pool,
struct message_part *parts, const char **error_r);
/* Get BODY part from BODYSTRUCTURE and write it to dest.
Returns 0 if ok, -1 if bodystructure wasn't valid. */
int imap_body_parse_from_bodystructure(const char *bodystructure,
string_t *dest, const char **error_r);
#endif