The second batch
[git] / mailinfo.h
1 #ifndef MAILINFO_H
2 #define MAILINFO_H
3
4 #include "strbuf.h"
5
6 #define MAX_BOUNDARIES 5
7
8 enum quoted_cr_action {
9         quoted_cr_unset = -1,
10         quoted_cr_nowarn,
11         quoted_cr_warn,
12         quoted_cr_strip,
13 };
14
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;
24         int quoted_cr; /* enum quoted_cr_action */
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;
33         unsigned int format_flowed:1;
34         unsigned int delsp:1;
35         unsigned int have_quoted_cr:1;
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? */
43         struct strbuf inbody_header_accum;
44         struct strbuf **p_hdr_data;
45         struct strbuf **s_hdr_data;
46
47         struct strbuf log_message;
48         int input_error;
49 };
50
51 int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action);
52 void setup_mailinfo(struct mailinfo *);
53 int mailinfo(struct mailinfo *, const char *msg, const char *patch);
54 void clear_mailinfo(struct mailinfo *);
55
56 #endif /* MAILINFO_H */