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

Definition of the Autocrypt Module. More...

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

Go to the source code of this file.

Functions

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

Variables

struct ConfigDef AutocryptVars []
 Config definitions for the autocrypt library.
 
const struct Module ModuleAutocrypt
 Module for the Autocrypt library.
 

Detailed Description

Definition of the Autocrypt 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

◆ autocrypt_init()

static bool autocrypt_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 45 of file module.c.

46{
47 struct AutocryptModuleData *mod_data = MUTT_MEM_CALLOC(1, struct AutocryptModuleData);
49
50 mod_data->notify = notify_new();
51 notify_set_parent(mod_data->notify, n->notify);
52
53 return true;
54}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_AUTOCRYPT
ModuleAutocrypt, Autocrypt
Definition module_api.h:50
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
Autocrypt private Module data.
Definition module_data.h:32
struct Notify * notify
Notifications.
Definition module_data.h:33
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ autocrypt_config_define_variables()

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

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

Definition at line 59 of file module.c.

60{
61 bool rc = false;
62
63#if defined(USE_AUTOCRYPT)
65#endif
66
67 return rc;
68}
struct ConfigDef AutocryptVars[]
Config definitions for the autocrypt library.
Definition config.c:59
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
+ Here is the call graph for this function:

◆ autocrypt_cleanup()

static bool autocrypt_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 AutocryptModuleData *mod_data = data;
76
77 notify_free(&mod_data->notify);
78
79 mutt_autocrypt_cleanup(mod_data);
80
81 FREE(&mod_data->autocrypt_sign_as);
82 FREE(&mod_data->autocrypt_default_key);
83
84 FREE(&mod_data);
85 return true;
86}
void mutt_autocrypt_cleanup(struct AutocryptModuleData *mod_data)
Shutdown Autocrypt.
Definition autocrypt.c:136
#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
char * autocrypt_sign_as
Autocrypt Key id to sign as.
Definition module_data.h:36
char * autocrypt_default_key
Autocrypt default key id (used for postponing messages)
Definition module_data.h:35
+ Here is the call graph for this function:

Variable Documentation

◆ AutocryptVars

struct ConfigDef AutocryptVars[]
extern

Config definitions for the autocrypt library.

Definition at line 59 of file config.c.

59 {
60 // clang-format off
61 { "autocrypt", DT_BOOL, false, 0, NULL,
62 "Enables the Autocrypt feature"
63 },
64 { "autocrypt_acct_format", DT_EXPANDO, IP "%4n %-30a %20p %10s", IP &AutocryptFormatDef, NULL,
65 "Format of the autocrypt account menu"
66 },
67 { "autocrypt_dir", DT_PATH|D_PATH_DIR, IP "~/.mutt/autocrypt", 0, NULL,
68 "Location of autocrypt files, including the GPG keyring and SQLite database"
69 },
70 { "autocrypt_reply", DT_BOOL, true, 0, NULL,
71 "Replying to an autocrypt email automatically enables autocrypt in the reply"
72 },
73 { NULL },
74 // clang-format on
75};
static const struct ExpandoDefinition AutocryptFormatDef[]
Expando definitions.
Definition config.c:42
#define IP
Definition set.h:55
#define D_PATH_DIR
Path is a directory.
Definition types.h:103
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_EXPANDO
an expando
Definition types.h:34
@ DT_PATH
a path to a file/directory
Definition types.h:39

◆ ModuleAutocrypt

const struct Module ModuleAutocrypt
Initial value:
= {
"autocrypt",
NULL,
NULL,
NULL,
NULL,
}
static bool autocrypt_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:59
static bool autocrypt_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:45
static bool autocrypt_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:73

Module for the Autocrypt library.

Definition at line 91 of file module.c.

91 {
93 "autocrypt",
95 NULL, // config_define_types
97 NULL, // commands_register
98 NULL, // gui_init
99 NULL, // gui_cleanup
101};