NeoMutt  2025-12-11-435-g4ac674
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 "module_data.h"
36#include "tags.h"
37
38extern struct ConfigDef EmailVars[];
39
40extern const struct Command EmailCommands[];
41
45static bool email_init(struct NeoMutt *n)
46{
47 struct EmailModuleData *md = MUTT_MEM_CALLOC(1, struct EmailModuleData);
49
50 md->auto_subscribe_cache = NULL;
51
55 STAILQ_INIT(&md->ignore);
56 STAILQ_INIT(&md->mail);
58 STAILQ_INIT(&md->no_spam);
59 STAILQ_INIT(&md->spam);
62 STAILQ_INIT(&md->unmail);
64
65 /* RFC2368, "4. Unsafe headers"
66 * The creator of a mailto URL can't expect the resolver of a URL to
67 * understand more than the "subject" and "body" headers. Clients that
68 * resolve mailto URLs into mail messages should be able to correctly create
69 * RFC822-compliant mail messages using the "subject" and "body" headers. */
70 add_to_stailq(&md->mail_to_allow, "body");
71 add_to_stailq(&md->mail_to_allow, "subject");
72 // Cc, In-Reply-To, and References help with not breaking threading on mailing lists
73 add_to_stailq(&md->mail_to_allow, "cc");
74 add_to_stailq(&md->mail_to_allow, "in-reply-to");
75 add_to_stailq(&md->mail_to_allow, "references");
76
78
79 return true;
80}
81
85static bool email_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
86{
88}
89
93static bool email_commands_register(struct NeoMutt *n, struct CommandArray *ca)
94{
96}
97
101static bool email_cleanup(struct NeoMutt *n)
102{
104 ASSERT(md);
105
107
114
120
122
124
125 FREE(&md);
126 return true;
127}
128
132const struct Module ModuleEmail = {
134 "email",
136 NULL, // config_define_types
139 NULL, // gui_init
140 NULL, // gui_cleanup
142};
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
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
Convenience wrapper for the core headers.
const struct Command EmailCommands[]
Email Commands.
Definition commands.c:222
struct ConfigDef EmailVars[]
Config definitions for the Email library.
Definition config.c:56
static bool email_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:93
static bool email_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:45
static bool email_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:85
const struct Module ModuleEmail
Module for the Email library.
Definition module.c:132
static bool email_cleanup(struct NeoMutt *n)
Clean up a Module - Implements Module::cleanup()
Definition module.c:101
Email private Module data.
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
Definition hash.c:459
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition list.c:316
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition list.c:123
#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_EMAIL
ModuleEmail, Email code
Definition module_api.h:64
Convenience wrapper for the library headers.
void mutt_regexlist_free(struct RegexList *rl)
Free a RegexList object.
Definition regex.c:179
void mutt_replacelist_free(struct ReplaceList *rl)
Free a ReplaceList object.
Definition regex.c:450
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:599
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:585
#define STAILQ_INIT(head)
Definition queue.h:410
#define ASSERT(COND)
Definition signal2.h:59
Container for lots of config items.
Definition set.h:250
Email private Module data.
Definition module_data.h:32
struct RegexList unsubscribed
Regexes to exclude false matches in subscribed.
Definition module_data.h:47
struct RegexList subscribed
Regexes to match subscribed mailing lists.
Definition module_data.h:42
struct ListHead unignore
Header patterns to unignore.
Definition module_data.h:45
struct ListHead ignore
Header patterns to ignore.
Definition module_data.h:37
struct ReplaceList spam
Regexes and patterns to match spam emails.
Definition module_data.h:41
struct RegexList unmail
Regexes to exclude false matches in mail.
Definition module_data.h:46
struct ListHead auto_view
List of mime types to auto view.
Definition module_data.h:35
struct ListHead mail_to_allow
Permitted fields in a mailto: url.
Definition module_data.h:39
struct RegexList no_spam
Regexes to identify non-spam emails.
Definition module_data.h:40
struct ListHead alternative_order
List of preferred mime types to display.
Definition module_data.h:33
struct ListHead header_order
List of header fields in the order they should be displayed.
Definition module_data.h:36
struct HashTable * auto_subscribe_cache
Hash Table: "mailto:" (no value)
Definition module_data.h:34
struct RegexList mail
Regexes to match mailing lists.
Definition module_data.h:38
Container for Accounts, Notifications.
Definition neomutt.h:41
void driver_tags_init(struct EmailModuleData *md)
Initialize structures used for tags.
Definition tags.c:235
void driver_tags_cleanup(struct EmailModuleData *md)
Deinitialize structures used for tags.
Definition tags.c:248
Driver based email tags.