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

Definition of the Index 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 "subjectrx.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

static bool index_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool index_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool index_commands_register (struct NeoMutt *n, struct CommandArray *ca)
 Register NeoMutt Commands - Implements Module::commands_register()
 
static bool index_cleanup (struct NeoMutt *n)
 Clean up a Module - Implements Module::cleanup()
 

Variables

struct ConfigDef IndexVars []
 Config definitions for the Index.
 
const struct Command IndexCommands []
 Index Commands.
 
const struct Module ModuleIndex
 Module for the Index library.
 

Detailed Description

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

◆ index_init()

static bool index_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 45 of file module.c.

46{
47 struct IndexModuleData *md = MUTT_MEM_CALLOC(1, struct IndexModuleData);
49
50 subjectrx_init(n, md);
51 return true;
52}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_INDEX
ModuleIndex, Index
Definition module_api.h:72
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:599
Index private Module data.
Definition module_data.h:32
void subjectrx_init(struct NeoMutt *n, struct IndexModuleData *md)
Create new Subject Regex List.
Definition subjectrx.c:42
+ Here is the call graph for this function:

◆ index_config_define_variables()

static bool index_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{
60}
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
struct ConfigDef IndexVars[]
Config definitions for the Index.
Definition config.c:87
+ Here is the call graph for this function:

◆ index_commands_register()

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

Register NeoMutt Commands - Implements Module::commands_register()

Definition at line 65 of file module.c.

66{
68}
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
const struct Command IndexCommands[]
Index Commands.
Definition commands.c:38
+ Here is the call graph for this function:

◆ index_cleanup()

static bool index_cleanup ( struct NeoMutt * n)
static

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

Definition at line 73 of file module.c.

74{
76 ASSERT(md);
77
79
80 FREE(&md);
81 return true;
82}
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
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
void subjectrx_cleanup(struct IndexModuleData *md)
Free the Subject Regex List.
Definition subjectrx.c:53
+ Here is the call graph for this function:

Variable Documentation

◆ IndexVars

struct ConfigDef IndexVars[]
extern

Config definitions for the Index.

Definition at line 87 of file config.c.

