NeoMutt  2020-11-20
Teaching an old dog new tricks
DOXYGEN
mutt_config.c File Reference

Definitions of config variables. More...

#include "config.h"
#include <stddef.h>
#include <stdbool.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "alias/lib.h"
#include "gui/lib.h"
#include "bcache/lib.h"
#include "compose/lib.h"
#include "browser.h"
#include "commands.h"
#include "handler.h"
#include "hdrline.h"
#include "hook.h"
#include "index.h"
#include "init.h"
#include "mailcap.h"
#include "main.h"
#include "mutt_globals.h"
#include "mutt_logging.h"
#include "mutt_mailbox.h"
#include "mutt_menu.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "mx.h"
#include "pager.h"
#include "progress.h"
#include "recvattach.h"
#include "recvcmd.h"
#include "remailer.h"
#include "rfc3676.h"
#include "score.h"
#include "sort.h"
#include "status.h"
+ Include dependency graph for mutt_config.c:

Go to the source code of this file.

Macros

#define CONFIG_INIT_TYPE(CS, NAME)
 
#define CONFIG_INIT_VARS(CS, NAME)
 

Functions

int multipart_validator (const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
 Validate the "show_multipart_alternative" config variable - Implements ConfigDef::validator() More...
 
int pager_validator (const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
 Check for config variables that can't be set from the pager - Implements ConfigDef::validator() More...
 
int reply_validator (const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
 Validate the "reply_regex" config variable - Implements ConfigDef::validator() More...
 
static bool config_init_main (struct ConfigSet *cs)
 Register main config variables - Implements module_init_config_t. More...
 
static void init_types (struct ConfigSet *cs)
 Create the config types. More...
 
static void init_variables (struct ConfigSet *cs)
 Define the config variables. More...
 
struct ConfigSetinit_config (size_t size)
 Initialise the config system. More...
 

Variables

char * C_Escape = NULL
 
bool C_IgnoreLinearWhiteSpace = false
 
const struct Mapping SortAuxMethods []
 Sort methods for '$sort_aux' for the index. More...
 
const struct Mapping SortMethods []
 Sort methods for '$sort' for the index. More...
 
const struct Mapping SortBrowserMethods []
 Sort methods for the folder/dir browser. More...
 
struct ConfigDef MainVars []
 

Detailed Description

Definitions of config variables.

Authors
  • Michael R. Elkins
  • g10 Code GmbH

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 mutt_config.c.

Macro Definition Documentation

◆ CONFIG_INIT_TYPE

#define CONFIG_INIT_TYPE (   CS,
  NAME 
)
Value:
extern const struct ConfigSetType cst_##NAME; \
cs_register_type(CS, &cst_##NAME)
Type definition for a config item.
Definition: set.h:88

Definition at line 68 of file mutt_config.c.

◆ CONFIG_INIT_VARS

#define CONFIG_INIT_VARS (   CS,
  NAME 
)
Value:
bool config_init_##NAME(struct ConfigSet *cs); \
config_init_##NAME(CS)
Container for lots of config items.
Definition: set.h:228

Definition at line 72 of file mutt_config.c.

Function Documentation

◆ multipart_validator()

int multipart_validator ( const struct ConfigSet cs,
const struct ConfigDef cdef,
intptr_t  value,
struct Buffer err 
)

Validate the "show_multipart_alternative" config variable - Implements ConfigDef::validator()

Definition at line 144 of file mutt_config.c.

146 {
147  if (value == 0)
148  return CSR_SUCCESS;
149 
150  const char *str = (const char *) value;
151 
152  if (mutt_str_equal(str, "inline") || mutt_str_equal(str, "info"))
153  return CSR_SUCCESS;
154 
155  mutt_buffer_printf(err, _("Invalid value for option %s: %s"), cdef->name, str);
156  return CSR_ERR_INVALID;
157 }
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:871
#define CSR_ERR_INVALID
Value hasn&#39;t been set.
Definition: set.h:38
#define _(a)
Definition: message.h:28
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
const char * name
User-visible name.
Definition: set.h:63
+ Here is the call graph for this function:

◆ pager_validator()

int pager_validator ( const struct ConfigSet cs,
const struct ConfigDef cdef,
intptr_t  value,
struct Buffer err 
)

Check for config variables that can't be set from the pager - Implements ConfigDef::validator()

Definition at line 162 of file mutt_config.c.

164 {
165  if (CurrentMenu == MENU_PAGER)
166  {
167  mutt_buffer_printf(err, _("Option %s may not be set or reset from the pager"),
168  cdef->name);
169  return CSR_ERR_INVALID;
170  }
171 
172  return CSR_SUCCESS;
173 }
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
#define CSR_ERR_INVALID
Value hasn&#39;t been set.
Definition: set.h:38
#define _(a)
Definition: message.h:28
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
Pager pager (email viewer)
Definition: keymap.h:81
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: mutt_globals.h:77
const char * name
User-visible name.
Definition: set.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reply_validator()

int reply_validator ( const struct ConfigSet cs,
const struct ConfigDef cdef,
intptr_t  value,
struct Buffer err 
)

Validate the "reply_regex" config variable - Implements ConfigDef::validator()

Definition at line 178 of file mutt_config.c.

180 {
181  if (pager_validator(cs, cdef, value, err) != CSR_SUCCESS)
182  return CSR_ERR_INVALID;
183 
184  if (!OptAttachMsg)
185  return CSR_SUCCESS;
186 
187  mutt_buffer_printf(err, _("Option %s may not be set when in attach-message mode"),
188  cdef->name);
189  return CSR_ERR_INVALID;
190 }
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
#define CSR_ERR_INVALID
Value hasn&#39;t been set.
Definition: set.h:38
#define _(a)
Definition: message.h:28
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
const char * name
User-visible name.
Definition: set.h:63
WHERE bool OptAttachMsg
(pseudo) used by attach-message
Definition: options.h:31
int pager_validator(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Check for config variables that can&#39;t be set from the pager - Implements ConfigDef::validator() ...
Definition: mutt_config.c:162
+ Here is the call graph for this function:

◆ config_init_main()

static bool config_init_main ( struct ConfigSet cs)
static

Register main config variables - Implements module_init_config_t.

Definition at line 781 of file mutt_config.c.

782 {
783  return cs_register_variables(cs, MainVars, 0);
784 }
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[], int flags)
Register a set of config items.
Definition: set.c:286
struct ConfigDef MainVars[]
Definition: mutt_config.c:192
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_types()

static void init_types ( struct ConfigSet cs)
static

Create the config types.

Parameters
csConfig items

Define the config types, e.g. DT_STRING.

Definition at line 792 of file mutt_config.c.

793 {
794  CONFIG_INIT_TYPE(cs, address);
795  CONFIG_INIT_TYPE(cs, bool);
796  CONFIG_INIT_TYPE(cs, enum);
797  CONFIG_INIT_TYPE(cs, long);
798  CONFIG_INIT_TYPE(cs, mbtable);
799  CONFIG_INIT_TYPE(cs, number);
800  CONFIG_INIT_TYPE(cs, path);
801  CONFIG_INIT_TYPE(cs, quad);
802  CONFIG_INIT_TYPE(cs, regex);
803  CONFIG_INIT_TYPE(cs, slist);
804  CONFIG_INIT_TYPE(cs, sort);
805  CONFIG_INIT_TYPE(cs, string);
806 }
#define CONFIG_INIT_TYPE(CS, NAME)
Definition: mutt_config.c:68
+ Here is the caller graph for this function:

◆ init_variables()

static void init_variables ( struct ConfigSet cs)
static

Define the config variables.

Parameters
csConfig items

Definition at line 812 of file mutt_config.c.

813 {
814  // Define the config variables
815  config_init_main(cs);
816  CONFIG_INIT_VARS(cs, alias);
817 #ifdef USE_AUTOCRYPT
818  CONFIG_INIT_VARS(cs, autocrypt);
819 #endif
820  CONFIG_INIT_VARS(cs, compose);
821  CONFIG_INIT_VARS(cs, conn);
822 #ifdef USE_HCACHE
823  CONFIG_INIT_VARS(cs, hcache);
824 #endif
825  CONFIG_INIT_VARS(cs, helpbar);
826  CONFIG_INIT_VARS(cs, history);
827 #ifdef USE_IMAP
828  CONFIG_INIT_VARS(cs, imap);
829 #endif
830  CONFIG_INIT_VARS(cs, maildir);
831  CONFIG_INIT_VARS(cs, mbox);
832  CONFIG_INIT_VARS(cs, ncrypt);
833 #ifdef USE_NNTP
834  CONFIG_INIT_VARS(cs, nntp);
835 #endif
836 #ifdef USE_NOTMUCH
837  CONFIG_INIT_VARS(cs, notmuch);
838 #endif
839  CONFIG_INIT_VARS(cs, pattern);
840 #ifdef USE_POP
841  CONFIG_INIT_VARS(cs, pop);
842 #endif
843  CONFIG_INIT_VARS(cs, send);
844 #ifdef USE_SIDEBAR
845  CONFIG_INIT_VARS(cs, sidebar);
846 #endif
847 }
static bool send(struct Notify *source, struct Notify *current, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:107
#define CONFIG_INIT_VARS(CS, NAME)
Definition: mutt_config.c:72
static bool config_init_main(struct ConfigSet *cs)
Register main config variables - Implements module_init_config_t.
Definition: mutt_config.c:781
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_config()

struct ConfigSet* init_config ( size_t  size)

Initialise the config system.

Parameters
sizeSize for Config Hash Table
Return values
ptrNew Config Set

Definition at line 854 of file mutt_config.c.

855 {
856  struct ConfigSet *cs = cs_new(size);
857 
858  init_types(cs);
859  init_variables(cs);
860 
861  return cs;
862 }
Container for lots of config items.
Definition: set.h:228
static void init_variables(struct ConfigSet *cs)
Define the config variables.
Definition: mutt_config.c:812
struct ConfigSet * cs_new(size_t size)
Create a new Config Set.
Definition: set.c:166
static void init_types(struct ConfigSet *cs)
Create the config types.
Definition: mutt_config.c:792
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ C_Escape

char* C_Escape = NULL

Definition at line 77 of file mutt_config.c.

◆ C_IgnoreLinearWhiteSpace

bool C_IgnoreLinearWhiteSpace = false

Definition at line 78 of file mutt_config.c.

◆ SortAuxMethods

const struct Mapping SortAuxMethods[]
Initial value:
= {
{ "date", SORT_DATE },
{ "date-sent", SORT_DATE },
{ "threads", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "unsorted", SORT_ORDER },
{ "mailbox-order", SORT_ORDER },
{ "score", SORT_SCORE },
{ "size", SORT_SIZE },
{ "spam", SORT_SPAM },
{ "subject", SORT_SUBJECT },
{ "to", SORT_TO },
{ NULL, 0 },
}
Sort by the email&#39;s From field.
Definition: sort2.h:49
Sort by the email&#39;s score.
Definition: sort2.h:54
Sort by the emails label.
Definition: sort2.h:64
Sort by the size of the email.
Definition: sort2.h:46
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:50
Sort by the email&#39;s spam score.
Definition: sort2.h:59
Sort by the email&#39;s To field.
Definition: sort2.h:53
Sort by when the message were delivered locally.
Definition: sort2.h:52
Sort by the date the email was sent.
Definition: sort2.h:45
Sort by the email&#39;s subject.
Definition: sort2.h:48

Sort methods for '$sort_aux' for the index.

Definition at line 83 of file mutt_config.c.

◆ SortMethods

const struct Mapping SortMethods[]
Initial value:
= {
{ "date", SORT_DATE },
{ "date-sent", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "unsorted", SORT_ORDER },
{ "mailbox-order", SORT_ORDER },
{ "score", SORT_SCORE },
{ "size", SORT_SIZE },
{ "spam", SORT_SPAM },
{ "subject", SORT_SUBJECT },
{ "threads", SORT_THREADS },
{ "to", SORT_TO },
{ NULL, 0 },
}
Sort by the email&#39;s From field.
Definition: sort2.h:49
Sort by the email&#39;s score.
Definition: sort2.h:54
Sort by the emails label.
Definition: sort2.h:64
Sort by the size of the email.
Definition: sort2.h:46
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:50
Sort by email threads.
Definition: sort2.h:51
Sort by the email&#39;s spam score.
Definition: sort2.h:59
Sort by the email&#39;s To field.
Definition: sort2.h:53
Sort by when the message were delivered locally.
Definition: sort2.h:52
Sort by the date the email was sent.
Definition: sort2.h:45
Sort by the email&#39;s subject.
Definition: sort2.h:48

Sort methods for '$sort' for the index.

Definition at line 105 of file mutt_config.c.

◆ SortBrowserMethods

const struct Mapping SortBrowserMethods[]
Initial value:
= {
{ "alpha", SORT_SUBJECT },
{ "count", SORT_COUNT },
{ "date", SORT_DATE },
{ "desc", SORT_DESC },
{ "new", SORT_UNREAD },
{ "unread", SORT_UNREAD },
{ "size", SORT_SIZE },
{ "unsorted", SORT_ORDER },
{ NULL, 0 },
}
Sort by the size of the email.
Definition: sort2.h:46
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:50
Sort by the number of unread emails.
Definition: sort2.h:61
Sort by the folder&#39;s description.
Definition: sort2.h:65
Sort by number of emails in a folder.
Definition: sort2.h:60
Sort by the date the email was sent.
Definition: sort2.h:45
Sort by the email&#39;s subject.
Definition: sort2.h:48

Sort methods for the folder/dir browser.

Definition at line 127 of file mutt_config.c.

◆ MainVars

struct ConfigDef MainVars[]

Definition at line 192 of file mutt_config.c.