NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
mutt_config.c File Reference
#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 "pager/lib.h"
#include "browser.h"
#include "commands.h"
#include "handler.h"
#include "hdrline.h"
#include "hook.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 "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)

Definition at line 67 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)

Definition at line 71 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 143 of file mutt_config.c.

145 {
146  if (value == 0)
147  return CSR_SUCCESS;
148 
149  const char *str = (const char *) value;
150 
151  if (mutt_str_equal(str, "inline") || mutt_str_equal(str, "info"))
152  return CSR_SUCCESS;
153 
154  mutt_buffer_printf(err, _("Invalid value for option %s: %s"), cdef->name, str);
155  return CSR_ERR_INVALID;
156 }
+ 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 161 of file mutt_config.c.

163 {
164  if (CurrentMenu == MENU_PAGER)
165  {
166  mutt_buffer_printf(err, _("Option %s may not be set or reset from the pager"),
167  cdef->name);
168  return CSR_ERR_INVALID;
169  }
170 
171  return CSR_SUCCESS;
172 }
+ 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 177 of file mutt_config.c.

179 {
180  if (pager_validator(cs, cdef, value, err) != CSR_SUCCESS)
181  return CSR_ERR_INVALID;
182 
183  if (!OptAttachMsg)
184  return CSR_SUCCESS;
185 
186  mutt_buffer_printf(err, _("Option %s may not be set when in attach-message mode"),
187  cdef->name);
188  return CSR_ERR_INVALID;
189 }
+ 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 743 of file mutt_config.c.

744 {
745  return cs_register_variables(cs, MainVars, 0);
746 }
+ 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 754 of file mutt_config.c.

755 {
756  CONFIG_INIT_TYPE(cs, address);
757  CONFIG_INIT_TYPE(cs, bool);
758  CONFIG_INIT_TYPE(cs, enum);
759  CONFIG_INIT_TYPE(cs, long);
760  CONFIG_INIT_TYPE(cs, mbtable);
761  CONFIG_INIT_TYPE(cs, number);
762  CONFIG_INIT_TYPE(cs, path);
763  CONFIG_INIT_TYPE(cs, quad);
764  CONFIG_INIT_TYPE(cs, regex);
765  CONFIG_INIT_TYPE(cs, slist);
766  CONFIG_INIT_TYPE(cs, sort);
767  CONFIG_INIT_TYPE(cs, string);
768 }
+ 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 774 of file mutt_config.c.

775 {
776  // Define the config variables
777  config_init_main(cs);
778  CONFIG_INIT_VARS(cs, alias);
779 #ifdef USE_AUTOCRYPT
780  CONFIG_INIT_VARS(cs, autocrypt);
781 #endif
782  CONFIG_INIT_VARS(cs, compose);
783  CONFIG_INIT_VARS(cs, conn);
784 #ifdef USE_HCACHE
785  CONFIG_INIT_VARS(cs, hcache);
786 #endif
787  CONFIG_INIT_VARS(cs, helpbar);
788  CONFIG_INIT_VARS(cs, history);
789  CONFIG_INIT_VARS(cs, index);
790 #ifdef USE_IMAP
791  CONFIG_INIT_VARS(cs, imap);
792 #endif
793  CONFIG_INIT_VARS(cs, maildir);
794  CONFIG_INIT_VARS(cs, mbox);
795  CONFIG_INIT_VARS(cs, ncrypt);
796 #ifdef USE_NNTP
797  CONFIG_INIT_VARS(cs, nntp);
798 #endif
799 #ifdef USE_NOTMUCH
800  CONFIG_INIT_VARS(cs, notmuch);
801 #endif
802  CONFIG_INIT_VARS(cs, pager);
803  CONFIG_INIT_VARS(cs, pattern);
804 #ifdef USE_POP
805  CONFIG_INIT_VARS(cs, pop);
806 #endif
807  CONFIG_INIT_VARS(cs, send);
808 #ifdef USE_SIDEBAR
809  CONFIG_INIT_VARS(cs, sidebar);
810 #endif
811 }
+ 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 818 of file mutt_config.c.

