Junio C Hamano | c6905e4 | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 1 | #ifndef MAILINFO_H |
| 2 | #define MAILINFO_H |
| 3 | |
Elijah Newren | ef3ca95 | 2018-08-15 10:54:05 -0700 | [diff] [blame] | 4 | #include "strbuf.h" |
| 5 | |
Junio C Hamano | c6905e4 | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 6 | #define MAX_BOUNDARIES 5 |
| 7 | |
Đoàn Trần Công Danh | f1aa299 | 2021-05-10 00:12:11 +0700 | [diff] [blame] | 8 | enum quoted_cr_action { |
Đoàn Trần Công Danh | 59b519a | 2021-05-10 00:12:13 +0700 | [diff] [blame] | 9 | quoted_cr_unset = -1, |
Đoàn Trần Công Danh | f1aa299 | 2021-05-10 00:12:11 +0700 | [diff] [blame] | 10 | quoted_cr_nowarn, |
| 11 | quoted_cr_warn, |
Đoàn Trần Công Danh | 133a4fd | 2021-05-10 00:12:12 +0700 | [diff] [blame] | 12 | quoted_cr_strip, |
Đoàn Trần Công Danh | f1aa299 | 2021-05-10 00:12:11 +0700 | [diff] [blame] | 13 | }; |
| 14 | |
Junio C Hamano | c6905e4 | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 15 | struct mailinfo { |
| 16 | FILE *input; |
| 17 | FILE *output; |
| 18 | FILE *patchfile; |
| 19 | |
| 20 | struct strbuf name; |
| 21 | struct strbuf email; |
| 22 | int keep_subject; |
| 23 | int keep_non_patch_brackets_in_subject; |
Đoàn Trần Công Danh | f1aa299 | 2021-05-10 00:12:11 +0700 | [diff] [blame] | 24 | int quoted_cr; /* enum quoted_cr_action */ |
Junio C Hamano | c6905e4 | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 25 | int add_message_id; |
| 26 | int use_scissors; |
| 27 | int use_inbody_headers; |
| 28 | const char *metainfo_charset; |
| 29 | |
| 30 | struct strbuf *content[MAX_BOUNDARIES]; |
| 31 | struct strbuf **content_top; |
| 32 | struct strbuf charset; |
René Scharfe | 3aa4d81 | 2018-08-25 23:50:32 +0200 | [diff] [blame] | 33 | unsigned int format_flowed:1; |
| 34 | unsigned int delsp:1; |
Đoàn Trần Công Danh | 0b68956 | 2021-05-10 00:12:10 +0700 | [diff] [blame] | 35 | unsigned int have_quoted_cr:1; |
Junio C Hamano | c6905e4 | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 36 | char *message_id; |
| 37 | enum { |
| 38 | TE_DONTCARE, TE_QP, TE_BASE64 |
| 39 | } transfer_encoding; |
| 40 | int patch_lines; |
| 41 | int filter_stage; /* still reading log or are we copying patch? */ |
| 42 | int header_stage; /* still checking in-body headers? */ |
Jonathan Tan | 6b4b013 | 2016-09-20 10:17:53 -0700 | [diff] [blame] | 43 | struct strbuf inbody_header_accum; |
Junio C Hamano | c6905e4 | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 44 | struct strbuf **p_hdr_data; |
| 45 | struct strbuf **s_hdr_data; |
| 46 | |
| 47 | struct strbuf log_message; |
Junio C Hamano | 6ac617a | 2015-10-14 17:45:29 -0700 | [diff] [blame] | 48 | int input_error; |
Junio C Hamano | c6905e4 | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
Đoàn Trần Công Danh | f1aa299 | 2021-05-10 00:12:11 +0700 | [diff] [blame] | 51 | int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action); |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 52 | void setup_mailinfo(struct mailinfo *); |
| 53 | int mailinfo(struct mailinfo *, const char *msg, const char *patch); |
| 54 | void clear_mailinfo(struct mailinfo *); |
Junio C Hamano | c6905e4 | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 55 | |
| 56 | #endif /* MAILINFO_H */ |