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 "config/lib.h"
34#include "core/lib.h"
35#include "lib.h"
36#include "module_data.h"
37
38extern struct ConfigDef NcryptVars[];
39extern struct ConfigDef NcryptVarsGpgme[];
40extern struct ConfigDef NcryptVarsPgp[];
41extern struct ConfigDef NcryptVarsSmime[];
42
46static bool ncrypt_init(struct NeoMutt *n)
47{
48 struct NcryptModuleData *mod_data = MUTT_MEM_CALLOC(1, struct NcryptModuleData);
49 STAILQ_INIT(&mod_data->crypt_modules);
51
52 mod_data->notify = notify_new();
53 notify_set_parent(mod_data->notify, n->notify);
54
55 return true;
56}
57
61static bool ncrypt_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
62{
63 bool rc = true;
64
66
67#if defined(CRYPT_BACKEND_GPGME)
69#endif
70
71#if defined(CRYPT_BACKEND_CLASSIC_PGP)
73#endif
74
75#if defined(CRYPT_BACKEND_CLASSIC_SMIME)
77#endif
78
79 return rc;
80}
81
85static bool ncrypt_cleanup(struct NeoMutt *n, void *data)
86{
87 struct NcryptModuleData *mod_data = data;
88
89 notify_free(&mod_data->notify);
90
91 crypt_cleanup(mod_data);
92 crypto_module_cleanup(mod_data);
93
94 FREE(&mod_data->current_sender);
95 FREE(&mod_data->charset);
96 FREE(&mod_data->packet_buf);
97
98 FREE(&mod_data);
99 return true;
100}
101
105const struct Module ModuleNcrypt = {
107 "ncrypt",
109 NULL, // config_define_types
111 NULL, // commands_register
112 NULL, // gui_init
113 NULL, // gui_cleanup
115};
Convenience wrapper for the config headers.
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
Convenience wrapper for the core headers.
void crypto_module_cleanup(struct NcryptModuleData *mod_data)
Clean up the crypto modules.
Definition crypt_mod.c:74
void crypt_cleanup(struct NcryptModuleData *mod_data)
Clean up backend.
Definition cryptglue.c:151
const struct Module ModuleNcrypt
Module for the Ncrypt library.
Definition module.c:105
#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_NCRYPT
ModuleNcrypt, Ncrypt
Definition module_api.h:80
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
struct ConfigDef NcryptVarsPgp[]
PGP Config definitions for the encryption library.
Definition config.c:301
struct ConfigDef NcryptVarsSmime[]
SMIME Config definitions for the encryption library.
Definition config.c:371
struct ConfigDef NcryptVars[]
Config definitions for the encryption library.
Definition config.c:110
struct ConfigDef NcryptVarsGpgme[]
GPGME Config definitions for the encryption library.
Definition config.c:222
API for encryption/signing of emails.
static bool ncrypt_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:85
static bool ncrypt_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:46
static bool ncrypt_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:61
Ncrypt private Module data.
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
#define STAILQ_INIT(head)
Definition queue.h:410
Container for lots of config items.
Definition set.h:251
Ncrypt private Module data.
Definition module_data.h:38
unsigned char * packet_buf
Cached PGP data packet.
Definition module_data.h:53
char * charset
gnupgparse charset
Definition module_data.h:49
struct CryptModuleList crypt_modules
Linked list of crypto modules.
Definition module_data.h:48
struct Notify * notify
Notifications.
Definition module_data.h:39
char * current_sender
Current sender for GPGME.
Definition module_data.h:47
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45