NeoMutt  2022-04-29-81-g9c5a59
Teaching an old dog new tricks
DOXYGEN
state.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_MUTT_STATE_H
24 #define MUTT_MUTT_STATE_H
25 
26 #include <stdint.h>
27 #include <stdio.h>
28 #include <wchar.h>
29 
30 typedef uint16_t StateFlags;
31 #define MUTT_STATE_NO_FLAGS 0
32 #define MUTT_DISPLAY (1 << 0)
33 #define MUTT_VERIFY (1 << 1)
34 #define MUTT_PENDINGPREFIX (1 << 2)
35 #define MUTT_WEED (1 << 3)
36 #define MUTT_CHARCONV (1 << 4)
37 #define MUTT_PRINTING (1 << 5)
38 #define MUTT_REPLYING (1 << 6)
39 #define MUTT_FIRSTDONE (1 << 7)
40 #define MUTT_DISPLAY_ATTACH (1 << 8)
41 
45 struct State
46 {
47  FILE *fp_in;
48  FILE *fp_out;
49  char *prefix;
51  int wraplen;
52 };
53 
54 #define state_set_prefix(state) ((state)->flags |= MUTT_PENDINGPREFIX)
55 #define state_reset_prefix(state) ((state)->flags &= ~MUTT_PENDINGPREFIX)
56 #define state_puts(STATE, STR) fputs(STR, (STATE)->fp_out)
57 #define state_putc(STATE, STR) fputc(STR, (STATE)->fp_out)
58 
59 void state_attach_puts (struct State *s, const char *t);
60 void state_mark_attach (struct State *s);
61 void state_mark_protected_header(struct State *s);
62 void state_prefix_put (struct State *s, const char *buf, size_t buflen);
63 void state_prefix_putc (struct State *s, char c);
64 int state_printf (struct State *s, const char *fmt, ...);
65 int state_putws (struct State *s, const wchar_t *ws);
66 
67 const char *state_attachment_marker(void);
68 const char *state_protected_header_marker(void);
69 
70 #endif /* MUTT_MUTT_STATE_H */
int state_putws(struct State *s, const wchar_t *ws)
Write a wide string to the state.
Definition: state.c:143
int state_printf(struct State *s, const char *fmt,...)
Write a formatted string to the State.
Definition: state.c:183
void state_prefix_put(struct State *s, const char *buf, size_t buflen)
Write a prefixed fixed-string to the State.
Definition: state.c:201
void state_prefix_putc(struct State *s, char c)
Write a prefixed character to the state.
Definition: state.c:161
const char * state_protected_header_marker(void)
Get a unique (per-run) ANSI string to mark protected headers in an email.
Definition: state.c:57
void state_mark_attach(struct State *s)
Write a unique marker around content.
Definition: state.c:71
const char * state_attachment_marker(void)
Get a unique (per-run) ANSI string to mark PGP messages in an email.
Definition: state.c:43
void state_attach_puts(struct State *s, const char *t)
Write a string to the state.
Definition: state.c:100
void state_mark_protected_header(struct State *s)
Write a unique marker around protected headers.
Definition: state.c:86
uint16_t StateFlags
Flags for State->flags, e.g. MUTT_DISPLAY.
Definition: state.h:30
Keep track when processing files.
Definition: state.h:46
int wraplen
Width to wrap lines to (when flags & MUTT_DISPLAY)
Definition: state.h:51
StateFlags flags
Flags, e.g. MUTT_DISPLAY.
Definition: state.h:50
FILE * fp_out
File to write to.
Definition: state.h:48
char * prefix
String to add to the beginning of each output line.
Definition: state.h:49
FILE * fp_in
File to read from.
Definition: state.h:47