819 {
820  struct ConfigSet *cs = cs_new(size);
821 
822  init_types(cs);
823  init_variables(cs);
824 
825  return cs;
826 }
+ 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 76 of file mutt_config.c.

◆ C_IgnoreLinearWhiteSpace

bool C_IgnoreLinearWhiteSpace = false

Definition at line 77 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 methods for '$sort_aux' for the index.

Definition at line 82 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 methods for '$sort' for the index.

Definition at line 104 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 methods for the folder/dir browser.

Definition at line 126 of file mutt_config.c.

◆ MainVars

struct ConfigDef MainVars[]

Definition at line 191 of file mutt_config.c.

SORT_SPAM
@ SORT_SPAM
Sort by the email's spam score.
Definition: sort2.h:59
SORT_TO
@ SORT_TO
Sort by the email's To field.
Definition: sort2.h:53
_
#define _(a)
Definition: message.h:28
SORT_THREADS
@ SORT_THREADS
Sort by email threads.
Definition: sort2.h:51
config_init_main
static bool config_init_main(struct ConfigSet *cs)
Register main config variables - Implements module_init_config_t.
Definition: mutt_config.c:743
CSR_SUCCESS
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
SORT_COUNT
@ SORT_COUNT
Sort by number of emails in a folder.
Definition: sort2.h:60
cs_register_variables
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[], uint32_t flags)
Register a set of config items.
Definition: set.c:286
mutt_str_equal
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:871
ConfigDef::name
const char * name
User-visible name.
Definition: set.h:63
cs_new
struct ConfigSet * cs_new(size_t size)
Create a new Config Set.
Definition: set.c:166
send
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
SORT_SUBJECT
@ SORT_SUBJECT
Sort by the email's subject.
Definition: sort2.h:48
OptAttachMsg
WHERE bool OptAttachMsg
(pseudo) used by attach-message
Definition: options.h:31
SORT_SCORE
@ SORT_SCORE
Sort by the email's score.
Definition: sort2.h:54
CONFIG_INIT_VARS
#define CONFIG_INIT_VARS(CS, NAME)
Definition: mutt_config.c:71
CurrentMenu
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: mutt_globals.h:77
init_variables
static void init_variables(struct ConfigSet *cs)
Define the config variables.
Definition: mutt_config.c:774
SORT_UNREAD
@ SORT_UNREAD
Sort by the number of unread emails.
Definition: sort2.h:61
SORT_ORDER
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:50
init_types
static void init_types(struct ConfigSet *cs)
Create the config types.
Definition: mutt_config.c:754
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: mutt_config.c:161
CONFIG_INIT_TYPE
#define CONFIG_INIT_TYPE(CS, NAME)
Definition: mutt_config.c:67
SORT_RECEIVED
@ SORT_RECEIVED
Sort by when the message were delivered locally.
Definition: sort2.h:52
SORT_FROM
@ SORT_FROM
Sort by the email's From field.
Definition: sort2.h:49
ConfigSetType
Type definition for a config item.
Definition: set.h:88
ConfigSet
Container for lots of config items.
Definition: set.h:228
CSR_ERR_INVALID
#define CSR_ERR_INVALID
Value hasn't been set.
Definition: set.h:38
SORT_LABEL
@ SORT_LABEL
Sort by the emails label.
Definition: sort2.h:64
SORT_SIZE
@ SORT_SIZE
Sort by the size of the email.
Definition: sort2.h:46
mutt_buffer_printf
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
SORT_DATE
@ SORT_DATE
Sort by the date the email was sent.
Definition: sort2.h:45
MENU_PAGER
@ MENU_PAGER
Pager pager (email viewer)
Definition: keymap.h:81
MainVars
struct ConfigDef MainVars[]
Definition: mutt_config.c:191
SORT_DESC
@ SORT_DESC
Sort by the folder's description.
Definition: sort2.h:65