87 {
88 // clang-format off
89 { "beep_new", DT_BOOL, false, 0, NULL,
90 "Make a noise when new mail arrives"
91 },
92 { "change_folder_next", DT_BOOL, false, 0, NULL,
93 "Suggest the next folder, rather than the first when using '<change-folder>'"
94 },
95 { "collapse_all", DT_BOOL, false, 0, NULL,
96 "Collapse all threads when entering a folder"
97 },
98 { "crypt_chars", DT_MBTABLE, IP "SPsK ", 0, NULL,
99 "User-configurable crypto flags: signed, encrypted etc."
100 },
101 { "flag_chars", DT_MBTABLE, IP "*!DdrONon- ", 0, NULL,
102 "User-configurable index flags: tagged, new, etc"
103 },
104 { "from_chars", DT_MBTABLE, 0, 0, NULL,
105 "User-configurable index flags: to address, cc address, etc"
106 },
107 { "index_format", DT_EXPANDO|D_NOT_EMPTY, IP "%4C %Z %{%b %d} %-15.15L (%<l?%4l&%4c>) %s", IP &IndexFormatDef, NULL,
108 "printf-like format string for the index menu (emails)"
109 },
110 { "mark_macro_prefix", DT_STRING, IP "'", 0, NULL,
111 "Prefix for macros using '<mark-message>'"
112 },
113 { "new_mail_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP StatusFormatDefNoPadding, NULL,
114 "External command to run when new mail arrives"
115 },
116 { "quit", DT_QUAD, MUTT_YES, 0, NULL,
117 "Prompt before exiting NeoMutt"
118 },
119 { "read_only", DT_BOOL, false, 0, NULL,
120 "Open folders in read-only mode"
121 },
122 // L10N: $status_format default format
123 { "status_format", DT_EXPANDO|D_L10N_STRING, IP N_("-%r-NeoMutt: %D [Msgs:%<M?%M/>%m%<n? New:%n>%<o? Old:%o>%<d? Del:%d>%<F? Flag:%F>%<t? Tag:%t>%<p? Post:%p>%<b? Inc:%b>%<l? %l>]---(%<T?%T/>%s/%S)-%>-(%P)---"), IP &StatusFormatDef, NULL,
124 "printf-like format string for the index's status line"
125 },
126 { "status_chars", DT_MBTABLE, IP "-*%A", 0, NULL,
127 "Indicator characters for the status bar"
128 },
129 { "to_chars", DT_MBTABLE, IP " +TCFLR", 0, NULL,
130 "Indicator characters for the 'To' field in the index"
131 },
132 { "ts_enabled", DT_BOOL, false, 0, NULL,
133 "Allow NeoMutt to set the terminal status line and icon"
134 },
135 // L10N: $ts_icon_format default format
136 { "ts_icon_format", DT_EXPANDO|D_L10N_STRING, IP N_("M%<n?AIL&ail>"), IP StatusFormatDefNoPadding, NULL,
137 "printf-like format string for the terminal's icon title"
138 },
139 // L10N: $ts_status_format default format
140 { "ts_status_format", DT_EXPANDO|D_L10N_STRING, IP N_("NeoMutt with %<m?%m messages&no messages>%<n? [%n NEW]>"), IP StatusFormatDefNoPadding, NULL,
141 "printf-like format string for the terminal's status (window title)"
142 },
143 { "uncollapse_jump", DT_BOOL, false, 0, NULL,
144 "When opening a thread, jump to the next unread message"
145 },
146 { "uncollapse_new", DT_BOOL, true, 0, NULL,
147 "Open collapsed threads when new mail arrives"
148 },
149
150 { "hdr_format", DT_SYNONYM, IP "index_format", IP "2021-03-21" },
151 { "xterm_icon", DT_SYNONYM, IP "ts_icon_format", IP "2021-03-21" },
152 { "xterm_set_titles", DT_SYNONYM, IP "ts_enabled", IP "2021-03-21" },
153 { "xterm_title", DT_SYNONYM, IP "ts_status_format", IP "2021-03-21" },
154
155 { NULL },
156 // clang-format on
157};
const struct ExpandoDefinition IndexFormatDef[]
Expando definitions.
#define IP
Definition set.h:54
const struct ExpandoDefinition StatusFormatDef[]
Expando definitions.
Definition config.c:49
static const struct ExpandoDefinition *const StatusFormatDefNoPadding
StatusFormatDefNoPadding - Status format definitions, without padding.
Definition config.c:82
#define N_(a)
Definition message.h:32
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition quad.h:39
#define D_STRING_COMMAND
A command.
Definition types.h:99
#define D_L10N_STRING
String can be localised.
Definition types.h:82
@ 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_MBTABLE
multibyte char table
Definition types.h:36
@ DT_EXPANDO
an expando
Definition types.h:34
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:80

◆ IndexCommands

const struct Command IndexCommands[]
extern

Index Commands.

Definition at line 38 of file commands.c.

38 {
39 // clang-format off
40 { "subject-regex", CMD_SUBJECT_REGEX, parse_subjectrx_list,
41 N_("Apply regex-based rewriting to message subjects"),
42 N_("subject-regex <regex> <replacement>"),
43 "advancedusage.html#display-munging" },
44 { "unsubject-regex", CMD_UNSUBJECT_REGEX, parse_unsubjectrx_list,
45 N_("Remove subject-rewriting rules"),
46 N_("unsubject-regex { * | <regex> }"),
47 "advancedusage.html#display-munging" },
48
49 // Deprecated
50 { "subjectrx", CMD_NONE, NULL, "subject-regex", NULL, NULL, CF_SYNONYM },
51 { "unsubjectrx", CMD_NONE, NULL, "unsubject-regex", NULL, NULL, CF_SYNONYM },
52
53 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NO_FLAGS },
54 // clang-format on
55};
#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_UNSUBJECT_REGEX
:unsubject-regex
Definition command.h:144
@ CMD_NONE
No Command.
Definition command.h:59
@ CMD_SUBJECT_REGEX
:subject-regex
Definition command.h:116
enum CommandResult parse_unsubjectrx_list(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unsubject-regex' command - Implements Command::parse() -.
Definition subjectrx.c:224
enum CommandResult parse_subjectrx_list(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'subject-regex' command - Implements Command::parse() -.
Definition subjectrx.c:192

◆ ModuleIndex

const struct Module ModuleIndex
Initial value:
= {
"index",
NULL,
NULL,
NULL,
}
static bool index_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:57
static bool index_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:45
static bool index_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:65
static bool index_cleanup(struct NeoMutt *n)
Clean up a Module - Implements Module::cleanup()
Definition module.c:73

Module for the Index library.

Definition at line 87 of file module.c.

87 {
89 "index",
91 NULL, // config_define_types
94 NULL, // gui_init
95 NULL, // gui_cleanup
97};