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

Definition of the History 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 history_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool history_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool history_cleanup (struct NeoMutt *n, void *data)
 Clean up a Module - Implements Module::cleanup()
 
static bool history_gui_init (struct NeoMutt *n)
 Initialise the GUI - Implements Module::gui_init()
 
static void history_gui_cleanup (struct NeoMutt *n)
 Clean up the GUI - Implements Module::gui_cleanup()
 

Variables

struct ConfigDef HistoryVars []
 Config definitions for the command history.
 
const struct Module ModuleHistory
 Module for the History library.
 

Detailed Description

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

◆ history_init()

static bool history_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 43 of file module.c.

44{
45 struct HistoryModuleData *mod_data = MUTT_MEM_CALLOC(1, struct HistoryModuleData);
47
48 mod_data->notify = notify_new();
49 notify_set_parent(mod_data->notify, n->notify);
50
51 return true;
52}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_HISTORY
ModuleHistory, History
Definition module_api.h:69
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
History private Module data.
Definition module_data.h:44
struct Notify * notify
Notifications.
Definition module_data.h:45
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ history_config_define_variables()

static bool history_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 HistoryVars[]
Config definitions for the command history.
Definition config.c:56
+ Here is the call graph for this function:

◆ history_cleanup()

static bool history_cleanup ( struct NeoMutt * n,
void * data )
static

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

Definition at line 65 of file module.c.

66{
67 struct HistoryModuleData *mod_data = data;
68
69 notify_free(&mod_data->notify);
70
71 FREE(&mod_data);
72 return true;
73}
#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
+ Here is the call graph for this function:

◆ history_gui_init()

static bool history_gui_init ( struct NeoMutt * n)
static

Initialise the GUI - Implements Module::gui_init()

Definition at line 78 of file module.c.

79{
81 mutt_hist_init(mod_data);
83 return true;
84}
void mutt_hist_init(struct HistoryModuleData *mod_data)
Create a set of empty History ring buffers.
Definition history.c:451
void mutt_hist_read_file(void)
Read the History from a file.
Definition history.c:579
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
+ Here is the call graph for this function:

◆ history_gui_cleanup()

static void history_gui_cleanup ( struct NeoMutt * n)
static

Clean up the GUI - Implements Module::gui_cleanup()

Definition at line 89 of file module.c.

90{
92 mutt_hist_cleanup(mod_data);
93}
void mutt_hist_cleanup(struct HistoryModuleData *mod_data)
Free all the history lists.
Definition history.c:427
+ Here is the call graph for this function:

Variable Documentation

◆ HistoryVars

struct ConfigDef HistoryVars[]
extern

Config definitions for the command history.

Definition at line 56 of file config.c.

56 {
57 // clang-format off
58 { "history", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 10, 0, NULL,
59 "Number of history entries to keep in memory per category"
60 },
61 { "history_file", DT_PATH|D_PATH_FILE, IP "~/.mutthistory", 0, NULL,
62 "File to save history in"
63 },
64 { "history_format", DT_EXPANDO, IP "%s", IP &HistoryFormatDef, NULL,
65 "printf-like format string for the history menu"
66 },
67 { "history_remove_dups", DT_BOOL, false, 0, NULL,
68 "Remove duplicate entries from the history"
69 },
70 { "save_history", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
71 "Number of history entries to save per category"
72 },
73 { NULL },
74 // clang-format on
75};
#define IP
Definition set.h:55
static const struct ExpandoDefinition HistoryFormatDef[]
Expando definitions.
Definition config.c:42
#define D_PATH_FILE
Path is a file.
Definition types.h:104
@ DT_NUMBER
a number
Definition types.h:38
@ 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
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition types.h:101

◆ ModuleHistory

const struct Module ModuleHistory
Initial value:
= {
"history",
NULL,
NULL,
}
static bool history_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:57
static bool history_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:78
static bool history_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:43
static bool history_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:65
static void history_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:89

Module for the History library.

Definition at line 98 of file module.c.

98 {
100 "history",
102 NULL, // config_define_types
104 NULL, // commands_register
108};