annotate src/lib-mail/message-parser.h @ 4906:0c3c948412c5 HEAD

Type safe callbacks weren't as easy as I thought. Only callback(void *context) can be handled generically. Others can be handled specially, but only if all the parameters are pointers, otherwise eg. int parameter can be replaced with long without compiler giving any warnings.
author Timo Sirainen <tss@iki.fi>
date Fri, 15 Dec 2006 20:10:51 +0200
parents 204d7edc7cdc
children 6cd889c652b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 #ifndef __MESSAGE_PARSER_H
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #define __MESSAGE_PARSER_H
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
4 #include "message-header-parser.h"
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
5 #include "message-size.h"
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
6
4603
20e2bc758c24 Removed unused flag and added comment.
Timo Sirainen <tss@iki.fi>
parents: 4267
diff changeset
7 /* Note that these flags are used directly by message-parser-serialize, so
20e2bc758c24 Removed unused flag and added comment.
Timo Sirainen <tss@iki.fi>
parents: 4267
diff changeset
8 existing flags can't be changed without breaking backwards compatibility */
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
9 enum message_part_flags {
106
5fe3e04ca8d9 Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents: 105
diff changeset
10 MESSAGE_PART_FLAG_MULTIPART = 0x01,
5fe3e04ca8d9 Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents: 105
diff changeset
11 MESSAGE_PART_FLAG_MULTIPART_DIGEST = 0x02,
5fe3e04ca8d9 Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents: 105
diff changeset
12 MESSAGE_PART_FLAG_MESSAGE_RFC822 = 0x04,
5fe3e04ca8d9 Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents: 105
diff changeset
13
5fe3e04ca8d9 Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents: 105
diff changeset
14 /* content-type: text/... */
5fe3e04ca8d9 Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents: 105
diff changeset
15 MESSAGE_PART_FLAG_TEXT = 0x08,
5fe3e04ca8d9 Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents: 105
diff changeset
16
4603
20e2bc758c24 Removed unused flag and added comment.
Timo Sirainen <tss@iki.fi>
parents: 4267
diff changeset
17 MESSAGE_PART_FLAG_UNUSED = 0x10,
1534
676995d7c0ca IMAP protocol doesn't allow server to send NULs to client. Send ascii #128
Timo Sirainen <tss@iki.fi>
parents: 1322
diff changeset
18
676995d7c0ca IMAP protocol doesn't allow server to send NULs to client. Send ascii #128
Timo Sirainen <tss@iki.fi>
parents: 1322
diff changeset
19 /* message part header or body contains NULs */
1618
149ade487f48 Ignore Content-* headers if there's no MIME-Version header. Note that this
Timo Sirainen <tss@iki.fi>
parents: 1534
diff changeset
20 MESSAGE_PART_FLAG_HAS_NULS = 0x20,
149ade487f48 Ignore Content-* headers if there's no MIME-Version header. Note that this
Timo Sirainen <tss@iki.fi>
parents: 1534
diff changeset
21
149ade487f48 Ignore Content-* headers if there's no MIME-Version header. Note that this
Timo Sirainen <tss@iki.fi>
parents: 1534
diff changeset
22 /* Mime-Version header exists. */
149ade487f48 Ignore Content-* headers if there's no MIME-Version header. Note that this
Timo Sirainen <tss@iki.fi>
parents: 1534
diff changeset
23 MESSAGE_PART_FLAG_IS_MIME = 0x40
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
24 };
106
5fe3e04ca8d9 Added support for caching of MessagePart data. This is useful for fetching
Timo Sirainen <tss@iki.fi>
parents: 105
diff changeset
25
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
26 struct message_part {
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
27 struct message_part *parent;
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
28 struct message_part *next;
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
29 struct message_part *children;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
30
105
31034993473c there was no need for MessagePart->pos.virtual_pos, so removed it.
Timo Sirainen <tss@iki.fi>
parents: 50
diff changeset
31 uoff_t physical_pos; /* absolute position from beginning of message */
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
32 struct message_size header_size;
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
33 struct message_size body_size;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
34
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 898
diff changeset
35 enum message_part_flags flags;
10
82b7de533f98 s/user_data/context/ and some s/Data/Context/
Timo Sirainen <tss@iki.fi>
parents: 9
diff changeset
36 void *context;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37 };
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
38
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
39 struct message_parser_ctx;
1322
97f8c00b8d4c Better handling for multiline headers. Before we skipped headers larger than
Timo Sirainen <tss@iki.fi>
parents: 1038
diff changeset
40
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
41 struct message_block {
4265
75d5843153f1 Added message_part to struct message_block and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4259
diff changeset
42 /* Message part this block belongs to */
75d5843153f1 Added message_part to struct message_block and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4259
diff changeset
43 struct message_part *part;
75d5843153f1 Added message_part to struct message_block and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4259
diff changeset
44
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
45 /* non-NULL if a header line was read */
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
46 struct message_header_line *hdr;
2404
8ef002a26f1c Added struct message_header_line.middle and middle_len to contain the ':'
Timo Sirainen <tss@iki.fi>
parents: 2150
diff changeset
47
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
48 /* hdr = NULL, size = 0 block returned at the end of headers */
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
49 const unsigned char *data;
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
50 size_t size;
1322
97f8c00b8d4c Better handling for multiline headers. Before we skipped headers larger than
Timo Sirainen <tss@iki.fi>
parents: 1038
diff changeset
51 };
97f8c00b8d4c Better handling for multiline headers. Before we skipped headers larger than
Timo Sirainen <tss@iki.fi>
parents: 1038
diff changeset
52
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
53 /* called once with hdr = NULL at the end of headers */
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
54 typedef void message_part_header_callback_t(struct message_part *part,
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
55 struct message_header_line *hdr,
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
56 void *context);
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
57
4903
204d7edc7cdc Added context parameter type safety checks for most callback APIs.
Timo Sirainen <tss@iki.fi>
parents: 4603
diff changeset
58 extern message_part_header_callback_t *null_message_part_header_callback;
204d7edc7cdc Added context parameter type safety checks for most callback APIs.
Timo Sirainen <tss@iki.fi>
parents: 4603
diff changeset
59
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
60 /* Initialize message parser. part_spool specifies where struct message_parts
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
61 are allocated from. */
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
62 struct message_parser_ctx *
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
63 message_parser_init(pool_t part_pool, struct istream *input);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
64 struct message_part *message_parser_deinit(struct message_parser_ctx **ctx);
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
65
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
66 /* Read the next block of a message. Returns 1 if block is returned, 0 if
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
67 input stream is non-blocking and more data needs to be read, -1 when all is
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
68 done or error occurred (see stream's error status). */
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
69 int message_parser_parse_next_block(struct message_parser_ctx *ctx,
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
70 struct message_block *block_r);
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
71
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
72 /* Read and parse header. */
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
73 void message_parser_parse_header(struct message_parser_ctx *ctx,
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
74 struct message_size *hdr_size,
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
75 message_part_header_callback_t *callback,
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
76 void *context);
4906
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
77 #ifdef CONTEXT_TYPE_SAFETY
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
78 # define message_parser_parse_header(ctx, hdr_size, callback, context) \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
79 ({(void)(1 ? 0 : callback((struct message_part *)0, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
80 (struct message_header_line *)0, context)); \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
81 message_parser_parse_header(ctx, hdr_size, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
82 (message_part_header_callback_t *)callback, context); })
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
83 #else
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
84 # define message_parser_parse_header(ctx, hdr_size, callback, context) \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
85 message_parser_parse_header(ctx, hdr_size, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
86 (message_part_header_callback_t *)callback, context)
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
87 #endif
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
88
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
89 /* Read and parse body. If message is a MIME multipart or message/rfc822
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
90 message, hdr_callback is called for all headers. body_callback is called
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
91 for the body content. */
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
92 void message_parser_parse_body(struct message_parser_ctx *ctx,
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
93 message_part_header_callback_t *hdr_callback,
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
94 void *context);
4906
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
95 #ifdef CONTEXT_TYPE_SAFETY
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
96 # define message_parser_parse_body(ctx, callback, context) \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
97 ({(void)(1 ? 0 : callback((struct message_part *)0, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
98 (struct message_header_line *)0, context)); \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
99 message_parser_parse_body(ctx, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
100 (message_part_header_callback_t *)callback, context); })
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
101 #else
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
102 # define message_parser_parse_body(ctx, callback, context) \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
103 message_parser_parse_body(ctx, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
104 (message_part_header_callback_t *)callback, context)
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
105 #endif
1697
ef79ce6507ff Message parsing can now be done in two parts - header and body. We're now
Timo Sirainen <tss@iki.fi>
parents: 1689
diff changeset
106
4259
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
107 /* callback is called for each field in message header. */
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
108 void message_parse_from_parts(struct message_part *part, struct istream *input,
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
109 message_part_header_callback_t *callback,
fd315deac28f Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3879
diff changeset
110 void *context);
4906
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
111 #ifdef CONTEXT_TYPE_SAFETY
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
112 # define message_parse_from_parts(part, input, callback, context) \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
113 ({(void)(1 ? 0 : callback((struct message_part *)0, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
114 (struct message_header_line *)0, context)); \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
115 message_parse_from_parts(part, input, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
116 (message_part_header_callback_t *)callback, context); })
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
117 #else
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
118 # define message_parse_from_parts(part, input, callback, context) \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
119 message_parse_from_parts(part, input, \
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
120 (message_part_header_callback_t *)callback, context)
0c3c948412c5 Type safe callbacks weren't as easy as I thought. Only callback(void
Timo Sirainen <tss@iki.fi>
parents: 4903
diff changeset
121 #endif
1322
97f8c00b8d4c Better handling for multiline headers. Before we skipped headers larger than
Timo Sirainen <tss@iki.fi>
parents: 1038
diff changeset
122
4267
bd99e8f5e3ac Some fixes and added message_parser_set_crlfs().
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4265
diff changeset
123 /* Update the physical_size of all parts. If use_crlf is TRUE, they're set
bd99e8f5e3ac Some fixes and added message_parser_set_crlfs().
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4265
diff changeset
124 to same as virtual_size. If use_crlf is FALSE, they're set to
bd99e8f5e3ac Some fixes and added message_parser_set_crlfs().
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4265
diff changeset
125 virtual_size - lines. physical_pos fields are also updated. */
bd99e8f5e3ac Some fixes and added message_parser_set_crlfs().
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4265
diff changeset
126 void message_parser_set_crlfs(struct message_part *parts, bool use_crlf);
bd99e8f5e3ac Some fixes and added message_parser_set_crlfs().
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4265
diff changeset
127
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
128 #endif