NeoMutt
2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
objects.c
Go to the documentation of this file.
1
22
28
29
#include "config.h"
30
#include <stddef.h>
31
#include "
mutt/lib.h
"
32
#include "
objects.h
"
33
40
static
void
sa_clear
(
struct
StringArray *sa)
41
{
42
const
char
**cp = NULL;
43
ARRAY_FOREACH
(cp, sa)
44
{
45
FREE
(cp);
46
}
47
48
ARRAY_FREE
(sa);
49
}
50
55
static
void
cli_shared_clear
(
struct
CliShared
*
shared
)
56
{
57
buf_dealloc
(&
shared
->
log_file
);
58
buf_dealloc
(&
shared
->
log_level
);
59
buf_dealloc
(&
shared
->
mbox_type
);
60
61
sa_clear
(&
shared
->
commands
);
62
sa_clear
(&
shared
->
user_files
);
63
}
64
69
static
void
cli_info_clear
(
struct
CliInfo
*
info
)
70
{
71
sa_clear
(&
info
->
alias_queries
);
72
sa_clear
(&
info
->
queries
);
73
}
74
79
static
void
cli_send_clear
(
struct
CliSend
*
send
)
80
{
81
sa_clear
(&
send
->addresses);
82
sa_clear
(&
send
->attach);
83
sa_clear
(&
send
->bcc_list);
84
sa_clear
(&
send
->cc_list);
85
86
buf_dealloc
(&
send
->draft_file);
87
buf_dealloc
(&
send
->include_file);
88
buf_dealloc
(&
send
->subject);
89
}
90
95
static
void
cli_tui_clear
(
struct
CliTui
*
tui
)
96
{
97
buf_dealloc
(&
tui
->
folder
);
98
buf_dealloc
(&
tui
->
nntp_server
);
99
}
100
105
struct
CommandLine
*
command_line_new
(
void
)
106
{
107
return
MUTT_MEM_CALLOC
(1,
struct
CommandLine
);
108
}
109
114
void
command_line_free
(
struct
CommandLine
**ptr)
115
{
116
if
(!ptr || !*ptr)
117
return
;
118
119
struct
CommandLine
*cl = *ptr;
120
121
// cl->help - nothing to do
122
cli_shared_clear
(&cl->
shared
);
123
cli_info_clear
(&cl->
info
);
124
cli_send_clear
(&cl->
send
);
125
cli_tui_clear
(&cl->
tui
);
126
127
FREE
(ptr);
128
}
ARRAY_FOREACH
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition
array.h:223
ARRAY_FREE
#define ARRAY_FREE(head)
Release all memory.
Definition
array.h:209
buf_dealloc
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition
buffer.c:383
FREE
#define FREE(x)
Free memory and set the pointer to NULL.
Definition
memory.h:68
MUTT_MEM_CALLOC
#define MUTT_MEM_CALLOC(n, type)
Definition
memory.h:52
lib.h
Convenience wrapper for the library headers.
send
static bool send(struct Notify *source, struct Notify *current, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition
notify.c:120
cli_shared_clear
static void cli_shared_clear(struct CliShared *shared)
Clear a CliShared.
Definition
objects.c:55
command_line_new
struct CommandLine * command_line_new(void)
Create a new CommandLine.
Definition
objects.c:105
command_line_free
void command_line_free(struct CommandLine **ptr)
Free a CommandLine.
Definition
objects.c:114
sa_clear
static void sa_clear(struct StringArray *sa)
Empty a StringArray.
Definition
objects.c:40
cli_send_clear
static void cli_send_clear(struct CliSend *send)
Clear a CliSend.
Definition
objects.c:79
cli_tui_clear
static void cli_tui_clear(struct CliTui *tui)
Clear a CliTui.
Definition
objects.c:95
cli_info_clear
static void cli_info_clear(struct CliInfo *info)
Clear a CliInfo.
Definition
objects.c:69
objects.h
Parse the Command Line.
CliInfo
Info Mode Command Line options.
Definition
objects.h:77
CliInfo::queries
struct StringArray queries
-Q Query a config option
Definition
objects.h:85
CliInfo::alias_queries
struct StringArray alias_queries
-A Lookup an alias
Definition
objects.h:84
CliSend
Send Mode Command Line options.
Definition
objects.h:92
CliShared
Shared Command Line options.
Definition
objects.h:47
CliShared::log_level
struct Buffer log_level
-d Debug log level
Definition
objects.h:56
CliShared::log_file
struct Buffer log_file
-l Debug log file
Definition
objects.h:57
CliShared::commands
struct StringArray commands
-e Run these commands
Definition
objects.h:53
CliShared::user_files
struct StringArray user_files
-F Use these user config files
Definition
objects.h:50
CliShared::mbox_type
struct Buffer mbox_type
-m Set the default Mailbox type
Definition
objects.h:54
CliTui
TUI Mode Command Line options.
Definition
objects.h:111
CliTui::nntp_server
struct Buffer nntp_server
-g Open this NNTP Mailbox
Definition
objects.h:121
CliTui::folder
struct Buffer folder
-f Open this Mailbox
Definition
objects.h:120
CommandLine
Command Line options.
Definition
objects.h:128
CommandLine::send
struct CliSend send
Send Mode command line options.
Definition
objects.h:132
CommandLine::shared
struct CliShared shared
Shared command line options.
Definition
objects.h:129
CommandLine::info
struct CliInfo info
Info Mode command line options.
Definition
objects.h:131
CommandLine::tui
struct CliTui tui
Tui Mode command line options.
Definition
objects.h:133