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

Config used by libbrowser. More...

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

Go to the source code of this file.

Functions

struct ExpandoNodeparse_folder_date (const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
 Parse a Date Expando - Implements ExpandoDefinition::parse() -.
 
bool config_init_browser (struct ConfigSet *cs)
 Register browser config variables - Implements module_init_config_t -.
 

Variables

static const struct Mapping BrowserSortMethods []
 Sort methods for the folder/dir browser.
 
static const struct ExpandoDefinition FolderFormatDef []
 Expando definitions.
 
static const struct ExpandoDefinition GroupIndexFormatDef []
 Expando definitions.
 
static struct ConfigDef BrowserVars []
 Config definitions for the browser.
 

Detailed Description

Config used by libbrowser.

Authors
  • Carlos Henrique Lima Melara
  • 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

◆ BrowserSortMethods

const struct Mapping BrowserSortMethods[]
static
Initial value:
= {
{ "alpha", BROWSER_SORT_ALPHA },
{ "count", BROWSER_SORT_COUNT },
{ "date", BROWSER_SORT_DATE },
{ "desc", BROWSER_SORT_DESC },
{ "size", BROWSER_SORT_SIZE },
{ "new", BROWSER_SORT_NEW },
{ "unsorted", BROWSER_SORT_UNSORTED },
{ "unread", BROWSER_SORT_NEW },
{ NULL, 0 },
}
@ BROWSER_SORT_ALPHA
Sort alphabetically by name.
Definition sort.h:31
@ BROWSER_SORT_UNSORTED
Sort into the raw order.
Definition sort.h:37
@ BROWSER_SORT_COUNT
Sort by total message count.
Definition sort.h:32
@ BROWSER_SORT_DATE
Sort by date.
Definition sort.h:33
@ BROWSER_SORT_NEW
Sort by count of new messages.
Definition sort.h:35
@ BROWSER_SORT_SIZE
Sort by size.
Definition sort.h:36
@ BROWSER_SORT_DESC
Sort by description.
Definition sort.h:34

Sort methods for the folder/dir browser.

Definition at line 43 of file config.c.

43 {
44 // clang-format off
45 { "alpha", BROWSER_SORT_ALPHA },
46 { "count", BROWSER_SORT_COUNT },
47 { "date", BROWSER_SORT_DATE },
48 { "desc", BROWSER_SORT_DESC },
49 { "size", BROWSER_SORT_SIZE },
50 { "new", BROWSER_SORT_NEW },
51 { "unsorted", BROWSER_SORT_UNSORTED },
52 // Compatibility
53 { "unread", BROWSER_SORT_NEW },
54 { NULL, 0 },
55 // clang-format on
56};

◆ FolderFormatDef

const struct ExpandoDefinition FolderFormatDef[]
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 },
{ " ", "padding-space", ED_GLOBAL, ED_GLO_PADDING_SPACE, NULL },
{ "a", "notify", ED_FOLDER, ED_FOL_NOTIFY, NULL },
{ "C", "number", ED_FOLDER, ED_FOL_NUMBER, NULL },
{ "d", "date", ED_FOLDER, ED_FOL_DATE, NULL },
{ "D", "date-format", ED_FOLDER, ED_FOL_DATE_FORMAT, NULL },
{ "f", "filename", ED_FOLDER, ED_FOL_FILENAME, NULL },
{ "F", "file-mode", ED_FOLDER, ED_FOL_FILE_MODE, NULL },
{ "g", "file-group", ED_FOLDER, ED_FOL_FILE_GROUP, NULL },
{ "i", "description", ED_FOLDER, ED_FOL_DESCRIPTION, NULL },
{ "l", "hard-links", ED_FOLDER, ED_FOL_HARD_LINKS, NULL },
{ "m", "message-count", ED_FOLDER, ED_FOL_MESSAGE_COUNT, NULL },
{ "n", "unread-count", ED_FOLDER, ED_FOL_UNREAD_COUNT, NULL },
{ "N", "new-mail", ED_FOLDER, ED_FOL_NEW_MAIL, NULL },
{ "p", "poll", ED_FOLDER, ED_FOL_POLL, NULL },
{ "s", "file-size", ED_FOLDER, ED_FOL_FILE_SIZE, NULL },
{ "t", "tagged", ED_FOLDER, ED_FOL_TAGGED, NULL },
{ "u", "file-owner", ED_FOLDER, ED_FOL_FILE_OWNER, NULL },
{ NULL, NULL, 0, -1, NULL }
}
@ ED_FOL_POLL
FolderFile.poll_new_mail.
Definition lib.h:135
@ ED_FOL_NOTIFY
FolderFile.notify_user.
Definition lib.h:133
@ ED_FOL_FILE_OWNER
FolderFile.uid.
Definition lib.h:124
@ ED_FOL_FILE_GROUP
FolderFile.gid.
Definition lib.h:122
@ ED_FOL_FILENAME
FolderFile.name.
Definition lib.h:121
@ ED_FOL_DATE_FORMAT
FolderFile.mtime.
Definition lib.h:118
@ ED_FOL_DATE_STRF
FolderFile.mtime.
Definition lib.h:119
@ ED_FOL_UNREAD_COUNT
FolderFile.msg_unread.
Definition lib.h:137
@ ED_FOL_FILE_MODE
FolderFile.move.
Definition lib.h:123
@ ED_FOL_NEW_MAIL
FolderFile.has_new_mail.
Definition lib.h:132
@ ED_FOL_FILE_SIZE
FolderFile.size.
Definition lib.h:125
@ ED_FOL_HARD_LINKS
FolderFile.nlink.
Definition lib.h:128
@ ED_FOL_DATE
FolderFile.mtime.
Definition lib.h:117
@ ED_FOL_TAGGED
FolderFile.tagged.
Definition lib.h:136
@ ED_FOL_NUMBER
Folder.num.
Definition lib.h:134
@ ED_FOL_DESCRIPTION
FolderFile.desc, FolderFile.name.
Definition lib.h:120
@ ED_FOL_MESSAGE_COUNT
FolderFile.msg_count.
Definition lib.h:129
@ ED_FOLDER
Folder ED_FOL_ ExpandoDataFolder.
Definition domain.h:43
@ 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() -.
struct ExpandoNode * parse_folder_date(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Date Expando - Implements ExpandoDefinition::parse() -.
Definition config.c:64
@ 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
@ ED_GLO_PADDING_SPACE
Space Padding.
Definition uid.h:41

Expando definitions.

Config:

  • $folder_format
  • $mailbox_folder_format

Definition at line 84 of file config.c.

84 {
85 // clang-format off
86 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
87 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
88 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
89 { " ", "padding-space", ED_GLOBAL, ED_GLO_PADDING_SPACE, NULL },
90 { "a", "notify", ED_FOLDER, ED_FOL_NOTIFY, NULL },
91 { "C", "number", ED_FOLDER, ED_FOL_NUMBER, NULL },
92 { "d", "date", ED_FOLDER, ED_FOL_DATE, NULL },
93 { "D", "date-format", ED_FOLDER, ED_FOL_DATE_FORMAT, NULL },
94 { "f", "filename", ED_FOLDER, ED_FOL_FILENAME, NULL },
95 { "F", "file-mode", ED_FOLDER, ED_FOL_FILE_MODE, NULL },
96 { "g", "file-group", ED_FOLDER, ED_FOL_FILE_GROUP, NULL },
97 { "i", "description", ED_FOLDER, ED_FOL_DESCRIPTION, NULL },
98 { "l", "hard-links", ED_FOLDER, ED_FOL_HARD_LINKS, NULL },
99 { "m", "message-count", ED_FOLDER, ED_FOL_MESSAGE_COUNT, NULL },
100 { "n", "unread-count", ED_FOLDER, ED_FOL_UNREAD_COUNT, NULL },
101 { "N", "new-mail", ED_FOLDER, ED_FOL_NEW_MAIL, NULL },
102 { "p", "poll", ED_FOLDER, ED_FOL_POLL, NULL },
103 { "s", "file-size", ED_FOLDER, ED_FOL_FILE_SIZE, NULL },
104 { "t", "tagged", ED_FOLDER, ED_FOL_TAGGED, NULL },
105 { "u", "file-owner", ED_FOLDER, ED_FOL_FILE_OWNER, NULL },
107 { NULL, NULL, 0, -1, NULL }
108 // clang-format on
109};

◆ GroupIndexFormatDef

const struct ExpandoDefinition GroupIndexFormatDef[]
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", "notify", ED_FOLDER, ED_FOL_NOTIFY, NULL },
{ "C", "number", ED_FOLDER, ED_FOL_NUMBER, NULL },
{ "d", "description", ED_FOLDER, ED_FOL_DESCRIPTION, NULL },
{ "f", "newsgroup", ED_FOLDER, ED_FOL_NEWSGROUP, NULL },
{ "M", "flags", ED_FOLDER, ED_FOL_FLAGS, NULL },
{ "n", "new-count", ED_FOLDER, ED_FOL_NEW_COUNT, NULL },
{ "N", "flags2", ED_FOLDER, ED_FOL_FLAGS2, NULL },
{ "p", "poll", ED_FOLDER, ED_FOL_POLL, NULL },
{ "s", "unread-count", ED_FOLDER, ED_FOL_UNREAD_COUNT, NULL },
{ NULL, NULL, 0, -1, NULL }
}
@ ED_FOL_NEW_COUNT
FolderFile.nd (NntpMboxData)
Definition lib.h:131
@ ED_FOL_FLAGS2
FolderFile.nd (NntpMboxData)
Definition lib.h:127
@ ED_FOL_NEWSGROUP
FolderFile.name.
Definition lib.h:130
@ ED_FOL_FLAGS
FolderFile.nd (NntpMboxData)
Definition lib.h:126

