NeoMutt  2025-09-05-43-g177ed6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config.c File Reference

Config used by libaddress. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "expando/lib.h"
#include "expando.h"
#include "sort.h"
+ Include dependency graph for config.c:

Go to the source code of this file.

Functions

bool config_init_alias (struct ConfigSet *cs)
 Register alias config variables - Implements module_init_config_t -.
 

Variables

static const struct Mapping AliasSortMethods []
 Sort methods for email aliases.
 
static const struct ExpandoDefinition AliasFormatDef []
 Expando definitions.
 
static const struct ExpandoDefinition QueryFormatDef []
 Expando definitions.
 
static struct ConfigDef AliasVars []
 Config definitions for the alias library.
 

Detailed Description

Config used by libaddress.

Authors
  • Romeu Vieira
  • Richard Russon
  • наб

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file config.c.

Variable Documentation

◆ AliasSortMethods

const struct Mapping AliasSortMethods[]
static
Initial value:
= {
{ "alias", ALIAS_SORT_ALIAS },
{ "email", ALIAS_SORT_EMAIL },
{ "name", ALIAS_SORT_NAME },
{ "unsorted", ALIAS_SORT_UNSORTED },
{ NULL, 0 },
}
@ ALIAS_SORT_UNSORTED
Sort by the order the Aliases were configured.
Definition sort.h:34
@ ALIAS_SORT_NAME
Sort by Real Name.
Definition sort.h:33
@ ALIAS_SORT_EMAIL
Sort by Email Address.
Definition sort.h:32
@ ALIAS_SORT_ALIAS
Sort by Alias short name.
Definition sort.h:31

Sort methods for email aliases.

Definition at line 43 of file config.c.

43 {
44 // clang-format off
45 { "alias", ALIAS_SORT_ALIAS },
46 { "email", ALIAS_SORT_EMAIL },
47 { "name", ALIAS_SORT_NAME },
48 { "unsorted", ALIAS_SORT_UNSORTED },
49 { NULL, 0 },
50 // clang-format on
51};

◆ AliasFormatDef

