NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config.c
Go to the documentation of this file.
1
22
28
29#include "config.h"
30#include <stdbool.h>
31#include <stddef.h>
32#include <stdint.h>
33#include "mutt/lib.h"
34#include "config/lib.h"
35
39static int multipart_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
40{
41 if (value == 0)
42 return CSR_SUCCESS;
43
44 const char *str = (const char *) value;
45
46 if (mutt_str_equal(str, "inline") || mutt_str_equal(str, "info"))
47 return CSR_SUCCESS;
48
49 buf_printf(err, _("Invalid value for option %s: %s"), cdef->name, str);
50 return CSR_ERR_INVALID;
51}
52
56struct ConfigDef EmailVars[] = {
57 // clang-format off
58 { "auto_subscribe", DT_BOOL, false, 0, NULL,
59 "Automatically check if the user is subscribed to a mailing list"
60 },
61 { "honor_disposition", DT_BOOL, false, 0, NULL,
62 "Don't display MIME parts inline if they have a disposition of 'attachment'"
63 },
64 { "hidden_tags", DT_SLIST|D_SLIST_SEP_COMMA, IP "unread,draft,flagged,passed,replied,attachment,signed,encrypted", 0, NULL,
65 "List of tags that shouldn't be displayed on screen (comma-separated)"
66 },
67 { "implicit_auto_view", DT_BOOL, false, 0, NULL,
68 "Display MIME attachments inline if a 'copiousoutput' mailcap entry exists"
69 },
70 { "include_encrypted", DT_BOOL, false, 0, NULL,
71 "Whether to include encrypted content when replying"
72 },
73 { "include_only_first", DT_BOOL, false, 0, NULL,
74 "Only include the first attachment when replying"
75 },
76 { "mailcap_path", DT_SLIST|D_SLIST_SEP_COLON, IP "~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap", 0, NULL,
77 "List of mailcap files (colon-separated)"
78 },
79 { "mailcap_sanitize", DT_BOOL, true, 0, NULL,
80 "Restrict the possible characters in mailcap expandos"
81 },
82 { "preferred_languages", DT_SLIST|D_SLIST_SEP_COMMA, 0, 0, NULL,
83 "List of Preferred Languages for multilingual MIME (comma-separated)"
84 },
85 { "reflow_space_quotes", DT_BOOL, true, 0, NULL,
86 "Insert spaces into reply quotes for 'format=flowed' messages"
87 },
88 { "reflow_text", DT_BOOL, true, 0, NULL,
89 "Reformat paragraphs of 'format=flowed' text"
90 },
91 { "reflow_wrap", DT_NUMBER, 78, 0, NULL,
92 "Maximum paragraph width for reformatting 'format=flowed' text"
93 },
94 // L10N: $reply_regex default format
95 //
96 // This is a regular expression that matches reply subject lines.
97 // By default, it only matches an initial "Re: ", which is the
98 // standardized Latin prefix.
99 //
100 // However, many locales have other prefixes that are commonly used
101 // too, such as Aw in Germany. To add other prefixes, modify the first
102 // parenthesized expression, such as:
103 // "^(re|aw)
104 // you can add multiple values, for example:
105 // "^(re|aw|sv)
106 //
107 // Important:
108 // - Use all lower case letters.
109 // - Don't remove the 're' prefix from the list of choices.
110 // - Please test the value you use inside Mutt. A mistake here will break
111 // NeoMutt's threading behavior. Note: the header cache can interfere with
112 // testing, so be sure to test with $header_cache unset.
113 { "reply_regex", DT_REGEX|D_L10N_STRING, IP N_("^((re)(\\[[0-9]+\\])*:[ \t]*)*"), 0, NULL,
114 "Regex to match message reply subjects like 're: '"
115 },
116 { "score", DT_BOOL, true, 0, NULL,
117 "Use message scoring"
118 },
119 { "score_threshold_delete", DT_NUMBER, -1, 0, NULL,
120 "Messages with a lower score will be automatically deleted"
121 },
122 { "score_threshold_flag", DT_NUMBER, 9999, 0, NULL,
123 "Messages with a greater score will be automatically flagged"
124 },
125 { "score_threshold_read", DT_NUMBER, -1, 0, NULL,
126 "Messages with a lower score will be automatically marked read"
127 },
128 { "show_multipart_alternative", DT_STRING, 0, 0, multipart_validator,
129 "How to display 'multipart/alternative' MIME parts"
130 },
131 { "reverse_alias", DT_BOOL, false, 0, NULL,
132 "Display the alias in the index, rather than the message's sender"
133 },
134 { "rfc2047_parameters", DT_BOOL, true, 0, NULL,
135 "Decode RFC2047-encoded MIME parameters"
136 },
137 { "spam_separator", DT_STRING, IP ",", 0, NULL,
138 "Separator for multiple spam headers"
139 },
140
141 { "implicit_autoview", DT_SYNONYM, IP "implicit_auto_view", IP "2023-01-25" },
142 { "include_onlyfirst", DT_SYNONYM, IP "include_only_first", IP "2021-03-21" },
143 { "reply_regexp", DT_SYNONYM, IP "reply_regex", IP "2021-03-21" },
144 { NULL },
145 // clang-format on
146};
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:161
Convenience wrapper for the config headers.
#define CSR_ERR_INVALID
Value hasn't been set.
Definition set.h:36
#define CSR_SUCCESS
Action completed successfully.
Definition set.h:33
#define IP
Definition set.h:54
struct ConfigDef EmailVars[]
Config definitions for the Email library.
Definition config.c:56
static int multipart_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "show_multipart_alternative" config variable - Implements ConfigDef::validator() -.
Definition config.c:39
Convenience wrapper for the library headers.
#define N_(a)
Definition message.h:32
#define _(a)
Definition message.h:28
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition string.c:662
String manipulation buffer.
Definition buffer.h:36
const char * name
User-visible name.
Definition set.h:65
#define D_SLIST_SEP_COMMA
Slist items are comma-separated.
Definition types.h:111
#define D_SLIST_SEP_COLON
Slist items are colon-separated.
Definition types.h:112
#define D_L10N_STRING
String can be localised.
Definition types.h:82
@ DT_NUMBER
a number
Definition types.h:38
@ DT_SLIST
a list of strings
Definition types.h:42
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44
@ DT_REGEX
regular expressions
Definition types.h:41