Expando definitions.

Config:

  • $group_index_format

Definition at line 117 of file config.c.

117 {
118 // clang-format off
119 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
120 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
121 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
122 { "a", "notify", ED_FOLDER, ED_FOL_NOTIFY, NULL },
123 { "C", "number", ED_FOLDER, ED_FOL_NUMBER, NULL },
124 { "d", "description", ED_FOLDER, ED_FOL_DESCRIPTION, NULL },
125 { "f", "newsgroup", ED_FOLDER, ED_FOL_NEWSGROUP, NULL },
126 { "M", "flags", ED_FOLDER, ED_FOL_FLAGS, NULL },
127 { "n", "new-count", ED_FOLDER, ED_FOL_NEW_COUNT, NULL },
128 { "N", "flags2", ED_FOLDER, ED_FOL_FLAGS2, NULL },
129 { "p", "poll", ED_FOLDER, ED_FOL_POLL, NULL },
130 { "s", "unread-count", ED_FOLDER, ED_FOL_UNREAD_COUNT, NULL },
131 { NULL, NULL, 0, -1, NULL }
132 // clang-format on
133};

◆ BrowserVars

struct ConfigDef BrowserVars[]
static

Config definitions for the browser.

Definition at line 138 of file config.c.

138 {
139 // clang-format off
140 { "browser_abbreviate_mailboxes", DT_BOOL, true, 0, NULL,
141 "Abbreviate mailboxes using '~' and '=' in the browser"
142 },
144 "Sort method for the browser"
145 },
146 { "folder_format", DT_EXPANDO|D_NOT_EMPTY, IP "%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %i", IP &FolderFormatDef, NULL,
147 "printf-like format string for the browser's display of folders"
148 },
149 { "group_index_format", DT_EXPANDO|D_NOT_EMPTY, IP "%4C %M%N %5s %-45.45f %d", IP &GroupIndexFormatDef, NULL,
150 "(nntp) printf-like format string for the browser's display of newsgroups"
151 },
152 { "mailbox_folder_format", DT_EXPANDO|D_NOT_EMPTY, IP "%2C %<n?%6n& > %6m %i", IP &FolderFormatDef, NULL,
153 "printf-like format string for the browser's display of mailbox folders"
154 },
155 { "mask", DT_REGEX|D_REGEX_MATCH_CASE|D_REGEX_ALLOW_NOT|D_REGEX_NOSUB, IP "!^\\.[^.]", 0, NULL,
156 "Only display files/dirs matching this regex in the browser"
157 },
158 { "show_only_unread", DT_BOOL, false, 0, NULL,
159 "(nntp) Only show subscribed newsgroups with unread articles"
160 },
161 { "browser_sort_dirs_first", DT_BOOL, false, 0, NULL,
162 "Group directories before files in the browser"
163 },
164
165 { "sort_browser", DT_SYNONYM, IP "browser_sort", IP "2024-11-20" },
166
167 { NULL },
168 // clang-format on
169};
static const struct ExpandoDefinition GroupIndexFormatDef[]
Expando definitions.
Definition config.c:117
static const struct ExpandoDefinition FolderFormatDef[]
Expando definitions.
Definition config.c:84
static const struct Mapping BrowserSortMethods[]
Sort methods for the folder/dir browser.
Definition config.c:43
#define IP
Definition set.h:52
#define D_REGEX_ALLOW_NOT
Regex can begin with '!'.
Definition types.h:106
#define D_REGEX_MATCH_CASE
Case-sensitive matching.
Definition types.h:105
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_SORT
sorting methods
Definition types.h:43
@ DT_EXPANDO
an expando
Definition types.h:34
@ DT_REGEX
regular expressions
Definition types.h:41
#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
#define D_REGEX_NOSUB
Do not report what was matched (REG_NOSUB)
Definition types.h:107