NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
state.h
Go to the documentation of this file.
1
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
31typedef uint16_t StateFlags;
32#define STATE_NO_FLAGS 0
33#define STATE_DISPLAY (1 << 0)
34#define STATE_VERIFY (1 << 1)
35#define STATE_PENDINGPREFIX (1 << 2)
36#define STATE_WEED (1 << 3)
37#define STATE_CHARCONV (1 << 4)
38#define STATE_PRINTING (1 << 5)
39#define STATE_REPLYING (1 << 6)
40#define STATE_FIRSTDONE (1 << 7)
41#define STATE_DISPLAY_ATTACH (1 << 8)
42#define STATE_PAGER (1 << 9)
43
47struct State
48{
49 FILE *fp_in;
50 FILE *fp_out;
51 const char *prefix;
53 int wraplen;
54};
55
56#define state_set_prefix(state) ((state)->flags |= STATE_PENDINGPREFIX)
57#define state_reset_prefix(state) ((state)->flags &= ~STATE_PENDINGPREFIX)
58#define state_puts(STATE, STR) fputs(STR, (STATE)->fp_out)
59#define state_putc(STATE, STR) fputc(STR, (STATE)->fp_out)
60
61void state_attach_puts (struct State *state, const char *t);
62void state_mark_attach (struct State *state);
63void state_mark_protected_header(struct State *state);
64void state_prefix_put (struct State *state, const char *buf, size_t buflen);
65void state_prefix_putc (struct State *state, char c);
66int state_printf (struct State *state, const char *fmt, ...)
67 __attribute__((__format__(__printf__, 2, 3)));
68int state_putws (struct State *state, const wchar_t *ws);
69
70const char *state_attachment_marker(void);
71const char *state_protected_header_marker(void);
72
73#endif /* MUTT_MUTT_STATE_H */
void state_attach_puts(struct State *state, const char *t)
Write a string to the state.
Definition: state.c:103
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:72
const char * state_attachment_marker(void)
Get a unique (per-run) ANSI string to mark PGP messages in an email.
Definition: state.c:44
void state_prefix_put(struct State *state, const char *buf, size_t buflen)
Write a prefixed fixed-string to the State.
Definition: state.c:204
void state_mark_protected_header(struct State *state)
Write a unique marker around protected headers.
Definition: state.c:87
int int state_putws(struct State *state, const wchar_t *ws)
Write a wide string to the state.
Definition: state.c:146
const char * state_protected_header_marker(void)
Get a unique (per-run) ANSI string to mark protected headers in an email.
Definition: state.c:58
uint16_t StateFlags
Flags for State->flags, e.g. STATE_DISPLAY.
Definition: state.h:31
void state_prefix_putc(struct State *state, char c)
Write a prefixed character to the state.
Definition: state.c:164
Keep track when processing files.
Definition: state.h:48
int wraplen
Width to wrap lines to (when flags & STATE_DISPLAY)
Definition: state.h:53
StateFlags flags
Flags, e.g. STATE_DISPLAY.
Definition: state.h:52
FILE * fp_out
File to write to.
Definition: state.h:50
FILE * fp_in
File to read from.
Definition: state.h:49
const char * prefix
String to add to the beginning of each output line.
Definition: state.h:51