const struct ExpandoDefinition AliasFormatDef[]
static
Initial value:
= {
{ "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
{ ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
{ "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
{ "a", "alias", ED_ALIAS, ED_ALI_ALIAS, NULL },
{ "A", "address", ED_ALIAS, ED_ALI_ADDRESS, NULL },
{ "C", "comment", ED_ALIAS, ED_ALI_COMMENT, NULL },
{ "E", "email", ED_ALIAS, ED_ALI_EMAIL, NULL },
{ "f", "flags", ED_ALIAS, ED_ALI_FLAGS, NULL },
{ "i", "number", ED_ALIAS, ED_ALI_NUMBER, NULL },
{ "N", "name", ED_ALIAS, ED_ALI_NAME, NULL },
{ "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, NULL },
{ "Y", "tags", ED_ALIAS, ED_ALI_TAGS, NULL },
{ "c", NULL, ED_ALIAS, ED_ALI_COMMENT, NULL },
{ "n", NULL, ED_ALIAS, ED_ALI_NUMBER, NULL },
{ "r", NULL, ED_ALIAS, ED_ALI_ADDRESS, NULL },
{ NULL, NULL, 0, -1, NULL }
}
@ ED_ALI_FLAGS
Alias.flags.
Definition expando.h:39
@ ED_ALI_EMAIL
Alias.addr.mailbox.
Definition expando.h:38
@ ED_ALI_NUMBER
AliasView.num.
Definition expando.h:41
@ ED_ALI_NAME
Alias.addr.personal.
Definition expando.h:40
@ ED_ALI_ALIAS
Alias.name.
Definition expando.h:36
@ ED_ALI_ADDRESS
Alias.addr.
Definition expando.h:35
@ ED_ALI_COMMENT
Alias.comment.
Definition expando.h:37
@ ED_ALI_TAGGED
AliasView.tagged.
Definition expando.h:42
@ ED_ALI_TAGS
Alias.tags.
Definition expando.h:43
@ ED_ALIAS
Alias ED_ALI_ ExpandoDataAlias.
Definition domain.h:35
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition domain.h:44
struct ExpandoNode * node_padding_parse(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Padding Expando - Implements ExpandoDefinition::parse() -.
@ ED_GLO_PADDING_EOL
Padding to end-of-line.
Definition uid.h:38
@ ED_GLO_PADDING_HARD
Hard Padding.
Definition uid.h:39
@ ED_GLO_PADDING_SOFT
Soft Padding.
Definition uid.h:40

Expando definitions.

Config:

  • $alias_format

Definition at line 59 of file config.c.

59 {
60 // clang-format off
61 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
62 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
63 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
64 { "a", "alias", ED_ALIAS, ED_ALI_ALIAS, NULL },
65 { "A", "address", ED_ALIAS, ED_ALI_ADDRESS, NULL },
66 { "C", "comment", ED_ALIAS, ED_ALI_COMMENT, NULL },
67 { "E", "email", ED_ALIAS, ED_ALI_EMAIL, NULL },
68 { "f", "flags", ED_ALIAS, ED_ALI_FLAGS, NULL },
69 { "i", "number", ED_ALIAS, ED_ALI_NUMBER, NULL },
70 { "N", "name", ED_ALIAS, ED_ALI_NAME, NULL },
71 { "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, NULL },
72 { "Y", "tags", ED_ALIAS, ED_ALI_TAGS, NULL },
73 // Deprecated
74 { "c", NULL, ED_ALIAS, ED_ALI_COMMENT, NULL },
75 { "n", NULL, ED_ALIAS, ED_ALI_NUMBER, NULL },
76 { "r", NULL, ED_ALIAS, ED_ALI_ADDRESS, NULL },
77 { NULL, NULL, 0, -1, NULL }
78 // clang-format on
79};

◆ QueryFormatDef

const struct ExpandoDefinition QueryFormatDef[]
static
Initial value:
= {
{ "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
{ ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
{ "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
{ "A", "address", ED_ALIAS, ED_ALI_ADDRESS, NULL },
{ "C", "comment", ED_ALIAS, ED_ALI_COMMENT, NULL },
{ "E", "email", ED_ALIAS, ED_ALI_EMAIL, NULL },
{ "i", "number", ED_ALIAS, ED_ALI_NUMBER, NULL },
{ "N", "name", ED_ALIAS, ED_ALI_NAME, NULL },
{ "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, NULL },
{ "Y", "tags", ED_ALIAS, ED_ALI_TAGS, NULL },
{ "a", NULL, ED_ALIAS, ED_ALI_EMAIL, NULL },
{ "c", NULL, ED_ALIAS, ED_ALI_NUMBER, NULL },
{ "e", NULL, ED_ALIAS, ED_ALI_COMMENT, NULL },
{ "n", NULL, ED_ALIAS, ED_ALI_NAME, NULL },
{ NULL, NULL, 0, -1, NULL }
}

Expando definitions.

Config:

  • $query_format

Definition at line 87 of file config.c.

87 {
88 // clang-format off
89 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
90 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
91 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
92 { "A", "address", ED_ALIAS, ED_ALI_ADDRESS, NULL },
93 { "C", "comment", ED_ALIAS, ED_ALI_COMMENT, NULL },
94 { "E", "email", ED_ALIAS, ED_ALI_EMAIL, NULL },
95 { "i", "number", ED_ALIAS, ED_ALI_NUMBER, NULL },
96 { "N", "name", ED_ALIAS, ED_ALI_NAME, NULL },
97 { "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, NULL },
98 { "Y", "tags", ED_ALIAS, ED_ALI_TAGS, NULL },
99 // Deprecated
100 { "a", NULL, ED_ALIAS, ED_ALI_EMAIL, NULL },
101 { "c", NULL, ED_ALIAS, ED_ALI_NUMBER, NULL },
102 { "e", NULL, ED_ALIAS, ED_ALI_COMMENT, NULL },
103 { "n", NULL, ED_ALIAS, ED_ALI_NAME, NULL },
104 { NULL, NULL, 0, -1, NULL }
105 // clang-format on
106};

◆ AliasVars

struct ConfigDef AliasVars[]
static
Initial value:
= {
{ "alias_file", DT_PATH|D_PATH_FILE, IP "~/.neomuttrc", 0, NULL,
"Save new aliases to this file"
},
{ "alias_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3i %f%t %-15a %-56A | %C%> %Y", IP &AliasFormatDef, NULL,
"printf-like format string for the alias menu"
},
"Sort method for the alias menu"
},
{ "query_command", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
"External command to query and external address book"
},
{ "query_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3i %t %-25N %-25E | %C%> %Y", IP &QueryFormatDef, NULL,
"printf-like format string for the query menu (address book)"
},
{ "sort_alias", DT_SYNONYM, IP "alias_sort", IP "2024-11-19" },
{ NULL },
}
static const struct Mapping AliasSortMethods[]
Sort methods for email aliases.
Definition config.c:43
static const struct ExpandoDefinition QueryFormatDef[]
Expando definitions.
Definition config.c:87
static const struct ExpandoDefinition AliasFormatDef[]
Expando definitions.
Definition config.c:59
#define IP
Definition set.h:52
#define D_STRING_COMMAND
A command.
Definition types.h:98
#define D_PATH_FILE
Path is a file.
Definition types.h:103
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44
@ DT_SORT
sorting methods
Definition types.h:43
@ DT_EXPANDO
an expando
Definition types.h:34
@ DT_PATH
a path to a file/directory
Definition types.h:39
#define D_SORT_REVERSE
Sort flag for -reverse prefix.
Definition types.h:119
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:79

Config definitions for the alias library.

Definition at line 111 of file config.c.

111 {
112 // clang-format off
113 { "alias_file", DT_PATH|D_PATH_FILE, IP "~/.neomuttrc", 0, NULL,
114 "Save new aliases to this file"
115 },
116 { "alias_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3i %f%t %-15a %-56A | %C%> %Y", IP &AliasFormatDef, NULL,
117 "printf-like format string for the alias menu"
118 },
120 "Sort method for the alias menu"
121 },
122 { "query_command", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
123 "External command to query and external address book"
124 },
125 { "query_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3i %t %-25N %-25E | %C%> %Y", IP &QueryFormatDef, NULL,
126 "printf-like format string for the query menu (address book)"
127 },
128
129 { "sort_alias", DT_SYNONYM, IP "alias_sort", IP "2024-11-19" },
130
131 { NULL },
132 // clang-format on
133};