NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c File Reference

Definition of the Hcache Module. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "module_data.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

static bool hcache_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool hcache_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool hcache_cleanup (struct NeoMutt *n, void *data)
 Clean up a Module - Implements Module::cleanup()
 

Variables

struct ConfigDef HcacheVars []
 Config definitions for the Header Cache.
 
struct ConfigDef HcacheVarsComp []
 Config definitions for the Header Cache Compression.
 
const struct Module ModuleHcache
 Module for the Hcache library.
 

Detailed Description

Definition of the Hcache Module.

Authors
  • Richard Russon

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 module.c.

Function Documentation

◆ hcache_init()

static bool hcache_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 43 of file module.c.

44{
45 struct HcacheModuleData *mod_data = MUTT_MEM_CALLOC(1, struct HcacheModuleData);
47
48 mod_data->notify = notify_new();
49 notify_set_parent(mod_data->notify, n->notify);
50
51 return true;
52}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_HCACHE
ModuleHcache, Email Header Cache
Definition module_api.h:67
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 neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
Hcache private Module data.
Definition module_data.h:30
struct Notify * notify
Notifications.
Definition module_data.h:31
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ hcache_config_define_variables()

static bool hcache_config_define_variables ( struct NeoMutt * n,
struct ConfigSet * cs )
static

Define the Config Variables - Implements Module::config_define_variables()

Definition at line 57 of file module.c.

58{
59 bool rc = true;
60
62
63#if defined(USE_HCACHE_COMPRESSION)
65#endif
66
67 return rc;
68}
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
struct ConfigDef HcacheVars[]
Config definitions for the Header Cache.
Definition config.c:169
struct ConfigDef HcacheVarsComp[]
Config definitions for the Header Cache Compression.
Definition config.c:185
+ Here is the call graph for this function:

◆ hcache_cleanup()

static bool hcache_cleanup ( struct NeoMutt * n,
void * data )
static

Clean up a Module - Implements Module::cleanup()

Definition at line 73 of file module.c.

74{
75 struct HcacheModuleData *mod_data = data;
76
77 notify_free(&mod_data->notify);
78
79 FREE(&mod_data);
80 return true;
81}
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
+ Here is the call graph for this function:

Variable Documentation

◆ HcacheVars

struct ConfigDef HcacheVars[]
extern

Config definitions for the Header Cache.

Definition at line 169 of file config.c.

169 {
170 // clang-format off
171 { "header_cache", DT_PATH, 0, 0, hcache_validator,
172 "(hcache) Directory/file for the header cache database"
173 },
174 { "header_cache_backend", DT_STRING, 0, 0, hcache_backend_validator,
175 "(hcache) Header cache backend to use"
176 },
177 { NULL },
178 // clang-format on
179};
static int hcache_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "header_cache" config variable - Implements ConfigDef::validator() -.
Definition config.c:44
static int hcache_backend_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "header_cache_backend" config variable - Implements ConfigDef::validator() -.
Definition config.c:62
@ DT_STRING
a string
Definition types.h:44
@ DT_PATH
a path to a file/directory
Definition types.h:39

◆ HcacheVarsComp

struct ConfigDef HcacheVarsComp[]
extern

Config definitions for the Header Cache Compression.

Definition at line 185 of file config.c.

185 {
186 // clang-format off
187 // These two are not in alphabetical order because `level`s validator depends on `method`
188 { "header_cache_compress_method", DT_STRING, 0, 0, compress_method_validator,
189 "(hcache) Enable generic hcache database compression"
190 },
191 { "header_cache_compress_level", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 1, 0, compress_level_validator,
192 "(hcache) Level of compression for method"
193 },
194 { NULL },
195 // clang-format on
196};
static int compress_method_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "header_cache_compress_method" config variable - Implements ConfigDef::validator() -.
Definition config.c:96
static int compress_level_validator(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "header_cache_compress_level" config variable - Implements ConfigDef::validator() -.
Definition config.c:133
@ DT_NUMBER
a number
Definition types.h:38
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition types.h:101

◆ ModuleHcache

const struct Module ModuleHcache
Initial value:
= {
"hcache",
NULL,
NULL,
NULL,
NULL,
}
static bool hcache_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:57
static bool hcache_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:73
static bool hcache_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:43

Module for the Hcache library.

Definition at line 86 of file module.c.

86 {
88 "hcache",
90 NULL, // config_define_types
92 NULL, // commands_register
93 NULL, // gui_init
94 NULL, // gui_cleanup
96};