43#define PREFIX_REVERSE "reverse-"
44#define PREFIX_LAST "last-"
50 const char *value,
struct Buffer *err)
55 if (!value || (value[0] ==
'\0'))
95 if (
id == (*(
short *) var))
103 int rc = cdef->
validator(cs, cdef, (intptr_t)
id, err);
128 sort = *(
short *) var;
139 const char *str = NULL;
159 const char *str = NULL;
165 buf_printf(err,
_(
"Invalid sort type: %ld"), (
long) value);
169 if (value == (*(
short *) var))
177 int rc = cdef->
validator(cs, cdef, value, err);
183 *(
short *) var = value;
193 return *(
short *) var;
202 if (cdef->
initial == (*(
short *) var))
216 *(
short *) var = cdef->
initial;
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
static bool startup_only(const struct ConfigDef *cdef, struct Buffer *err)
Validator function for D_ON_STARTUP.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSR_INV_TYPE
Value is not valid for the type.
#define CSR_INV_VALIDATOR
Value was rejected by the validator.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
#define CSR_SUCCESS
Action completed successfully.
const struct ConfigSetType CstSort
Config type representing a sort option.
static intptr_t sort_native_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get an int from a Sort config item - Implements ConfigSetType::native_get() -.
static int sort_native_set(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set a Sort config item by int - Implements ConfigSetType::native_set() -.
static int sort_reset(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset a Sort to its initial value - Implements ConfigSetType::reset() -.
static int sort_string_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a Sort as a string - Implements ConfigSetType::string_get() -.
static int sort_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set a Sort by string - Implements ConfigSetType::string_set() -.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG1
Log at debug level 1.
int mutt_map_get_value(const char *name, const struct Mapping *map)
Lookup the constant for a string.
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Convenience wrapper for the library headers.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Type representing a sort option.
#define SORT_MASK
Mask for the sort id.
#define SORT_LAST
Sort thread by last-X, e.g. received date.
#define SORT_REVERSE
Reverse the order of the sort.
String manipulation buffer.
const char * name
User-visible name.
int(* validator)(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
intptr_t data
Extra variable data.
intptr_t initial
Initial value.
uint32_t type
Variable type, e.g. DT_STRING.
Container for lots of config items.
Mapping between user-readable string and a constant.
Constants for all the config types.
#define D_SORT_LAST
Sort flag for -last prefix.
#define D_SORT_REVERSE
Sort flag for -reverse prefix.