NeoMutt  2025-12-11-949-g4870ee
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
state.h
Go to the documentation of this file.
1
23
24#ifndef MUTT_MUTT_STATE_H
25#define MUTT_MUTT_STATE_H
26
27#include <stddef.h>
28#include <stdint.h>
29#include <stdio.h>
30
35{
37 STATE_DISPLAY = 1U << 0,
38 STATE_VERIFY = 1U << 1,
40 STATE_WEED = 1U << 3,
41 STATE_CHARCONV = 1U << 4,
42 STATE_PRINTING = 1U << 5,
43 STATE_REPLYING = 1U << 6,
44 STATE_FIRSTDONE = 1U << 7,
46 STATE_PAGER = 1U << 9,
47};
48typedef uint16_t StateFlags;
49
53struct State
54{
55 FILE *fp_in;
56 FILE *fp_out;
57 const char *prefix;
59 int wraplen;
60};
61
62#define state_set_prefix(state) ((state)->flags |= STATE_PENDINGPREFIX)
63#define state_reset_prefix(state) ((state)->flags &= ~STATE_PENDINGPREFIX)
64#define state_puts(STATE, STR) fputs(STR, (STATE)->fp_out)
65#define state_putc(STATE, STR) fputc(STR, (STATE)->fp_out)
66
67void state_attach_puts (struct State *state, const char *t);
68void state_mark_attach (struct State *state);
69void state_mark_protected_header(struct State *state);
70void state_prefix_put (struct State *state, const char *buf, size_t buflen);
71void state_prefix_putc (struct State *state, char c);
72int state_printf (struct State *state, const char *fmt, ...)
73 __attribute__((__format__(__printf__, 2, 3)));
74int state_putws (struct State *state, const wchar_t *ws);
75
76const char *state_attachment_marker(void);
77const char *state_protected_header_marker(void);
78
79#endif /* MUTT_MUTT_STATE_H */
const char * state_attachment_marker(void)
Get a unique (per-run) ANSI string to mark PGP messages in an email.
Definition state.c:45
int state_putws(struct State *state, const wchar_t *ws)
Write a wide string to the state.
Definition state.c:147
const char * state_protected_header_marker(void)
Get a unique (per-run) ANSI string to mark protected headers in an email.
Definition state.c:59
void state_attach_puts(struct State *state, const char *t)
Write a string to the state.
Definition state.c:104
int state_printf(struct State *state, const char *fmt,...) __attribute__((__format__(__printf__
void state_mark_attach(struct State *state)
Write a unique marker around content.
Definition state.c:73
void state_prefix_put(struct State *state, const char *buf, size_t buflen)
Write a prefixed fixed-string to the State.
Definition state.c:211
void state_mark_protected_header(struct State *state)
Write a unique marker around protected headers.
Definition state.c:88
uint16_t StateFlags
Definition state.h:48
StateFlag
Flags for State->flags.
Definition state.h:35
@ STATE_CHARCONV
Do character set conversions.
Definition state.h:41
@ STATE_PENDINGPREFIX
Prefix to write, but character must follow.
Definition state.h:39
@ STATE_FIRSTDONE
The first attachment has been done.
Definition state.h:44
@ STATE_PRINTING
Are we printing? - STATE_DISPLAY "light".
Definition state.h:42
@ STATE_REPLYING
Are we replying?
Definition state.h:43
@ STATE_PAGER
Output will be displayed in the Pager.
Definition state.h:46
@ STATE_NONE
No flags are set.
Definition state.h:36
@ STATE_VERIFY
Perform signature verification.
Definition state.h:38
@ STATE_WEED
Weed headers even when not in display mode.
Definition state.h:40
@ STATE_DISPLAY_ATTACH
We are displaying an attachment.
Definition state.h:45
@ STATE_DISPLAY
Output is displayed to the user.
Definition state.h:37
void state_prefix_putc(struct State *state, char c)
Write a prefixed character to the state.
Definition state.c:168
Keep track when processing files.
Definition state.h:54
int wraplen
Width to wrap lines to (when flags & STATE_DISPLAY)
Definition state.h:59
StateFlags flags
Flags, e.g. STATE_DISPLAY.
Definition state.h:58
FILE * fp_out
File to write to.
Definition state.h:56
FILE * fp_in
File to read from.
Definition state.h:55
const char * prefix
String to add to the beginning of each output line.
Definition state.h:57