NeoMutt
2025-12-11-1040-g5187ba
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
config.c
Go to the documentation of this file.
1
24
30
31
#include "config.h"
32
#include <stdbool.h>
33
#include <stddef.h>
34
#include <stdint.h>
35
#include "
mutt/lib.h
"
36
#include "
config/lib.h
"
37
#include "
auth.h
"
38
#ifdef USE_SASL_CYRUS
39
#include "
conn/lib.h
"
40
#endif
41
45
static
int
imap_auth_validator
(
const
struct
ConfigDef
*cdef, intptr_t value,
struct
Buffer
*err)
46
{
47
const
struct
Slist
*imap_auth_methods = (
const
struct
Slist
*) value;
48
if
(!imap_auth_methods || (imap_auth_methods->
count
== 0))
49
return
CSR_SUCCESS
;
50
51
struct
ListNode
*np = NULL;
52
STAILQ_FOREACH
(np, &imap_auth_methods->
head
, entries)
53
{
54
if
(
imap_auth_is_valid
(np->
data
))
55
continue
;
56
#ifdef USE_SASL_CYRUS
57
if
(
sasl_auth_validator
(np->
data
))
58
continue
;
59
#endif
60
buf_printf
(err,
_
(
"Option %s: %s is not a valid authenticator"
), cdef->
name
, np->
data
);
61
return
CSR_ERR_INVALID
;
62
}
63
64
return
CSR_SUCCESS
;
65
}
66
70
struct
ConfigDef
ImapVars
[] = {
71
// clang-format off
72
{
"imap_check_subscribed"
,
DT_BOOL
,
false
, 0, NULL,
73
"(imap) When opening a mailbox, ask the server for a list of subscribed folders"
74
},
75
{
"imap_condstore"
,
DT_BOOL
,
false
, 0, NULL,
76
"(imap) Enable the CONDSTORE extension"
77
},
78
{
"imap_authenticators"
,
DT_SLIST
|
D_SLIST_SEP_COLON
, 0, 0,
imap_auth_validator
,
79
"(imap) List of allowed IMAP authentication methods (colon-separated)"
80
},
81
{
"imap_delim_chars"
,
DT_STRING
,
IP
"/."
, 0, NULL,
82
"(imap) Characters that denote separators in IMAP folders"
83
},
84
{
"imap_fetch_chunk_size"
,
DT_LONG
|
D_INTEGER_NOT_NEGATIVE
, 0, 0, NULL,
85
"(imap) Download headers in blocks of this size"
86
},
87
{
"imap_headers"
,
DT_STRING
, 0, 0, NULL,
88
"(imap) Additional email headers to download when getting index"
89
},
90
{
"imap_idle"
,
DT_BOOL
,
false
, 0, NULL,
91
"(imap) Use the IMAP IDLE extension to check for new mail"
92
},
93
{
"imap_login"
,
DT_STRING
|
D_SENSITIVE
, 0, 0, NULL,
94
"(imap) Login name for the IMAP server (defaults to `$imap_user`)"
95
},
96
{
"imap_oauth_refresh_command"
,
DT_STRING
|
D_STRING_COMMAND
|
D_SENSITIVE
, 0, 0, NULL,
97
"(imap) External command to generate OAUTH refresh token"
98
},
99
{
"imap_pass"
,
DT_STRING
|
D_SENSITIVE
, 0, 0, NULL,
100
"(imap) Password for the IMAP server"
101
},
102
{
"imap_pipeline_depth"
,
DT_NUMBER
|
D_INTEGER_NOT_NEGATIVE
, 15, 0, NULL,
103
"(imap) Number of IMAP commands that may be queued up"
104
},
105
{
"imap_rfc5161"
,
DT_BOOL
,
true
, 0, NULL,
106
"(imap) Use the IMAP ENABLE extension to select capabilities"
107
},
108
{
"imap_server_noise"
,
DT_BOOL
,
true
, 0, NULL,
109
"(imap) Display server warnings as error messages"
110
},
111
{
"imap_keep_alive"
,
DT_NUMBER
|
D_INTEGER_NOT_NEGATIVE
, 300, 0, NULL,
112
"(imap) Time to wait before polling an open IMAP connection"
113
},
114
{
"imap_list_subscribed"
,
DT_BOOL
,
false
, 0, NULL,
115
"(imap) When browsing a mailbox, only display subscribed folders"
116
},
117
{
"imap_passive"
,
DT_BOOL
,
true
, 0, NULL,
118
"(imap) Reuse an existing IMAP connection to check for new mail"
119
},
120
{
"imap_peek"
,
DT_BOOL
,
true
, 0, NULL,
121
"(imap) Don't mark messages as read when fetching them from the server"
122
},
123
{
"imap_poll_timeout"
,
DT_NUMBER
|
D_INTEGER_NOT_NEGATIVE
, 15, 0, NULL,
124
"(imap) Maximum time to wait for a server response"
125
},
126
{
"imap_qresync"
,
DT_BOOL
,
false
, 0, NULL,
127
"(imap) Enable the QRESYNC extension"
128
},
129
{
"imap_send_id"
,
DT_BOOL
,
false
, 0, NULL,
130
"(imap) Send ID command when logging in"
131
},
132
{
"imap_user"
,
DT_STRING
|
D_SENSITIVE
, 0, 0, NULL,
133
"(imap) Username for the IMAP server"
134
},
135
136
{
"imap_keepalive"
,
DT_SYNONYM
,
IP
"imap_keep_alive"
,
IP
"2023-05-31"
},
137
{
"imap_servernoise"
,
DT_SYNONYM
,
IP
"imap_server_noise"
,
IP
"2021-02-11"
},
138
{ NULL },
139
// clang-format on
140
};
141
142
#if defined(USE_ZLIB)
146
struct
ConfigDef
ImapVarsZlib
[] = {
147
// clang-format off
148
{
"imap_deflate"
,
DT_BOOL
,
true
, 0, NULL,
149
"(imap) Compress network traffic"
150
},
151
{ NULL },
152
// clang-format on
153
};
154
#endif
auth.h
IMAP authenticator multiplexor.
buf_printf
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition
buffer.c:168
lib.h
Convenience wrapper for the config headers.
CSR_ERR_INVALID
#define CSR_ERR_INVALID
Value hasn't been set.
Definition
set.h:36
CSR_SUCCESS
#define CSR_SUCCESS
Action completed successfully.
Definition
set.h:33
IP
#define IP
Definition
set.h:55
lib.h
Connection Library.
imap_auth_validator
static int imap_auth_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "imap_authenticators" config variable - Implements ConfigDef::validator() -.
Definition
config.c:45
imap_auth_is_valid
bool imap_auth_is_valid(const char *authenticator)
Check if string is a valid imap authentication method.
Definition
auth.c:96
ImapVars
struct ConfigDef ImapVars[]
Config definitions for the IMAP library.
Definition
config.c:70
ImapVarsZlib
struct ConfigDef ImapVarsZlib[]
Config definitions for IMAP compression.
Definition
config.c:146
lib.h
Convenience wrapper for the library headers.
_
#define _(a)
Definition
message.h:28
STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field)
Definition
queue.h:390
sasl_auth_validator
bool sasl_auth_validator(const char *authenticator)
SASL callback functions, e.g. mutt_sasl_cb_authname(), mutt_sasl_cb_pass().
Definition
sasl.c:133
Buffer
String manipulation buffer.
Definition
buffer.h:36
ConfigDef
Definition
set.h:65
ConfigDef::name
const char * name
User-visible name.
Definition
set.h:66
ListNode
A List node for strings.
Definition
list.h:37
ListNode::data
char * data
String.
Definition
list.h:38
Slist
String list.
Definition
slist.h:37
Slist::head
struct ListHead head
List containing values.
Definition
slist.h:38
Slist::count
size_t count
Number of values in list.
Definition
slist.h:39
D_SLIST_SEP_COLON
#define D_SLIST_SEP_COLON
Slist items are colon-separated.
Definition
types.h:112
D_STRING_COMMAND
#define D_STRING_COMMAND
A command.
Definition
types.h:99
DT_NUMBER
@ DT_NUMBER
a number
Definition
types.h:38
DT_SLIST
@ DT_SLIST
a list of strings
Definition
types.h:42
DT_BOOL
@ DT_BOOL
boolean option
Definition
types.h:32
DT_SYNONYM
@ DT_SYNONYM
synonym for another variable
Definition
types.h:45
DT_STRING
@ DT_STRING
a string
Definition
types.h:44
DT_LONG
@ DT_LONG
a number (long)
Definition
types.h:35
D_SENSITIVE
#define D_SENSITIVE
Contains sensitive value, e.g. password.
Definition
types.h:81
D_INTEGER_NOT_NEGATIVE
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition
types.h:101