NeoMutt  2020-08-21-74-g346364
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 142 of file mutt_config.c.

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

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

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

777 {
778  return cs_register_variables(cs, MainVars, 0);
779 }
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:190
+ 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 787 of file mutt_config.c.

788 {
789  CONFIG_INIT_TYPE(cs, address);
790  CONFIG_INIT_TYPE(cs, bool);
791  CONFIG_INIT_TYPE(cs, enum);
792  CONFIG_INIT_TYPE(cs, long);
793  CONFIG_INIT_TYPE(cs, mbtable);
794  CONFIG_INIT_TYPE(cs, number);
795  CONFIG_INIT_TYPE(cs, path);
796  CONFIG_INIT_TYPE(cs, quad);
797  CONFIG_INIT_TYPE(cs, regex);
798  CONFIG_INIT_TYPE(cs, slist);
799  CONFIG_INIT_TYPE(cs, sort);
800  CONFIG_INIT_TYPE(cs, string);
801 }
#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 807 of file mutt_config.c.

808 {
809  // Define the config variables
810  config_init_main(cs);
811  CONFIG_INIT_VARS(cs, alias);
812 #ifdef USE_AUTOCRYPT
813  CONFIG_INIT_VARS(cs, autocrypt);
814 #endif
815  CONFIG_INIT_VARS(cs, compose);
816  CONFIG_INIT_VARS(cs, conn);
817 #ifdef USE_HCACHE
818  CONFIG_INIT_VARS(cs, hcache);
819 #endif
820  CONFIG_INIT_VARS(cs, helpbar);
821  CONFIG_INIT_VARS(cs, history);
822 #ifdef USE_IMAP
823  CONFIG_INIT_VARS(cs, imap);
824 #endif
825  CONFIG_INIT_VARS(cs, maildir);
826  CONFIG_INIT_VARS(cs, mbox);
827  CONFIG_INIT_VARS(cs, ncrypt);
828 #ifdef USE_NNTP
829  CONFIG_INIT_VARS(cs, nntp);
830 #endif
831 #ifdef USE_NOTMUCH
832  CONFIG_INIT_VARS(cs, notmuch);
833 #endif
834  CONFIG_INIT_VARS(cs, pattern);
835 #ifdef USE_POP
836  CONFIG_INIT_VARS(cs, pop);
837 #endif
838  CONFIG_INIT_VARS(cs, send);
839 #ifdef USE_SIDEBAR
840  CONFIG_INIT_VARS(cs, sidebar);
841 #endif
842 }
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:776
+ 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 849 of file mutt_config.c.

850 {
851  struct ConfigSet *cs = cs_new(size);
852 
853  init_types(cs);
854  init_variables(cs);
855 
856  return cs;
857 }
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:807
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:787
+ 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-received", SORT_RECEIVED },
{ "date-sent", SORT_DATE },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "mailbox-order", SORT_ORDER },
{ "score", SORT_SCORE },
{ "size", SORT_SIZE },
{ "spam", SORT_SPAM },
{ "subject", SORT_SUBJECT },
{ "threads", SORT_DATE },
{ "to", SORT_TO },
{ NULL, 0 },
}
Sort by the email&#39;s From field.
Definition: sort2.h:50
Sort by the email&#39;s score.
Definition: sort2.h:55
Sort by the emails label.
Definition: sort2.h:65
Sort by the size of the email.
Definition: sort2.h:47
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:51
Sort by the email&#39;s spam score.
Definition: sort2.h:60
Sort by the email&#39;s To field.
Definition: sort2.h:54
Sort by when the message were delivered locally.
Definition: sort2.h:53
Sort by the date the email was sent.
Definition: sort2.h:46
Sort by the email&#39;s subject.
Definition: sort2.h:49

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-received", SORT_RECEIVED },
{ "date-sent", SORT_DATE },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "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:50
Sort by the email&#39;s score.
Definition: sort2.h:55
Sort by the emails label.
Definition: sort2.h:65
Sort by the size of the email.
Definition: sort2.h:47
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:51
Sort by email threads.
Definition: sort2.h:52
Sort by the email&#39;s spam score.
Definition: sort2.h:60
Sort by the email&#39;s To field.
Definition: sort2.h:54
Sort by when the message were delivered locally.
Definition: sort2.h:53
Sort by the date the email was sent.
Definition: sort2.h:46
Sort by the email&#39;s subject.
Definition: sort2.h:49

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 by the size of the email.
Definition: sort2.h:47
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:51
Sort by the number of unread emails.
Definition: sort2.h:62
Sort by the folder&#39;s description.
Definition: sort2.h:66
Sort by number of emails in a folder.
Definition: sort2.h:61
Sort by the date the email was sent.
Definition: sort2.h:46
Sort by the email&#39;s subject.
Definition: sort2.h:49

Sort methods for the folder/dir browser.

Definition at line 125 of file mutt_config.c.

◆ MainVars

struct ConfigDef MainVars[]

Definition at line 190 of file mutt_config.c.