NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config.c
Go to the documentation of this file.
1
31#include "config.h"
32#include <stdbool.h>
33#include <stddef.h>
34#include "mutt/lib.h"
35#include "config/lib.h"
36#include "expando/lib.h"
37#include "gui.h"
38
42static const struct Mapping SortAliasMethods[] = {
43 // clang-format off
44 { "address", SORT_ADDRESS },
45 { "alias", SORT_ALIAS },
46 { "unsorted", SORT_ORDER },
47 { NULL, 0 },
48 // clang-format on
49};
50
57static const struct ExpandoDefinition AliasFormatDef[] = {
58 // clang-format off
62 { "a", "name", ED_ALIAS, ED_ALI_NAME, E_TYPE_STRING, NULL },
63 { "c", "comment", ED_ALIAS, ED_ALI_COMMENT, E_TYPE_STRING, NULL },
64 { "f", "flags", ED_ALIAS, ED_ALI_FLAGS, E_TYPE_STRING, NULL },
65 { "n", "number", ED_ALIAS, ED_ALI_NUMBER, E_TYPE_NUMBER, NULL },
66 { "r", "address", ED_ALIAS, ED_ALI_ADDRESS, E_TYPE_STRING, NULL },
67 { "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, E_TYPE_STRING, NULL },
68 { "Y", "tags", ED_ALIAS, ED_ALI_TAGS, E_TYPE_STRING, NULL },
69 { NULL, NULL, 0, -1, -1, NULL }
70 // clang-format on
71};
72
79static const struct ExpandoDefinition QueryFormatDef[] = {
80 // clang-format off
84 { "a", "address", ED_ALIAS, ED_ALI_ADDRESS, E_TYPE_STRING, NULL },
85 { "c", "number", ED_ALIAS, ED_ALI_NUMBER, E_TYPE_NUMBER, NULL },
86 { "e", "comment", ED_ALIAS, ED_ALI_COMMENT, E_TYPE_STRING, NULL },
87 { "n", "name", ED_ALIAS, ED_ALI_NAME, E_TYPE_STRING, NULL },
88 { "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, E_TYPE_STRING, NULL },
89 { "Y", "tags", ED_ALIAS, ED_ALI_TAGS, E_TYPE_STRING, NULL },
90 { NULL, NULL, 0, -1, -1, NULL }
91 // clang-format on
92};
93
97static struct ConfigDef AliasVars[] = {
98 // clang-format off
99 { "alias_file", DT_PATH|D_PATH_FILE, IP "~/.neomuttrc", 0, NULL,
100 "Save new aliases to this file"
101 },
102 { "alias_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3n %f%t %-15a %-56r | %c", IP &AliasFormatDef, NULL,
103 "printf-like format string for the alias menu"
104 },
105 { "sort_alias", DT_SORT|D_SORT_REVERSE, SORT_ALIAS, IP SortAliasMethods, NULL,
106 "Sort method for the alias menu"
107 },
108 { "query_command", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
109 "External command to query and external address book"
110 },
111 { "query_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3c %t %-25.25n %-25.25a | %e", IP &QueryFormatDef, NULL,
112 "printf-like format string for the query menu (address book)"
113 },
114 { NULL },
115 // clang-format on
116};
117
122{
124}
static const struct ExpandoDefinition QueryFormatDef[]
Expando definitions.
Definition: config.c:79
static const struct Mapping SortAliasMethods[]
Sort methods for email aliases.
Definition: config.c:42
static const struct ExpandoDefinition AliasFormatDef[]
Expando definitions.
Definition: config.c:57
static struct ConfigDef AliasVars[]
Config definitions for the alias library.
Definition: config.c:97
Convenience wrapper for the config headers.
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition: set.c:281
#define IP
Definition: set.h:54
@ E_TYPE_STRING
Data is a string.
Definition: definition.h:37
@ E_TYPE_NUMBER
Data is numeric.
Definition: definition.h:38
@ ED_ALIAS
Alias ED_ALI_ ExpandoDataAlias.
Definition: domain.h:35
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition: domain.h:44
Parse Expando string.
bool config_init_alias(struct ConfigSet *cs)
Register alias config variables - Implements module_init_config_t -.
Definition: config.c:121
struct ExpandoNode * node_padding_parse(const char *str, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Padding Expando - Implements ExpandoDefinition::parse() -.
Definition: node_padding.c:234
Shared code for the Alias and Query Dialogs.
@ ED_ALI_FLAGS
Alias.flags.
Definition: gui.h:75
@ ED_ALI_NUMBER
AliasView.num.
Definition: gui.h:77
@ ED_ALI_NAME
Alias.name.
Definition: gui.h:76
@ ED_ALI_ADDRESS
Alias.addr.
Definition: gui.h:73
@ ED_ALI_COMMENT
Alias.comment.
Definition: gui.h:74
@ ED_ALI_TAGGED
AliasView.tagged.
Definition: gui.h:78
@ ED_ALI_TAGS
Alias.tags.
Definition: gui.h:79
Convenience wrapper for the library headers.
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:40
@ SORT_ALIAS
Sort by email alias.
Definition: sort2.h:45
@ SORT_ADDRESS
Sort by email address.
Definition: sort2.h:46
Definition: set.h:64
Container for lots of config items.
Definition: set.h:252
Definition of a format string.
Definition: definition.h:52
Mapping between user-readable string and a constant.
Definition: mapping.h:33
#define D_STRING_COMMAND
A command.
Definition: types.h:99
#define D_PATH_FILE
Path is a file.
Definition: types.h:104
@ DT_STRING
a string
Definition: types.h:45
@ DT_SORT
sorting methods
Definition: types.h:44
@ DT_EXPANDO
an expando
Definition: types.h:34
@ DT_PATH
a path to a file/directory
Definition: types.h:40
#define D_SORT_REVERSE
Sort flag for -reverse prefix.
Definition: types.h:120
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition: types.h:80
@ ED_GLO_PADDING_EOL
Padding to end-of-line.
Definition: uid.h:36
@ ED_GLO_PADDING_HARD
Hard Padding.
Definition: uid.h:37
@ ED_GLO_PADDING_SOFT
Soft Padding.
Definition: uid.h:38