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

Definition of the Attach Module. More...

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

Go to the source code of this file.

Functions

static bool attach_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool attach_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool attach_commands_register (struct NeoMutt *n, struct CommandArray *ca)
 Register NeoMutt Commands - Implements Module::commands_register()
 
static bool attach_cleanup (struct NeoMutt *n)
 Clean up a Module - Implements Module::cleanup()
 

Variables

struct ConfigDef AttachVars []
 Config definitions for the Attach library.
 
const struct Command AttachCommands []
 Attach Commands.
 
const struct Module ModuleAttach
 Module for the Attach library.
 

Detailed Description

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

◆ attach_init()

static bool attach_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 46 of file module.c.

47{
50
55
58
61
62 return true;
63}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_ATTACH
ModuleAttach, Attachments
Definition module_api.h:49
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:599
#define STAILQ_INIT(head)
Definition queue.h:410
Attach private Module data.
Definition module_data.h:32
struct ListHead attach_allow
List of attachment types to be counted.
Definition module_data.h:33
struct ListHead attach_exclude
List of attachment types to be ignored.
Definition module_data.h:34
struct ListHead temp_attachments
List of temporary files for displaying attachments.
Definition module_data.h:40
struct ListHead inline_allow
List of inline types to counted.
Definition module_data.h:35
struct ListHead inline_exclude
List of inline types to ignore.
Definition module_data.h:36
struct ListHead mime_lookup
List of mime types that that shouldn't use the mailcap entry.
Definition module_data.h:39
struct Notify * attachments_notify
Notifications: NotifyAttach.
Definition module_data.h:37
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ attach_config_define_variables()

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

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

Definition at line 68 of file module.c.

69{
71}
struct ConfigDef AttachVars[]
Config definitions for the Attach library.
Definition config.c:40
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:

◆ attach_commands_register()

static bool attach_commands_register ( struct NeoMutt * n,
struct CommandArray * ca )
static

Register NeoMutt Commands - Implements Module::commands_register()

Definition at line 76 of file module.c.

77{
79}
const struct Command AttachCommands[]
Attach Commands.
Definition commands.c:680
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
+ Here is the call graph for this function:

◆ attach_cleanup()

static bool attach_cleanup ( struct NeoMutt * n)
static

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

Definition at line 84 of file module.c.

85{
87 ASSERT(md);
88
90
91 /* Lists of AttachMatch */
96
98
100
101 FREE(&md);
102 return true;
103}
void attachmatch_free(struct AttachMatch **ptr)
Free an AttachMatch - Implements list_free_t -.
Definition commands.c:63
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition list.c:123
void mutt_list_free_type(struct ListHead *h, list_free_t fn)
Free a List of type.
Definition list.c:144
void(* list_free_t)(void **ptr)
Definition list.h:50
#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
void mutt_temp_attachments_cleanup(void)
Delete all temporary attachments.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:585
#define ASSERT(COND)
Definition signal2.h:59
+ Here is the call graph for this function:

Variable Documentation

◆ AttachVars

struct ConfigDef AttachVars[]
extern

Config definitions for the Attach library.

Definition at line 40 of file config.c.

40 {
41 // clang-format off
42 { "attach_save_dir", DT_PATH|D_PATH_DIR, IP "./", 0, NULL,
43 "Default directory where attachments are saved"
44 },
45 { "attach_save_without_prompting", DT_BOOL, false, 0, NULL,
46 "If true, then don't prompt to save"
47 },
48 { "attach_sep", DT_STRING, IP "\n", 0, NULL,
49 "Separator to add between saved/printed/piped attachments"
50 },
51 { "attach_split", DT_BOOL, true, 0, NULL,
52 "Save/print/pipe tagged messages individually"
53 },
54 { "bounce", DT_QUAD, MUTT_ASKYES, 0, NULL,
55 "Confirm before bouncing a message"
56 },
57 { "count_alternatives", DT_BOOL, false, 0, NULL,
58 "Recurse inside multipart/alternatives while counting attachments"
59 },
60 { "digest_collapse", DT_BOOL, true, 0, NULL,
61 "Hide the subparts of a multipart/digest"
62 },
63 { "message_format", DT_EXPANDO|D_NOT_EMPTY, IP "%s", IP &IndexFormatDef, NULL,
64 "printf-like format string for listing attached messages"
65 },
66 { "mime_forward", DT_QUAD, MUTT_NO, 0, NULL,
67 "Forward a message as a 'message/RFC822' MIME part"
68 },
69 { "mime_forward_rest", DT_QUAD, MUTT_YES, 0, NULL,
70 "Forward all attachments, even if they can't be decoded"
71 },
72
73 { "mime_fwd", DT_SYNONYM, IP "mime_forward", IP "2021-03-21" },
74 { "msg_format", DT_SYNONYM, IP "message_format", IP "2021-03-21" },
75
76 { NULL },
77 // clang-format on
78};
const struct ExpandoDefinition IndexFormatDef[]
Expando definitions.
#define IP
Definition set.h:54
@ MUTT_NO
User answered 'No', or assume 'No'.
Definition quad.h:38
@ MUTT_ASKYES
Ask the user, defaulting to 'Yes'.
Definition quad.h:41
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition quad.h:39
#define D_PATH_DIR
Path is a directory.
Definition types.h:103
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition types.h:40
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44
@ DT_EXPANDO
an expando
Definition types.h:34
@ DT_PATH
a path to a file/directory
Definition types.h:39
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:80

