| 1 | #ifndef MAILINFO_H |
| 2 | #define MAILINFO_H |
| 3 | |
| 4 | #include "strbuf.h" |
| 5 | |
| 6 | #define MAX_BOUNDARIES 5 |
| 7 | |
| 8 | struct repository; |
| 9 | |
| 10 | enum quoted_cr_action { |
| 11 | quoted_cr_unset = -1, |
| 12 | quoted_cr_nowarn, |
| 13 | quoted_cr_warn, |
| 14 | quoted_cr_strip, |
| 15 | }; |
| 16 | |
| 17 | struct mailinfo { |
| 18 | FILE *input; |
| 19 | FILE *output; |
| 20 | FILE *patchfile; |
| 21 | |
| 22 | struct strbuf name; |
| 23 | struct strbuf email; |
| 24 | int keep_subject; |
| 25 | int keep_non_patch_brackets_in_subject; |
| 26 | int quoted_cr; /* enum quoted_cr_action */ |
| 27 | int add_message_id; |
| 28 | int use_scissors; |
| 29 | int use_inbody_headers; |
| 30 | const char *metainfo_charset; |
| 31 | |
| 32 | struct strbuf *content[MAX_BOUNDARIES]; |
| 33 | struct strbuf **content_top; |
| 34 | struct strbuf charset; |
| 35 | unsigned int format_flowed:1; |
| 36 | unsigned int delsp:1; |
| 37 | unsigned int have_quoted_cr:1; |
| 38 | char *message_id; |
| 39 | enum { |
| 40 | TE_DONTCARE, TE_QP, TE_BASE64 |
| 41 | } transfer_encoding; |
| 42 | int patch_lines; |
| 43 | int filter_stage; /* still reading log or are we copying patch? */ |
| 44 | int header_stage; /* still checking in-body headers? */ |
| 45 | struct strbuf inbody_header_accum; |
| 46 | struct strbuf **p_hdr_data; |
| 47 | struct strbuf **s_hdr_data; |
| 48 | |
| 49 | struct strbuf log_message; |
| 50 | int input_error; |
| 51 | }; |
| 52 | |
| 53 | int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action); |
| 54 | void setup_mailinfo(struct repository *r, struct mailinfo *); |
| 55 | int mailinfo(struct mailinfo *, const char *msg, const char *patch); |
| 56 | void clear_mailinfo(struct mailinfo *); |
| 57 | |
| 58 | #endif /* MAILINFO_H */ |