Mercurial > dovecot > core-2.2
annotate src/lib-mail/message-part-data.c @ 21673:e4b2931f3566
lib-mail: Fix message_part_data_is_plain_7bit()
Content-Type parameters weren't handled exactly right.
Broken by recent changes.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 30 Jan 2017 21:53:01 +0200 |
parents | c7b8d82390d4 |
children | 6ba293f64b49 |
rev | line source |
---|---|
21633
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
1 /* Copyright (c) 2014-2017 Dovecot authors, see the included COPYING file */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
2 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
3 #include "lib.h" |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
4 #include "str.h" |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
5 #include "array.h" |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
6 #include "rfc822-parser.h" |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
7 #include "rfc2231-parser.h" |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
8 #include "message-address.h" |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
9 #include "message-header-parser.h" |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
10 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
11 #include "message-part-data.h" |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
12 |
21634
e2071511ef6d
lib-imap: imap-envelope: Moved imap_envelope_headers to lib-mail/message-part-data as message_part_envelope_headers.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21633
diff
changeset
|
13 const char *message_part_envelope_headers[] = { |
e2071511ef6d
lib-imap: imap-envelope: Moved imap_envelope_headers to lib-mail/message-part-data as message_part_envelope_headers.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21633
diff
changeset
|
14 "Date", "Subject", "From", "Sender", "Reply-To", |
e2071511ef6d
lib-imap: imap-envelope: Moved imap_envelope_headers to lib-mail/message-part-data as message_part_envelope_headers.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21633
diff
changeset
|
15 "To", "Cc", "Bcc", "In-Reply-To", "Message-ID", |
e2071511ef6d
lib-imap: imap-envelope: Moved imap_envelope_headers to lib-mail/message-part-data as message_part_envelope_headers.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21633
diff
changeset
|
16 NULL |
e2071511ef6d
lib-imap: imap-envelope: Moved imap_envelope_headers to lib-mail/message-part-data as message_part_envelope_headers.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21633
diff
changeset
|
17 }; |
e2071511ef6d
lib-imap: imap-envelope: Moved imap_envelope_headers to lib-mail/message-part-data as message_part_envelope_headers.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21633
diff
changeset
|
18 |
21633
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
19 /* |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
20 * |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
21 */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
22 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
23 bool message_part_data_is_plain_7bit(const struct message_part *part) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
24 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
25 const struct message_part_data *data = part->data; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
26 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
27 i_assert(part->parent == NULL); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
28 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
29 /* if content-type is text/xxx we don't have to check any |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
30 multipart stuff */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
31 if ((part->flags & MESSAGE_PART_FLAG_TEXT) == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
32 return FALSE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
33 if (part->next != NULL || part->children != NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
34 return FALSE; /* shouldn't happen normally.. */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
35 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
36 /* must be text/plain */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
37 if (data->content_subtype != NULL && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
38 strcasecmp(data->content_subtype, "plain") != 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
39 return FALSE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
40 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
41 /* only allowed parameter is charset=us-ascii, which is also default */ |
21673
e4b2931f3566
lib-mail: Fix message_part_data_is_plain_7bit()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
21636
diff
changeset
|
42 if (data->content_type_params_count == 0) { |
e4b2931f3566
lib-mail: Fix message_part_data_is_plain_7bit()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
21636
diff
changeset
|
43 /* charset defaults to us-ascii */ |
e4b2931f3566
lib-mail: Fix message_part_data_is_plain_7bit()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
21636
diff
changeset
|
44 } else if (data->content_type_params_count != 1 || |
e4b2931f3566
lib-mail: Fix message_part_data_is_plain_7bit()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
21636
diff
changeset
|
45 strcasecmp(data->content_type_params[0].name, "charset") != 0 || |
e4b2931f3566
lib-mail: Fix message_part_data_is_plain_7bit()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
21636
diff
changeset
|
46 strcasecmp(data->content_type_params[0].value, |
e4b2931f3566
lib-mail: Fix message_part_data_is_plain_7bit()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
21636
diff
changeset
|
47 MESSAGE_PART_DEFAULT_CHARSET) != 0) |
21633
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
48 return FALSE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
49 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
50 if (data->content_id != NULL || |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
51 data->content_description != NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
52 return FALSE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
53 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
54 if (data->content_transfer_encoding != NULL && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
55 strcasecmp(data->content_transfer_encoding, "7bit") != 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
56 return FALSE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
57 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
58 /* BODYSTRUCTURE checks: */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
59 if (data->content_md5 != NULL || |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
60 data->content_disposition != NULL || |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
61 data->content_language != NULL || |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
62 data->content_location != NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
63 return FALSE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
64 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
65 return TRUE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
66 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
67 |
21636
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
68 bool message_part_data_get_filename(const struct message_part *part, |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
69 const char **filename_r) |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
70 { |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
71 const struct message_part_data *data = part->data; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
72 const struct message_part_param *params; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
73 unsigned int params_count, i; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
74 |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
75 params = data->content_disposition_params; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
76 params_count = data->content_disposition_params_count; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
77 |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
78 if (data->content_disposition != NULL && |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
79 strcasecmp(data->content_disposition, "attachment") != 0) { |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
80 return FALSE; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
81 } |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
82 for (i = 0; i < params_count; i++) { |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
83 if (strcasecmp(params[i].name, "filename") == 0 && |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
84 params[i].value != NULL) { |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
85 *filename_r = params[i].value; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
86 return TRUE; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
87 } |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
88 } |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
89 return FALSE; |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
90 } |
c7b8d82390d4
lib-mail: message-part-data: Implemented message_part_data_get_filename().
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21635
diff
changeset
|
91 |
21633
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
92 /* |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
93 * Header parsing |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
94 */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
95 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
96 /* Message part envelope */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
97 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
98 enum envelope_field { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
99 ENVELOPE_FIELD_DATE = 0, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
100 ENVELOPE_FIELD_SUBJECT, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
101 ENVELOPE_FIELD_FROM, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
102 ENVELOPE_FIELD_SENDER, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
103 ENVELOPE_FIELD_REPLY_TO, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
104 ENVELOPE_FIELD_TO, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
105 ENVELOPE_FIELD_CC, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
106 ENVELOPE_FIELD_BCC, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
107 ENVELOPE_FIELD_IN_REPLY_TO, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
108 ENVELOPE_FIELD_MESSAGE_ID, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
109 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
110 ENVELOPE_FIELD_UNKNOWN |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
111 }; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
112 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
113 static enum envelope_field |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
114 envelope_get_field(const char *name) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
115 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
116 switch (*name) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
117 case 'B': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
118 case 'b': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
119 if (strcasecmp(name, "Bcc") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
120 return ENVELOPE_FIELD_BCC; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
121 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
122 case 'C': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
123 case 'c': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
124 if (strcasecmp(name, "Cc") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
125 return ENVELOPE_FIELD_CC; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
126 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
127 case 'D': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
128 case 'd': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
129 if (strcasecmp(name, "Date") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
130 return ENVELOPE_FIELD_DATE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
131 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
132 case 'F': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
133 case 'f': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
134 if (strcasecmp(name, "From") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
135 return ENVELOPE_FIELD_FROM; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
136 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
137 case 'I': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
138 case 'i': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
139 if (strcasecmp(name, "In-reply-to") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
140 return ENVELOPE_FIELD_IN_REPLY_TO; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
141 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
142 case 'M': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
143 case 'm': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
144 if (strcasecmp(name, "Message-id") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
145 return ENVELOPE_FIELD_MESSAGE_ID; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
146 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
147 case 'R': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
148 case 'r': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
149 if (strcasecmp(name, "Reply-to") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
150 return ENVELOPE_FIELD_REPLY_TO; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
151 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
152 case 'S': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
153 case 's': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
154 if (strcasecmp(name, "Subject") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
155 return ENVELOPE_FIELD_SUBJECT; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
156 if (strcasecmp(name, "Sender") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
157 return ENVELOPE_FIELD_SENDER; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
158 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
159 case 'T': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
160 case 't': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
161 if (strcasecmp(name, "To") == 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
162 return ENVELOPE_FIELD_TO; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
163 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
164 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
165 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
166 return ENVELOPE_FIELD_UNKNOWN; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
167 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
168 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
169 void message_part_envelope_parse_from_header(pool_t pool, |
21635
30aacb0df12f
lib-mail: message-part-data: Renamed struct message_part_envelope_data to message_part_envelope.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21634
diff
changeset
|
170 struct message_part_envelope **data, |
21633
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
171 struct message_header_line *hdr) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
172 { |
21635
30aacb0df12f
lib-mail: message-part-data: Renamed struct message_part_envelope_data to message_part_envelope.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21634
diff
changeset
|
173 struct message_part_envelope *d; |
21633
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
174 enum envelope_field field; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
175 struct message_address **addr_p; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
176 const char **str_p; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
177 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
178 if (*data == NULL) { |
21635
30aacb0df12f
lib-mail: message-part-data: Renamed struct message_part_envelope_data to message_part_envelope.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21634
diff
changeset
|
179 *data = p_new(pool, struct message_part_envelope, 1); |
21633
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
180 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
181 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
182 if (hdr == NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
183 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
184 field = envelope_get_field(hdr->name); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
185 if (field == ENVELOPE_FIELD_UNKNOWN) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
186 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
187 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
188 if (hdr->continues) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
189 /* wait for full value */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
190 hdr->use_full_value = TRUE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
191 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
192 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
193 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
194 d = *data; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
195 addr_p = NULL; str_p = NULL; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
196 switch (field) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
197 case ENVELOPE_FIELD_DATE: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
198 str_p = &d->date; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
199 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
200 case ENVELOPE_FIELD_SUBJECT: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
201 str_p = &d->subject; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
202 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
203 case ENVELOPE_FIELD_MESSAGE_ID: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
204 str_p = &d->message_id; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
205 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
206 case ENVELOPE_FIELD_IN_REPLY_TO: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
207 str_p = &d->in_reply_to; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
208 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
209 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
210 case ENVELOPE_FIELD_CC: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
211 addr_p = &d->cc; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
212 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
213 case ENVELOPE_FIELD_BCC: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
214 addr_p = &d->bcc; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
215 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
216 case ENVELOPE_FIELD_FROM: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
217 addr_p = &d->from; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
218 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
219 case ENVELOPE_FIELD_SENDER: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
220 addr_p = &d->sender; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
221 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
222 case ENVELOPE_FIELD_TO: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
223 addr_p = &d->to; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
224 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
225 case ENVELOPE_FIELD_REPLY_TO: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
226 addr_p = &d->reply_to; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
227 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
228 case ENVELOPE_FIELD_UNKNOWN: |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
229 i_unreached(); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
230 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
231 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
232 if (addr_p != NULL) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
233 *addr_p = message_address_parse(pool, hdr->full_value, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
234 hdr->full_value_len, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
235 UINT_MAX, TRUE); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
236 } else if (str_p != NULL) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
237 *str_p = p_strndup(pool, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
238 hdr->full_value, hdr->full_value_len); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
239 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
240 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
241 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
242 /* Message part data */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
243 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
244 static void |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
245 parse_mime_parameters(struct rfc822_parser_context *parser, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
246 pool_t pool, const struct message_part_param **params_r, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
247 unsigned int *params_count_r) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
248 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
249 const char *const *results; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
250 struct message_part_param *params; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
251 unsigned int params_count, i; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
252 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
253 rfc2231_parse(parser, &results); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
254 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
255 params_count = str_array_length(results); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
256 i_assert((params_count % 2) == 0); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
257 params_count /= 2; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
258 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
259 if (params_count > 0) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
260 params = p_new(pool, struct message_part_param, params_count); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
261 for (i = 0; i < params_count; i++) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
262 params[i].name = p_strdup(pool, results[i*2+0]); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
263 params[i].value = p_strdup(pool, results[i*2+1]); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
264 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
265 *params_r = params; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
266 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
267 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
268 *params_count_r = params_count; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
269 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
270 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
271 static void |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
272 parse_content_type(struct message_part_data *data, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
273 pool_t pool, struct message_header_line *hdr) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
274 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
275 struct rfc822_parser_context parser; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
276 string_t *str; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
277 const char *value; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
278 unsigned int i; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
279 int ret; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
280 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
281 rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
282 rfc822_skip_lwsp(&parser); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
283 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
284 str = t_str_new(256); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
285 ret = rfc822_parse_content_type(&parser, str); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
286 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
287 /* Save content type and subtype */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
288 value = str_c(str); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
289 for (i = 0; value[i] != '\0'; i++) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
290 if (value[i] == '/') { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
291 data->content_subtype = p_strdup(pool, value + i+1); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
292 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
293 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
294 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
295 str_truncate(str, i); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
296 data->content_type = p_strdup(pool, str_c(str)); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
297 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
298 if (ret < 0) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
299 /* Content-Type is broken, but we wanted to get it as well as |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
300 we could. Don't try to read the parameters anymore though. |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
301 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
302 We don't completely ignore a broken Content-Type, because |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
303 then it would be written as text/plain. This would cause a |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
304 mismatch with the message_part's MESSAGE_PART_FLAG_TEXT. */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
305 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
306 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
307 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
308 parse_mime_parameters(&parser, pool, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
309 &data->content_type_params, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
310 &data->content_type_params_count); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
311 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
312 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
313 static void |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
314 parse_content_transfer_encoding(struct message_part_data *data, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
315 pool_t pool, struct message_header_line *hdr) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
316 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
317 struct rfc822_parser_context parser; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
318 string_t *str; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
319 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
320 rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
321 rfc822_skip_lwsp(&parser); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
322 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
323 str = t_str_new(256); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
324 if (rfc822_parse_mime_token(&parser, str) >= 0 && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
325 rfc822_skip_lwsp(&parser) == 0 && str_len(str) > 0) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
326 data->content_transfer_encoding = |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
327 p_strdup(pool, str_c(str)); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
328 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
329 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
330 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
331 static void |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
332 parse_content_disposition(struct message_part_data *data, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
333 pool_t pool, struct message_header_line *hdr) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
334 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
335 struct rfc822_parser_context parser; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
336 string_t *str; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
337 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
338 rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
339 rfc822_skip_lwsp(&parser); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
340 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
341 str = t_str_new(256); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
342 if (rfc822_parse_mime_token(&parser, str) < 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
343 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
344 data->content_disposition = p_strdup(pool, str_c(str)); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
345 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
346 parse_mime_parameters(&parser, pool, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
347 &data->content_disposition_params, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
348 &data->content_disposition_params_count); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
349 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
350 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
351 static void |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
352 parse_content_language(struct message_part_data *data, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
353 pool_t pool, const unsigned char *value, size_t value_len) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
354 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
355 struct rfc822_parser_context parser; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
356 ARRAY_TYPE(const_string) langs; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
357 string_t *str; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
358 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
359 /* Language-Header = "Content-Language" ":" 1#Language-tag |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
360 Language-Tag = Primary-tag *( "-" Subtag ) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
361 Primary-tag = 1*8ALPHA |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
362 Subtag = 1*8ALPHA */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
363 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
364 rfc822_parser_init(&parser, value, value_len, NULL); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
365 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
366 t_array_init(&langs, 16); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
367 str = t_str_new(128); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
368 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
369 rfc822_skip_lwsp(&parser); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
370 while (rfc822_parse_atom(&parser, str) >= 0) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
371 const char *lang = p_strdup(pool, str_c(str)); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
372 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
373 array_append(&langs, &lang, 1); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
374 str_truncate(str, 0); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
375 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
376 if (parser.data == parser.end || *parser.data != ',') |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
377 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
378 parser.data++; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
379 rfc822_skip_lwsp(&parser); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
380 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
381 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
382 if (array_count(&langs) > 0) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
383 array_append_zero(&langs); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
384 data->content_language = |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
385 p_strarray_dup(pool, array_idx(&langs, 0)); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
386 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
387 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
388 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
389 static void |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
390 parse_content_header(struct message_part_data *data, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
391 pool_t pool, struct message_header_line *hdr) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
392 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
393 const char *name = hdr->name + strlen("Content-"); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
394 const char *value; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
395 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
396 if (hdr->continues) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
397 hdr->use_full_value = TRUE; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
398 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
399 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
400 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
401 value = t_strndup(hdr->full_value, hdr->full_value_len); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
402 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
403 switch (*name) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
404 case 'i': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
405 case 'I': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
406 if (strcasecmp(name, "ID") == 0 && data->content_id == NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
407 data->content_id = p_strdup(pool, value); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
408 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
409 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
410 case 'm': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
411 case 'M': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
412 if (strcasecmp(name, "MD5") == 0 && data->content_md5 == NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
413 data->content_md5 = p_strdup(pool, value); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
414 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
415 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
416 case 't': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
417 case 'T': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
418 if (strcasecmp(name, "Type") == 0 && data->content_type == NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
419 parse_content_type(data, pool, hdr); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
420 else if (strcasecmp(name, "Transfer-Encoding") == 0 && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
421 data->content_transfer_encoding == NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
422 parse_content_transfer_encoding(data, pool, hdr); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
423 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
424 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
425 case 'l': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
426 case 'L': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
427 if (strcasecmp(name, "Language") == 0 && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
428 data->content_language == NULL) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
429 parse_content_language(data, pool, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
430 hdr->full_value, hdr->full_value_len); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
431 } else if (strcasecmp(name, "Location") == 0 && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
432 data->content_location == NULL) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
433 data->content_location = p_strdup(pool, value); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
434 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
435 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
436 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
437 case 'd': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
438 case 'D': |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
439 if (strcasecmp(name, "Description") == 0 && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
440 data->content_description == NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
441 data->content_description = p_strdup(pool, value); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
442 else if (strcasecmp(name, "Disposition") == 0 && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
443 data->content_disposition_params == NULL) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
444 parse_content_disposition(data, pool, hdr); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
445 break; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
446 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
447 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
448 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
449 void message_part_data_parse_from_header(pool_t pool, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
450 struct message_part *part, |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
451 struct message_header_line *hdr) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
452 { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
453 struct message_part_data *part_data; |
21635
30aacb0df12f
lib-mail: message-part-data: Renamed struct message_part_envelope_data to message_part_envelope.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
21634
diff
changeset
|
454 struct message_part_envelope *envelope; |
21633
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
455 bool parent_rfc822; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
456 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
457 if (hdr == NULL) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
458 if (part->data == NULL) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
459 /* no Content-* headers. add an empty context |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
460 structure anyway. */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
461 part->data = part_data = |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
462 p_new(pool, struct message_part_data, 1); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
463 } else if ((part->flags & MESSAGE_PART_FLAG_IS_MIME) == 0) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
464 /* If there was no Mime-Version, forget all |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
465 the Content-stuff */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
466 part_data = part->data; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
467 envelope = part_data->envelope; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
468 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
469 i_zero(part_data); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
470 part_data->envelope = envelope; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
471 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
472 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
473 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
474 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
475 if (hdr->eoh) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
476 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
477 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
478 parent_rfc822 = part->parent != NULL && |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
479 (part->parent->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) != 0; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
480 if (!parent_rfc822 && strncasecmp(hdr->name, "Content-", 8) != 0) |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
481 return; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
482 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
483 if (part->data == NULL) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
484 /* initialize message part data */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
485 part->data = part_data = |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
486 p_new(pool, struct message_part_data, 1); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
487 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
488 part_data = part->data; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
489 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
490 if (strncasecmp(hdr->name, "Content-", 8) == 0) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
491 T_BEGIN { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
492 parse_content_header(part_data, pool, hdr); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
493 } T_END; |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
494 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
495 |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
496 if (parent_rfc822) { |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
497 /* message/rfc822, we need the envelope */ |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
498 message_part_envelope_parse_from_header(pool, &part_data->envelope, hdr); |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
499 } |
3a88d30ad000
lib-imap: imap-bodystructure: Moved message_part_data header parsing and query functions to their own module in lib-mail.
Stephan Bosch <stephan.bosch@dovecot.fi>
parents:
diff
changeset
|
500 } |