◆ AttachCommands

const struct Command AttachCommands[]
extern

Attach Commands.

Definition at line 680 of file commands.c.

680 {
681 // clang-format off
682 { "attachments", CMD_ATTACHMENTS, parse_attachments,
683 N_("Set attachment counting rules"),
684 N_("attachments { + | - }<disposition> <mime-type> [ <mime-type> ... ] | ?"),
685 "mimesupport.html#attachments" },
686 { "mime-lookup", CMD_MIME_LOOKUP, parse_mime_lookup,
687 N_("Map specified MIME types/subtypes to display handlers"),
688 N_("mime-lookup <mime-type>[/<mime-subtype> ] [ ... ]"),
689 "mimesupport.html#mime-lookup" },
690 { "unattachments", CMD_UNATTACHMENTS, parse_unattachments,
691 N_("Remove attachment counting rules"),
692 N_("unattachments { * | { + | - }<disposition> <mime-type> [ ... ] }"),
693 "mimesupport.html#attachments" },
694 { "unmime-lookup", CMD_UNMIME_LOOKUP, parse_unmime_lookup,
695 N_("Remove custom MIME-type handlers"),
696 N_("unmime-lookup { * | [ <mime-type>[/<mime-subtype> ] ... ] }"),
697 "mimesupport.html#mime-lookup" },
698
699 // Deprecated
700 { "mime_lookup", CMD_NONE, NULL, "mime-lookup", NULL, NULL, CF_SYNONYM },
701 { "unmime_lookup", CMD_NONE, NULL, "unmime-lookup", NULL, NULL, CF_SYNONYM },
702
703 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NO_FLAGS },
704 // clang-format on
705};
#define CF_SYNONYM
Command is a synonym for another command.
Definition command.h:49
#define CF_NO_FLAGS
No flags are set.
Definition command.h:48
@ CMD_MIME_LOOKUP
:mime-lookup
Definition command.h:95
@ CMD_ATTACHMENTS
:attachments
Definition command.h:65
@ CMD_UNMIME_LOOKUP
:unmime-lookup
Definition command.h:138
@ CMD_NONE
No Command.
Definition command.h:59
@ CMD_UNATTACHMENTS
:unattachments
Definition command.h:126
enum CommandResult parse_attachments(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'attachments' command - Implements Command::parse() -.
Definition commands.c:472
enum CommandResult parse_unmime_lookup(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unmime-lookup' command - Implements Command::parse() -.
Definition commands.c:668
enum CommandResult parse_unattachments(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unattachments' command - Implements Command::parse() -.
Definition commands.c:550
enum CommandResult parse_mime_lookup(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'mime-lookup' command - Implements Command::parse() -.
Definition commands.c:652
#define N_(a)
Definition message.h:32

◆ ModuleAttach

const struct Module ModuleAttach
Initial value:
= {
"attach",
NULL,
NULL,
NULL,
}
static bool attach_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:46
static bool attach_cleanup(struct NeoMutt *n)
Clean up a Module - Implements Module::cleanup()
Definition module.c:84
static bool attach_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:76
static bool attach_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:68

Module for the Attach library.

Definition at line 108 of file module.c.

108 {
110 "attach",
112 NULL, // config_define_types
115 NULL, // gui_init
116 NULL, // gui_cleanup
118};