#include <stdint.h>
Go to the source code of this file.
|
struct ConfigSubset * | cs_subset_new (const char *name, struct ConfigSubset *sub_parent, struct Notify *not_parent) |
| Create a new Config Subset. More...
|
|
void | cs_subset_free (struct ConfigSubset **ptr) |
| Free a Config Subset. More...
|
|
struct HashElem * | cs_subset_create_inheritance (const struct ConfigSubset *sub, const char *name) |
| Create a Subset config item (inherited) More...
|
|
struct HashElem * | cs_subset_lookup (const struct ConfigSubset *sub, const char *name) |
| Find an inherited config item. More...
|
|
void | cs_subset_notify_observers (const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev) |
| Notify all observers of an event. More...
|
|
intptr_t | cs_subset_he_native_get (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err) |
| Natively get the value of a HashElem config item. More...
|
|
int | cs_subset_he_native_set (const struct ConfigSubset *sub, struct HashElem *he, intptr_t value, struct Buffer *err) |
| Natively set the value of a HashElem config item. More...
|
|
int | cs_subset_he_reset (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err) |
| Reset a config item to its initial value. More...
|
|
int | cs_subset_he_string_get (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result) |
| Get a config item as a string. More...
|
|
int | cs_subset_he_string_minus_equals (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err) |
| Remove from a config item by string. More...
|
|
int | cs_subset_he_string_plus_equals (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err) |
| Add to a config item by string. More...
|
|
int | cs_subset_he_string_set (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err) |
| Set a config item by string. More...
|
|
intptr_t | cs_subset_str_native_get (const struct ConfigSubset *sub, const char *name, struct Buffer *err) |
| Natively get the value of a string config item. More...
|
|
int | cs_subset_str_native_set (const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err) |
| Natively set the value of a string config item. More...
|
|
int | cs_subset_str_reset (const struct ConfigSubset *sub, const char *name, struct Buffer *err) |
| Reset a config item to its initial value. More...
|
|
int | cs_subset_str_string_get (const struct ConfigSubset *sub, const char *name, struct Buffer *result) |
| Get a config item as a string. More...
|
|
int | cs_subset_str_string_minus_equals (const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err) |
| Remove from a config item by string. More...
|
|
int | cs_subset_str_string_plus_equals (const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err) |
| Add to a config item by string. More...
|
|
int | cs_subset_str_string_set (const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err) |
| Set a config item by string. More...
|
|
int | elem_list_sort (const void *a, const void *b) |
| Sort two HashElem pointers to config. More...
|
|
struct HashElem ** | get_elem_list (struct ConfigSet *cs) |
| Create a sorted list of all config items. More...
|
|
Subset of Config Items
- Authors
-
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
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 subset.h.
◆ ConfigScope
Who does this Config belong to?
Enumerator |
---|
SET_SCOPE_NEOMUTT | This Config is NeoMutt-specific (global)
|
SET_SCOPE_ACCOUNT | This Config is Account-specific.
|
SET_SCOPE_MAILBOX | This Config is Mailbox-specific.
|
Definition at line 36 of file subset.h.
◆ NotifyConfig
Config notification types.
Observers of NT_CONFIG will be passed an EventConfig.
Enumerator |
---|
NT_CONFIG_SET | Config item has been set.
|
NT_CONFIG_RESET | Config item has been reset to initial, or parent, value.
|
NT_CONFIG_INITIAL_SET | Config item's initial value has been set.
|
Definition at line 60 of file subset.h.
◆ cs_subset_new()
Create a new Config Subset.
- Parameters
-
name | Name for this Subset |
sub_parent | Parent Subset |
not_parent | Parent Notification |
- Return values
-
- Note
- The name will be combined with the parents' names
Definition at line 133 of file subset.c.
141 sub->
cs = sub_parent->
cs;
148 if (sub_parent && sub_parent->
name)
◆ cs_subset_free()
Free a Config Subset.
- Parameters
-
- Note
- Config items matching this Subset will be freed
Definition at line 93 of file subset.c.
108 for (
size_t i = 0; list[i]; i++)
◆ cs_subset_create_inheritance()
struct HashElem* cs_subset_create_inheritance |
( |
const struct ConfigSubset * |
sub, |
|
|
const char * |
name |
|
) |
| |
Create a Subset config item (inherited)
- Parameters
-
sub | Config Subset |
name | Name of config item |
- Return values
-
ptr | HashElem of the config item |
NULL | Error |
Definition at line 189 of file subset.c.
208 snprintf(scope,
sizeof(scope),
"%s:%s", sub->
name, name);
◆ cs_subset_lookup()
Find an inherited config item.
- Parameters
-
sub | Subset to search |
name | Name of Config item to find |
- Return values
-
Definition at line 168 of file subset.c.
175 snprintf(scope,
sizeof(scope),
"%s:%s", sub->
name, name);
◆ cs_subset_notify_observers()
Notify all observers of an event.
- Parameters
-
sub | Config Subset |
he | HashElem representing config item |
ev | Type of event |
Definition at line 218 of file subset.c.
◆ cs_subset_he_native_get()
Natively get the value of a HashElem config item.
- Parameters
-
sub | Config Subset |
he | HashElem representing config item |
err | Buffer for error messages |
- Return values
-
intptr_t | Native pointer/value |
INT_MIN | Error |
Definition at line 237 of file subset.c.
◆ cs_subset_he_native_set()
Natively set the value of a HashElem config item.
- Parameters
-
sub | Config Subset |
he | HashElem representing config item |
value | Native pointer/value to set |
err | Buffer for error messages |
- Return values
-
Definition at line 270 of file subset.c.
◆ cs_subset_he_reset()
Reset a config item to its initial value.
- Parameters
-
sub | Config Subset |
he | HashElem representing config item |
err | Buffer for error messages |
- Return values
-
Definition at line 307 of file subset.c.
◆ cs_subset_he_string_get()
Get a config item as a string.
- Parameters
-
sub | Config Subset |
he | HashElem representing config item |
result | Buffer for results or error messages |
- Return values
-
Definition at line 341 of file subset.c.
◆ cs_subset_he_string_minus_equals()
int cs_subset_he_string_minus_equals |
( |
const struct ConfigSubset * |
sub, |
|
|
struct HashElem * |
he, |
|
|
const char * |
value, |
|
|
struct Buffer * |
err |
|
) |
| |
Remove from a config item by string.
- Parameters
-
sub | Config Subset |
he | HashElem representing config item |
value | Value to set |
err | Buffer for error messages |
- Return values
-
Definition at line 449 of file subset.c.
◆ cs_subset_he_string_plus_equals()
int cs_subset_he_string_plus_equals |
( |
const struct ConfigSubset * |
sub, |
|
|
struct HashElem * |
he, |
|
|
const char * |
value, |
|
|
struct Buffer * |
err |
|
) |
| |
Add to a config item by string.
- Parameters
-
sub | Config Subset |
he | HashElem representing config item |
value | Value to set |
err | Buffer for error messages |
- Return values
-
Definition at line 411 of file subset.c.
◆ cs_subset_he_string_set()
Set a config item by string.
- Parameters
-
sub | Config Subset |
he | HashElem representing config item |
value | Value to set |
err | Buffer for error messages |
- Return values
-
Definition at line 373 of file subset.c.
◆ cs_subset_str_native_get()
intptr_t cs_subset_str_native_get |
( |
const struct ConfigSubset * |
sub, |
|
|
const char * |
name, |
|
|
struct Buffer * |
err |
|
) |
| |
Natively get the value of a string config item.
- Parameters
-
sub | Config Subset |
name | Name of config item |
err | Buffer for error messages |
- Return values
-
intptr_t | Native pointer/value |
INT_MIN | Error |
Definition at line 254 of file subset.c.
◆ cs_subset_str_native_set()
int cs_subset_str_native_set |
( |
const struct ConfigSubset * |
sub, |
|
|
const char * |
name, |
|
|
intptr_t |
value, |
|
|
struct Buffer * |
err |
|
) |
| |
Natively set the value of a string config item.
- Parameters
-
sub | Config Subset |
name | Name of config item |
value | Native pointer/value to set |
err | Buffer for error messages |
- Return values
-
Definition at line 292 of file subset.c.
◆ cs_subset_str_reset()
int cs_subset_str_reset |
( |
const struct ConfigSubset * |
sub, |
|
|
const char * |
name, |
|
|
struct Buffer * |
err |
|
) |
| |
Reset a config item to its initial value.
- Parameters
-
sub | Config Subset |
name | Name of config item |
err | Buffer for error messages |
- Return values
-
Definition at line 327 of file subset.c.
◆ cs_subset_str_string_get()
int cs_subset_str_string_get |
( |
const struct ConfigSubset * |
sub, |
|
|
const char * |
name, |
|
|
struct Buffer * |
result |
|
) |
| |
Get a config item as a string.
- Parameters
-
sub | Config Subset |
name | Name of config item |
result | Buffer for results or error messages |
- Return values
-
Definition at line 357 of file subset.c.
◆ cs_subset_str_string_minus_equals()
int cs_subset_str_string_minus_equals |
( |
const struct ConfigSubset * |
sub, |
|
|
const char * |
name, |
|
|
const char * |
value, |
|
|
struct Buffer * |
err |
|
) |
| |
Remove from a config item by string.
- Parameters
-
sub | Config Subset |
name | Name of config item |
value | Value to set |
err | Buffer for error messages |
- Return values
-
Definition at line 471 of file subset.c.
◆ cs_subset_str_string_plus_equals()
int cs_subset_str_string_plus_equals |
( |
const struct ConfigSubset * |
sub, |
|
|
const char * |
name, |
|
|
const char * |
value, |
|
|
struct Buffer * |
err |
|
) |
| |
Add to a config item by string.
- Parameters
-
sub | Config Subset |
name | Name of config item |
value | Value to set |
err | Buffer for error messages |
- Return values
-
Definition at line 433 of file subset.c.
◆ cs_subset_str_string_set()
int cs_subset_str_string_set |
( |
const struct ConfigSubset * |
sub, |
|
|
const char * |
name, |
|
|
const char * |
value, |
|
|
struct Buffer * |
err |
|
) |
| |
Set a config item by string.
- Parameters
-
sub | Config Subset |
name | Name of config item |
value | Value to set |
err | Buffer for error messages |
- Return values
-
Definition at line 395 of file subset.c.
◆ elem_list_sort()
int elem_list_sort |
( |
const void * |
a, |
|
|
const void * |
b |
|
) |
| |
Sort two HashElem pointers to config.
- Parameters
-
- Return values
-
-1 | a precedes b |
0 | a and b are identical |
1 | b precedes a |
Definition at line 48 of file subset.c.
◆ get_elem_list()
Create a sorted list of all config items.
- Parameters
-
- Return values
-
Definition at line 64 of file subset.c.
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
@ SET_SCOPE_MAILBOX
This Config is Mailbox-specific.
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
union HashKey key
Key representing the data.
struct HashElem * cs_inherit_variable(const struct ConfigSet *cs, struct HashElem *parent, const char *name)
Create in inherited config item.
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
#define CSR_SUCCESS
Action completed successfully.
int cs_subset_he_native_set(const struct ConfigSubset *sub, struct HashElem *he, intptr_t value, struct Buffer *err)
Natively set the value of a HashElem config item.
int cs_he_string_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
void cs_subset_notify_observers(const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev)
Notify all observers of an event.
struct HashTable * hash
HashTable storing the config items.
char * mutt_str_dup(const char *str)
Copy a string, safely.
struct ConfigSubset * parent
Parent Subset.
intptr_t cs_he_native_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
int cs_subset_he_string_plus_equals(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Add to a config item by string.
int cs_subset_he_reset(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Reset a config item to its initial value.
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
int cs_subset_he_string_minus_equals(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Remove from a config item by string.
struct HashElem ** get_elem_list(struct ConfigSet *cs)
Create a sorted list of all config items.
struct Notify * notify_new(void)
Create a new notifications handler.
@ NT_CONFIG_SET
Config item has been set.
int cs_he_reset(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *err)
Reset a config item to its initial value.
const char * strkey
String key.
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
const char * name
Scope name of Subset.
int cs_subset_he_string_set(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Set a config item by string.
struct ConfigSet * cs
Parent ConfigSet.
struct HashElem * he
Config item that changed.
@ SET_SCOPE_ACCOUNT
This Config is Account-specific.
struct HashElem * mutt_hash_walk(const struct HashTable *table, struct HashWalkState *state)
Iterate through all the HashElem's in a Hash Table.
int cs_he_string_plus_equals(const struct ConfigSet *cs, struct HashElem *he, const char *value, struct Buffer *err)
Add to a config item by string.
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
int cs_he_string_set(const struct ConfigSet *cs, struct HashElem *he, const char *value, struct Buffer *err)
Set a config item by string.
Cursor to iterate through a Hash Table.
#define CSR_ERR_CODE
Problem with the code.
The item stored in a Hash Table.
@ SET_SCOPE_NEOMUTT
This Config is NeoMutt-specific (global)
int cs_he_string_minus_equals(const struct ConfigSet *cs, struct HashElem *he, const char *value, struct Buffer *err)
Remove from a config item by string.
struct Notify * notify
Notifications system.
const struct ConfigSubset * sub
Config Subset.
int cs_subset_he_string_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
void notify_free(struct Notify **ptr)
Free a notification handler.
enum ConfigScope scope
Scope of Subset, e.g. SET_SCOPE_ACCOUNT.
@ NT_CONFIG_RESET
Config item has been reset to initial, or parent, value.
int elem_list_sort(const void *a, const void *b)
Sort two HashElem pointers to config.
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
struct HashElem * cs_get_elem(const struct ConfigSet *cs, const char *name)
Get the HashElem representing a config item.
A set of inherited config items.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
void cs_uninherit_variable(const struct ConfigSet *cs, const char *name)
Remove an inherited config item.
int cs_he_native_set(const struct ConfigSet *cs, struct HashElem *he, intptr_t value, struct Buffer *err)
Natively set the value of a HashElem config item.
@ NT_CONFIG_INITIAL_SET
Config item's initial value has been set.
intptr_t cs_subset_he_native_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)