blob: f2ffd0349e8007256f5b2118d41faf35a53edf0d [file] [log] [blame]
Junio C Hamanoc6905e42015-10-14 17:44:55 -07001#ifndef MAILINFO_H
2#define MAILINFO_H
3
Elijah Newrenef3ca952018-08-15 10:54:05 -07004#include "strbuf.h"
5
Junio C Hamanoc6905e42015-10-14 17:44:55 -07006#define MAX_BOUNDARIES 5
7
Đoàn Trần Công Danhf1aa2992021-05-10 00:12:11 +07008enum quoted_cr_action {
Đoàn Trần Công Danh59b519a2021-05-10 00:12:13 +07009 quoted_cr_unset = -1,
Đoàn Trần Công Danhf1aa2992021-05-10 00:12:11 +070010 quoted_cr_nowarn,
11 quoted_cr_warn,
Đoàn Trần Công Danh133a4fd2021-05-10 00:12:12 +070012 quoted_cr_strip,
Đoàn Trần Công Danhf1aa2992021-05-10 00:12:11 +070013};
14
Junio C Hamanoc6905e42015-10-14 17:44:55 -070015struct 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 Danhf1aa2992021-05-10 00:12:11 +070024 int quoted_cr; /* enum quoted_cr_action */
Junio C Hamanoc6905e42015-10-14 17:44:55 -070025 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é Scharfe3aa4d812018-08-25 23:50:32 +020033 unsigned int format_flowed:1;
34 unsigned int delsp:1;
Đoàn Trần Công Danh0b689562021-05-10 00:12:10 +070035 unsigned int have_quoted_cr:1;
Junio C Hamanoc6905e42015-10-14 17:44:55 -070036 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 Tan6b4b0132016-09-20 10:17:53 -070043 struct strbuf inbody_header_accum;
Junio C Hamanoc6905e42015-10-14 17:44:55 -070044 struct strbuf **p_hdr_data;
45 struct strbuf **s_hdr_data;
46
47 struct strbuf log_message;
Junio C Hamano6ac617a2015-10-14 17:45:29 -070048 int input_error;
Junio C Hamanoc6905e42015-10-14 17:44:55 -070049};
50
Đoàn Trần Công Danhf1aa2992021-05-10 00:12:11 +070051int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action);
Denton Liu55454422019-04-29 04:28:14 -040052void setup_mailinfo(struct mailinfo *);
53int mailinfo(struct mailinfo *, const char *msg, const char *patch);
54void clear_mailinfo(struct mailinfo *);
Junio C Hamanoc6905e42015-10-14 17:44:55 -070055
56#endif /* MAILINFO_H */