NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c
Go to the documentation of this file.
1
22
28
29#include "config.h"
30#include <stdbool.h>
31#include <stddef.h>
32#include "mutt/lib.h"
33#include "core/lib.h"
34#include "module_data.h"
35#include "set.h"
36
37extern const struct ConfigSetType CstBool;
38extern const struct ConfigSetType CstEnum;
39extern const struct ConfigSetType CstLong;
40extern const struct ConfigSetType CstMbtable;
41extern const struct ConfigSetType CstMyVar;
42extern const struct ConfigSetType CstNumber;
43extern const struct ConfigSetType CstPath;
44extern const struct ConfigSetType CstQuad;
45extern const struct ConfigSetType CstRegex;
46extern const struct ConfigSetType CstSlist;
47extern const struct ConfigSetType CstSort;
48extern const struct ConfigSetType CstString;
49
53static bool config_init(struct NeoMutt *n)
54{
55 struct ConfigModuleData *mod_data = MUTT_MEM_CALLOC(1, struct ConfigModuleData);
57
58 mod_data->notify = notify_new();
59 notify_set_parent(mod_data->notify, n->notify);
60
61 return true;
62}
63
67static bool config_config_define_types(struct NeoMutt *n, struct ConfigSet *cs)
68{
69 bool rc = true;
70
71 rc &= cs_register_type(cs, &CstBool);
72 rc &= cs_register_type(cs, &CstEnum);
73 rc &= cs_register_type(cs, &CstLong);
74 rc &= cs_register_type(cs, &CstMbtable);
75 rc &= cs_register_type(cs, &CstMyVar);
76 rc &= cs_register_type(cs, &CstNumber);
77 rc &= cs_register_type(cs, &CstPath);
78 rc &= cs_register_type(cs, &CstQuad);
79 rc &= cs_register_type(cs, &CstRegex);
80 rc &= cs_register_type(cs, &CstSlist);
81 rc &= cs_register_type(cs, &CstSort);
82 rc &= cs_register_type(cs, &CstString);
83
84 return rc;
85}
86
90static bool config_cleanup(struct NeoMutt *n, void *data)
91{
92 struct ConfigModuleData *mod_data = data;
93
94 notify_free(&mod_data->notify);
95
96 FREE(&mod_data);
97 return true;
98}
99
103const struct Module ModuleConfig = {
105 "config",
108 NULL, // config_define_variables
109 NULL, // commands_register
110 NULL, // gui_init
111 NULL, // gui_cleanup
113};
const struct ConfigSetType CstBool
Config type representing an boolean.
Definition bool.c:241
const struct ConfigSetType CstPath
Config type representing a path.
Definition path.c:273
static bool config_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:90
const struct ConfigSetType CstString
Config type representing a string.
Definition string.c:282
const struct Module ModuleConfig
Module for the Config library.
Definition module.c:103
const struct ConfigSetType CstNumber
Config type representing a number.
Definition number.c:327
const struct ConfigSetType CstMyVar
Config type representing a MyVar.
Definition myvar.c:203
const struct ConfigSetType CstSlist
Config type representing a list of strings.
Definition slist.c:334
static bool config_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:53
const struct ConfigSetType CstQuad
Config type representing a quad-option.
Definition quad.c:259
static bool config_config_define_types(struct NeoMutt *n, struct ConfigSet *cs)
Set up Config Types - Implements Module::config_define_types()
Definition module.c:67
const struct ConfigSetType CstRegex
Config type representing a regular expression.
Definition regex.c:348
const struct ConfigSetType CstSort
Config type representing a sort option.
Definition sort.c:260
Config private Module data.
bool cs_register_type(struct ConfigSet *cs, const struct ConfigSetType *cst)
Register a type of config item.
Definition set.c:220
A collection of config items.
Convenience wrapper for the core headers.
const struct ConfigSetType CstEnum
Config type representing an enumeration.
Definition enum.c:202
const struct ConfigSetType CstLong
Config type representing a long.
Definition long.c:258
const struct ConfigSetType CstMbtable
Config type representing a multi-byte table.
Definition mbtable.c:354
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_CONFIG
ModuleConfig, Config
Definition module_api.h:59
Convenience wrapper for the library headers.
struct Notify * notify_new(void)
Create a new notifications handler.
Definition notify.c:62
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
Config private Module data.
Definition module_data.h:30
struct Notify * notify
Notifications.
Definition module_data.h:31
Container for lots of config items.
Definition set.h:251
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45