NeoMutt  2025-09-05-55-g97fc89
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
protos.h File Reference

Prototypes for many functions. More...

#include "config.h"
#include <stdbool.h>
#include "mutt.h"
#include "menu/lib.h"
+ Include dependency graph for protos.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  XdgType { XDG_CONFIG_HOME , XDG_CONFIG_DIRS }
 XDG variable types. More...
 
enum  EvMessage { EVM_VIEW , EVM_EDIT }
 Edit or View a message. More...
 

Functions

int mutt_ev_message (struct Mailbox *m, struct EmailArray *ea, enum EvMessage action)
 Edit or view a message.
 
int mutt_system (const char *cmd)
 Run an external command.
 
int mutt_set_xdg_path (enum XdgType type, struct Buffer *buf)
 Find an XDG path or its fallback.
 
void mutt_help (enum MenuType menu)
 Display the Help Page.
 
void mutt_set_flag (struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
 Set a flag on an email.
 
void mutt_signal_init (void)
 Initialise the signal handling.
 
void mutt_emails_set_flag (struct Mailbox *m, struct EmailArray *ea, enum MessageType flag, bool bf)
 Set flag on messages.
 
int mw_change_flag (struct Mailbox *m, struct EmailArray *ea, bool bf)
 Change the flag on a Message -.
 
int mutt_thread_set_flag (struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool subthread)
 Set a flag on an entire thread.
 
int wcscasecmp (const wchar_t *a, const wchar_t *b)
 Compare two wide-character strings, ignoring case.
 
int mutt_reply_observer (struct NotifyCallback *nc)
 
void init_config (struct ConfigSet *cs)
 Initialise the config system.
 

Variables

short PostCount
 Number of postponed (draft) emails.
 

Detailed Description

Prototypes for many functions.

Authors
  • Michael R. Elkins
  • Karel Zak
  • 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 protos.h.

Enumeration Type Documentation

◆ XdgType

enum XdgType

XDG variable types.

Enumerator
XDG_CONFIG_HOME 

XDG home dir: ~/.config.

XDG_CONFIG_DIRS 

XDG system dir: /etc/xdg.

Definition at line 43 of file protos.h.

44{
47};
@ XDG_CONFIG_HOME
XDG home dir: ~/.config.
Definition protos.h:45
@ XDG_CONFIG_DIRS
XDG system dir: /etc/xdg.
Definition protos.h:46

◆ EvMessage

enum EvMessage

Edit or View a message.

Enumerator
EVM_VIEW 

View the message.

EVM_EDIT 

Edit the message.

Definition at line 52 of file protos.h.

53{
54 EVM_VIEW,
55 EVM_EDIT,
56};
@ EVM_VIEW
View the message.
Definition protos.h:54
@ EVM_EDIT
Edit the message.
Definition protos.h:55

Function Documentation

◆ mutt_ev_message()

int mutt_ev_message ( struct Mailbox * m,
struct EmailArray * ea,
enum EvMessage action )

Edit or view a message.

Parameters
mMailbox
eaArray of Emails
actionAction to perform, e.g. EVM_EDIT
Return values
1Message not modified
0Message edited successfully
-1Error

Definition at line 284 of file editmsg.c.

285{
286 struct Email **ep = NULL;
287 ARRAY_FOREACH(ep, ea)
288 {
289 struct Email *e = *ep;
290 if (ev_message(action, m, e) == -1)
291 return -1;
292 }
293
294 return 0;
295}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:214
static int ev_message(enum EvMessage action, struct Mailbox *m, struct Email *e)
Edit an email or view it in an external editor.
Definition editmsg.c:59
The envelope/body of an email.
Definition email.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_system()

int mutt_system ( const char * cmd)

Run an external command.

Parameters
cmdCommand and arguments
Return values
-1Error
>=0Success (command's return code)

Fork and run an external command with arguments.

Note
This function won't return until the command finishes.

Definition at line 52 of file system.c.

53{
54 int rc = -1;
55 struct sigaction act = { 0 };
56 struct sigaction oldtstp = { 0 };
57 struct sigaction oldcont = { 0 };
58 pid_t pid;
59
60 if (!cmd || (*cmd == '\0'))
61 return 0;
62
63 /* must ignore SIGINT and SIGQUIT */
64
66
67 act.sa_handler = SIG_DFL;
68/* we want to restart the waitpid() below */
69#ifdef SA_RESTART
70 act.sa_flags = SA_RESTART;
71#endif
72 sigemptyset(&act.sa_mask);
73 sigaction(SIGTSTP, &act, &oldtstp);
74 sigaction(SIGCONT, &act, &oldcont);
75
76 pid = fork();
77 if (pid == 0)
78 {
79 act.sa_flags = 0;
80
83
84 execle(EXEC_SHELL, "sh", "-c", cmd, NULL, NeoMutt->env);
85 _exit(127); /* execl error */
86 }
87 else if (pid != -1)
88 {
89 rc = imap_wait_keep_alive(pid);
90 }
91
92 sigaction(SIGCONT, &oldcont, NULL);
93 sigaction(SIGTSTP, &oldtstp, NULL);
94
95 /* reset SIGINT, SIGQUIT and SIGCHLD */
97
98 rc = (pid != -1) ? (WIFEXITED(rc) ? WEXITSTATUS(rc) : -1) : -1;
99
100 return rc;
101}
int imap_wait_keep_alive(pid_t pid)
Wait for a process to change state.
Definition util.c:1017
#define EXEC_SHELL
Definition filter.h:29
void mutt_sig_reset_child_signals(void)
Reset ignored signals back to the default.
Definition signal.c:336
void mutt_sig_block_system(void)
Block signals before calling exec()
Definition signal.c:260
void mutt_sig_unblock_system(bool restore)
Restore previously blocked signals.
Definition signal.c:284
Container for Accounts, Notifications.
Definition neomutt.h:43
char ** env
Private copy of the environment variables.
Definition neomutt.h:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_set_xdg_path()

int mutt_set_xdg_path ( enum XdgType type,
struct Buffer * buf )

Find an XDG path or its fallback.

Parameters
typeType of XDG variable, e.g. XDG_CONFIG_HOME
bufBuffer to save path
Return values
1An entry was found that actually exists on disk and 0 otherwise

Process an XDG environment variable or its fallback.

Definition at line 882 of file muttlib.c.

883{
884 const char *xdg_env = mutt_str_getenv(XdgEnvVars[type]);
885 char *xdg = xdg_env ? mutt_str_dup(xdg_env) : mutt_str_dup(XdgDefaults[type]);
886 char *x = xdg; /* mutt_str_sep() changes xdg, so free x instead later */
887 char *token = NULL;
888 int rc = 0;
889
890 while ((token = mutt_str_sep(&xdg, ":")))
891 {
892 if (buf_printf(buf, "%s/%s/neomuttrc", token, PACKAGE) < 0)
893 continue;
894 buf_expand_path(buf);
895 if (access(buf_string(buf), F_OK) == 0)
896 {
897 rc = 1;
898 break;
899 }
900
901 if (buf_printf(buf, "%s/%s/Muttrc", token, PACKAGE) < 0)
902 continue;
903 buf_expand_path(buf);
904 if (access(buf_string(buf), F_OK) == 0)
905 {
906 rc = 1;
907 break;
908 }
909 }
910
911 FREE(&x);
912 return rc;
913}
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:161
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
#define FREE(x)
Definition memory.h:62
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition string.c:255
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition string.c:726
char * mutt_str_sep(char **stringp, const char *delim)
Find first occurrence of any of delim characters in *stringp.
Definition string.c:188
static const char * XdgEnvVars[]
Accepted XDG environment variables.
Definition muttlib.c:64
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition muttlib.c:314
static const char * XdgDefaults[]
XDG default locations.
Definition muttlib.c:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_help()

void mutt_help ( enum MenuType menu)

Display the Help Page.

Parameters
menuMenu type

Definition at line 148 of file help.c.

149{
150 struct BindingInfoArray bia_bind = ARRAY_HEAD_INITIALIZER;
151 struct BindingInfoArray bia_macro = ARRAY_HEAD_INITIALIZER;
152 struct BindingInfoArray bia_gen = ARRAY_HEAD_INITIALIZER;
153 struct BindingInfoArray bia_unbound = ARRAY_HEAD_INITIALIZER;
154 struct Buffer *banner = NULL;
155 struct Buffer *tempfile = NULL;
156 struct BindingInfo *bi = NULL;
157
158 // ---------------------------------------------------------------------------
159 // Gather the data
160
161 gather_menu(menu, &bia_bind, &bia_macro);
162
163 ARRAY_SORT(&bia_bind, binding_sort, NULL);
164 ARRAY_SORT(&bia_macro, binding_sort, NULL);
165
166 int wb0 = measure_column(&bia_bind, 0);
167 int wb1 = measure_column(&bia_bind, 1);
168
169 const bool need_generic = (menu != MENU_EDITOR) && (menu != MENU_PAGER) &&
170 (menu != MENU_GENERIC);
171 if (need_generic)
172 {
173 gather_menu(MENU_GENERIC, &bia_gen, &bia_macro);
174
175 ARRAY_SORT(&bia_gen, binding_sort, NULL);
176 wb0 = MAX(wb0, measure_column(&bia_gen, 0));
177 wb1 = MAX(wb1, measure_column(&bia_gen, 1));
178 }
179
180 const int wm0 = measure_column(&bia_macro, 0);
181
182 const struct MenuFuncOp *funcs = km_get_table(menu);
183 gather_unbound(funcs, &Keymaps[menu], NULL, &bia_unbound);
184
185 if (need_generic)
186 gather_unbound(OpGeneric, &Keymaps[MENU_GENERIC], &Keymaps[menu], &bia_unbound);
187
188 ARRAY_SORT(&bia_unbound, binding_sort, NULL);
189 const int wu1 = measure_column(&bia_unbound, 1);
190
191 // ---------------------------------------------------------------------------
192 // Save the data to a file
193
194 tempfile = buf_pool_get();
195 buf_mktemp(tempfile);
196 FILE *fp = mutt_file_fopen(buf_string(tempfile), "w");
197 if (!fp)
198 {
199 mutt_perror("%s", buf_string(tempfile));
200 goto cleanup;
201 }
202
203 const char *menu_name = mutt_map_get_name(menu, MenuNames);
204
205 fprintf(fp, "%s bindings\n", menu_name);
206 fprintf(fp, "\n");
207 ARRAY_FOREACH(bi, &bia_bind)
208 {
209 // key text description
210 fprintf(fp, "%*s %*s %s\n", -wb0, bi->a[0], -wb1, bi->a[1], bi->a[2]);
211 }
212 fprintf(fp, "\n");
213
214 if (need_generic)
215 {
216 fprintf(fp, "%s bindings\n", "generic");
217 fprintf(fp, "\n");
218 ARRAY_FOREACH(bi, &bia_gen)
219 {
220 // key function description
221 fprintf(fp, "%*s %*s %s\n", -wb0, bi->a[0], -wb1, bi->a[1], bi->a[2]);
222 }
223 fprintf(fp, "\n");
224 }
225
226 fprintf(fp, "macros\n");
227 fprintf(fp, "\n");
228 ARRAY_FOREACH(bi, &bia_macro)
229 {
230 if (bi->a[2]) // description
231 {
232 // key description, macro-text, blank line
233 fprintf(fp, "%*s %s\n", -wm0, bi->a[0], bi->a[2]);
234 fprintf(fp, "%s\n", bi->a[1]);
235 fprintf(fp, "\n");
236 }
237 else
238 {
239 // key macro-text
240 fprintf(fp, "%*s %s\n", -wm0, bi->a[0], bi->a[1]);
241 }
242 }
243 fprintf(fp, "\n");
244
245 fprintf(fp, "unbound functions\n");
246 fprintf(fp, "\n");
247 ARRAY_FOREACH(bi, &bia_unbound)
248 {
249 // function description
250 fprintf(fp, "%*s %s\n", -wu1, bi->a[1], bi->a[2]);
251 }
252
253 dump_message_flags(menu, fp);
254 mutt_file_fclose(&fp);
255
256 // ---------------------------------------------------------------------------
257 // Display data
258
259 struct PagerData pdata = { 0 };
260 struct PagerView pview = { &pdata };
261
262 pview.mode = PAGER_MODE_HELP;
264
266 buf_printf(banner, _("Help for %s"), menu_name);
267 pdata.fname = buf_string(tempfile);
268 pview.banner = buf_string(banner);
269 mutt_do_pager(&pview, NULL);
270
271cleanup:
272
273 ARRAY_FOREACH(bi, &bia_bind)
274 {
275 FREE(&bi->a[0]);
276 }
277
278 ARRAY_FOREACH(bi, &bia_macro)
279 {
280 FREE(&bi->a[0]);
281 FREE(&bi->a[1]);
282 }
283
284 ARRAY_FOREACH(bi, &bia_gen)
285 {
286 FREE(&bi->a[0]);
287 }
288
290 buf_pool_release(&tempfile);
291 ARRAY_FREE(&bia_bind);
292 ARRAY_FREE(&bia_macro);
293 ARRAY_FREE(&bia_gen);
294 ARRAY_FREE(&bia_unbound);
295}
#define ARRAY_SORT(head, fn, sdata)
Sort an array.
Definition array.h:335
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:204
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition array.h:58
int mutt_do_pager(struct PagerView *pview, struct Email *e)
Display some page-able text to the user (help or attachment)
Definition do_pager.c:122
#define mutt_file_fclose(FP)
Definition file.h:139
#define mutt_file_fopen(PATH, MODE)
Definition file.h:138
#define mutt_perror(...)
Definition logging2.h:94
int binding_sort(const void *a, const void *b, void *sdata)
Compare two BindingInfo by their keybinding - Implements sort_t -.
Definition dump.c:262
const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Definition functions.c:69
static void dump_message_flags(enum MenuType menu, FILE *fp)
Write out all the message flags.
Definition help.c:104
int measure_column(struct BindingInfoArray *bia, int col)
Measure one column of a table.
Definition dump.c:413
void gather_menu(enum MenuType menu, struct BindingInfoArray *bia_bind, struct BindingInfoArray *bia_macro)
Gather info about one menu.
Definition dump.c:357
struct KeymapList Keymaps[MENU_MAX]
Array of key mappings, one for each MenuType.
Definition lib.c:125
const struct MenuFuncOp * km_get_table(enum MenuType mtype)
Lookup a Menu's functions.
Definition lib.c:482
int gather_unbound(const struct MenuFuncOp *funcs, const struct KeymapList *km_menu, const struct KeymapList *km_aux, struct BindingInfoArray *bia_unbound)
Gather info about unbound functions for one menu.
Definition lib.c:363
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition mapping.c:42
#define MAX(a, b)
Definition memory.h:36
#define _(a)
Definition message.h:28
#define MUTT_PAGER_NOWRAP
Format for term width, ignore $wrap.
Definition lib.h:71
#define MUTT_PAGER_STRIPES
Striped highlighting.
Definition lib.h:74
#define MUTT_PAGER_MARKER
Use markers if option is set.
Definition lib.h:69
@ PAGER_MODE_HELP
Pager is invoked via 3rd path to show help.
Definition lib.h:139
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:82
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:96
Info about one keybinding.
Definition lib.h:95
const char * a[3]
Array of info.
Definition lib.h:96
String manipulation buffer.
Definition buffer.h:36
Mapping between a function and an operation.
Definition lib.h:115
Data to be displayed by PagerView.
Definition lib.h:159
const char * fname
Name of the file to read.
Definition lib.h:163
Paged view into some data.
Definition lib.h:170
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition lib.h:171
enum PagerMode mode
Pager mode.
Definition lib.h:172
PagerFlags flags
Additional settings to tweak pager's function.
Definition lib.h:173
const char * banner
Title to display in status bar.
Definition lib.h:174
#define buf_mktemp(buf)
Definition tmp.h:33
const struct Mapping MenuNames[]
Menu name lookup table.
Definition type.c:37
@ MENU_GENERIC
Generic selection list.
Definition type.h:45
@ MENU_PAGER
Pager pager (email viewer)
Definition type.h:47
@ MENU_EDITOR
Text entry area.
Definition type.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_set_flag()

void mutt_set_flag ( struct Mailbox * m,
struct Email * e,
enum MessageType flag,
bool bf,
bool upd_mbox )

Set a flag on an email.

Parameters
mMailbox
eEmail
flagFlag to set, e.g. MUTT_DELETE
bftrue: set the flag; false: clear the flag
upd_mboxtrue: update the Mailbox

Definition at line 56 of file flags.c.

58{
59 if (!m || !e)
60 return;
61
62 bool changed = e->changed;
63 int deleted = m->msg_deleted;
64 int tagged = m->msg_tagged;
65 int flagged = m->msg_flagged;
66 int update = false;
67
68 if (m->readonly && (flag != MUTT_TAG))
69 return; /* don't modify anything if we are read-only */
70
71 switch (flag)
72 {
73 case MUTT_DELETE:
74 {
75 if (!(m->rights & MUTT_ACL_DELETE))
76 return;
77
78 if (bf)
79 {
80 const bool c_flag_safe = cs_subset_bool(NeoMutt->sub, "flag_safe");
81 if (!e->deleted && !m->readonly && (!e->flagged || !c_flag_safe))
82 {
83 e->deleted = true;
84 update = true;
85 if (upd_mbox)
86 m->msg_deleted++;
87 /* deleted messages aren't treated as changed elsewhere so that the
88 * purge-on-sync option works correctly. This isn't applicable here */
89 if (m->type == MUTT_IMAP)
90 {
91 e->changed = true;
92 if (upd_mbox)
93 m->changed = true;
94 }
95 }
96 }
97 else if (e->deleted)
98 {
99 e->deleted = false;
100 update = true;
101 if (upd_mbox)
102 m->msg_deleted--;
103 /* see my comment above */
104 if (m->type == MUTT_IMAP)
105 {
106 e->changed = true;
107 if (upd_mbox)
108 m->changed = true;
109 }
110 /* If the user undeletes a message which is marked as
111 * "trash" in the maildir folder on disk, the folder has
112 * been changed, and is marked accordingly. However, we do
113 * _not_ mark the message itself changed, because trashing
114 * is checked in specific code in the maildir folder
115 * driver. */
116 if ((m->type == MUTT_MAILDIR) && upd_mbox && e->trash)
117 m->changed = true;
118 }
119 break;
120 }
121 case MUTT_PURGE:
122 {
123 if (!(m->rights & MUTT_ACL_DELETE))
124 return;
125
126 if (bf)
127 {
128 if (!e->purge && !m->readonly)
129 e->purge = true;
130 }
131 else if (e->purge)
132 {
133 e->purge = false;
134 }
135 break;
136 }
137 case MUTT_NEW:
138 {
139 if (!(m->rights & MUTT_ACL_SEEN))
140 return;
141
142 if (bf)
143 {
144 if (e->read || e->old)
145 {
146 update = true;
147 e->old = false;
148 if (upd_mbox)
149 m->msg_new++;
150 if (e->read)
151 {
152 e->read = false;
153 if (upd_mbox)
154 m->msg_unread++;
155 }
156 e->changed = true;
157 if (upd_mbox)
158 m->changed = true;
159 }
160 }
161 else if (!e->read)
162 {
163 update = true;
164 if (!e->old)
165 if (upd_mbox)
166 m->msg_new--;
167 e->read = true;
168 if (upd_mbox)
169 m->msg_unread--;
170 e->changed = true;
171 if (upd_mbox)
172 m->changed = true;
173 }
174 break;
175 }
176 case MUTT_OLD:
177 {
178 if (!(m->rights & MUTT_ACL_SEEN))
179 return;
180
181 if (bf)
182 {
183 if (!e->old)
184 {
185 update = true;
186 e->old = true;
187 if (!e->read)
188 if (upd_mbox)
189 m->msg_new--;
190 e->changed = true;
191 if (upd_mbox)
192 m->changed = true;
193 }
194 }
195 else if (e->old)
196 {
197 update = true;
198 e->old = false;
199 if (!e->read)
200 if (upd_mbox)
201 m->msg_new++;
202 e->changed = true;
203 if (upd_mbox)
204 m->changed = true;
205 }
206 break;
207 }
208 case MUTT_READ:
209 {
210 if (!(m->rights & MUTT_ACL_SEEN))
211 return;
212
213 if (bf)
214 {
215 if (!e->read)
216 {
217 update = true;
218 e->read = true;
219 if (upd_mbox)
220 m->msg_unread--;
221 if (!e->old)
222 if (upd_mbox)
223 m->msg_new--;
224 e->changed = true;
225 if (upd_mbox)
226 m->changed = true;
227 }
228 }
229 else if (e->read)
230 {
231 update = true;
232 e->read = false;
233 if (upd_mbox)
234 m->msg_unread++;
235 if (!e->old)
236 if (upd_mbox)
237 m->msg_new++;
238 e->changed = true;
239 if (upd_mbox)
240 m->changed = true;
241 }
242 break;
243 }
244 case MUTT_REPLIED:
245 {
246 if (!(m->rights & MUTT_ACL_WRITE))
247 return;
248
249 if (bf)
250 {
251 if (!e->replied)
252 {
253 update = true;
254 e->replied = true;
255 if (!e->read)
256 {
257 e->read = true;
258 if (upd_mbox)
259 m->msg_unread--;
260 if (!e->old)
261 if (upd_mbox)
262 m->msg_new--;
263 }
264 e->changed = true;
265 if (upd_mbox)
266 m->changed = true;
267 }
268 }
269 else if (e->replied)
270 {
271 update = true;
272 e->replied = false;
273 e->changed = true;
274 if (upd_mbox)
275 m->changed = true;
276 }
277 break;
278 }
279 case MUTT_FLAG:
280 {
281 if (!(m->rights & MUTT_ACL_WRITE))
282 return;
283
284 if (bf)
285 {
286 if (!e->flagged)
287 {
288 update = true;
289 e->flagged = bf;
290 if (upd_mbox)
291 m->msg_flagged++;
292 e->changed = true;
293 if (upd_mbox)
294 m->changed = true;
295 }
296 }
297 else if (e->flagged)
298 {
299 update = true;
300 e->flagged = false;
301 if (upd_mbox)
302 m->msg_flagged--;
303 e->changed = true;
304 if (upd_mbox)
305 m->changed = true;
306 }
307 break;
308 }
309 case MUTT_TAG:
310 {
311 if (bf)
312 {
313 if (!e->tagged)
314 {
315 update = true;
316 e->tagged = true;
317 if (upd_mbox)
318 m->msg_tagged++;
319 }
320 }
321 else if (e->tagged)
322 {
323 update = true;
324 e->tagged = false;
325 if (upd_mbox)
326 m->msg_tagged--;
327 }
328 break;
329 }
330 default:
331 {
332 break;
333 }
334 }
335
336 if (update)
337 {
338 email_set_color(m, e);
339 struct EventMailbox ev_m = { m };
341 }
342
343 /* if the message status has changed, we need to invalidate the cached
344 * search results so that any future search will match the current status
345 * of this message and not what it was at the time it was last searched. */
346 if (e->searched && ((changed != e->changed) || (deleted != m->msg_deleted) ||
347 (tagged != m->msg_tagged) || (flagged != m->msg_flagged)))
348 {
349 e->searched = false;
350 }
351}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
@ NT_MAILBOX_CHANGE
Mailbox has been changed.
Definition mailbox.h:185
#define MUTT_ACL_DELETE
Delete a message.
Definition mailbox.h:63
#define MUTT_ACL_WRITE
Write to a message (for flagging or linking threads)
Definition mailbox.h:71
@ MUTT_IMAP
'IMAP' Mailbox type
Definition mailbox.h:50
@ MUTT_MAILDIR
'Maildir' Mailbox type
Definition mailbox.h:48
#define MUTT_ACL_SEEN
Change the 'seen' status of a message.
Definition mailbox.h:70
void email_set_color(struct Mailbox *m, struct Email *e)
Select an Index colour for an Email.
Definition dlg_index.c:1405
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition notify.c:173
@ MUTT_READ
Messages that have been read.
Definition mutt.h:73
@ MUTT_OLD
Old messages.
Definition mutt.h:71
@ MUTT_PURGE
Messages to be purged (bypass trash)
Definition mutt.h:77
@ MUTT_TAG
Tagged messages.
Definition mutt.h:80
@ MUTT_FLAG
Flagged messages.
Definition mutt.h:79
@ MUTT_DELETE
Messages to be deleted.
Definition mutt.h:75
@ MUTT_NEW
New messages.
Definition mutt.h:70
@ MUTT_REPLIED
Messages that have been replied to.
Definition mutt.h:72
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition notify_type.h:49
bool searched
Email has been searched.
Definition email.h:105
bool read
Email is read.
Definition email.h:50
bool purge
Skip trash folder when deleting.
Definition email.h:79
bool old
Email is seen, but unread.
Definition email.h:49
bool changed
Email has been edited.
Definition email.h:77
bool flagged
Marked important?
Definition email.h:47
bool replied
Email has been replied to.
Definition email.h:51
bool deleted
Email is deleted.
Definition email.h:78
bool trash
Message is marked as trashed on disk (used by the maildir_trash option)
Definition email.h:53
bool tagged
Email is tagged.
Definition email.h:107
An Event that happened to a Mailbox.
Definition mailbox.h:199
bool changed
Mailbox has been modified.
Definition mailbox.h:110
int msg_new
Number of new messages.
Definition mailbox.h:92
AclFlags rights
ACL bits, see AclFlags.
Definition mailbox.h:119
enum MailboxType type
Mailbox type.
Definition mailbox.h:102
struct Notify * notify
Notifications: NotifyMailbox, EventMailbox.
Definition mailbox.h:145
int msg_deleted
Number of deleted messages.
Definition mailbox.h:93
int msg_flagged
Number of flagged messages.
Definition mailbox.h:90
bool readonly
Don't allow changes to the mailbox.
Definition mailbox.h:116
int msg_tagged
How many messages are tagged?
Definition mailbox.h:94
int msg_unread
Number of unread messages.
Definition mailbox.h:89
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_signal_init()

void mutt_signal_init ( void )

Initialise the signal handling.

Definition at line 135 of file mutt_signal.c.

136{
138}
static void curses_signal_handler(int sig)
Catch signals and relay the info to the main program - Implements sig_handler_t -.
Definition mutt_signal.c:51
static void curses_segv_handler(int sig)
Catch a segfault and print a backtrace - Implements sig_handler_t -.
static void curses_exit_handler(int sig)
Notify the user and shutdown gracefully - Implements sig_handler_t -.
Definition mutt_signal.c:95
void mutt_sig_init(sig_handler_t sig_fn, sig_handler_t exit_fn, sig_handler_t segv_fn)
Initialise the signal handling.
Definition signal.c:163
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_emails_set_flag()

void mutt_emails_set_flag ( struct Mailbox * m,
struct EmailArray * ea,
enum MessageType flag,
bool bf )

Set flag on messages.

Parameters
mMailbox
eaArray of Emails to flag
flagFlag to set, e.g. MUTT_DELETE
bftrue: set the flag; false: clear the flag

Definition at line 360 of file flags.c.

362{
363 if (!m || !ea || ARRAY_EMPTY(ea))
364 return;
365
366 struct Email **ep = NULL;
367 ARRAY_FOREACH(ep, ea)
368 {
369 struct Email *e = *ep;
370 mutt_set_flag(m, e, flag, bf, true);
371 }
372}
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition array.h:74
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
Definition flags.c:56
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_thread_set_flag()

int mutt_thread_set_flag ( struct Mailbox * m,
struct Email * e,
enum MessageType flag,
bool bf,
bool subthread )

Set a flag on an entire thread.

Parameters
mMailbox
eEmail
flagFlag to set, e.g. MUTT_DELETE
bftrue: set the flag; false: clear the flag
subthreadIf true apply to all of the thread
Return values
0Success
-1Failure

Definition at line 384 of file flags.c.

386{
387 struct MuttThread *start = NULL;
388 struct MuttThread *cur = e->thread;
389
390 if (!mutt_using_threads())
391 {
392 mutt_error(_("Threading is not enabled"));
393 return -1;
394 }
395
396 if (!subthread)
397 while (cur->parent)
398 cur = cur->parent;
399
400 start = cur;
401
402 if (cur->message && (cur != e->thread))
403 mutt_set_flag(m, cur->message, flag, bf, true);
404
405 cur = cur->child;
406 if (!cur)
407 goto done;
408
409 while (true)
410 {
411 if (cur->message && (cur != e->thread))
412 mutt_set_flag(m, cur->message, flag, bf, true);
413
414 if (cur->child)
415 {
416 cur = cur->child;
417 }
418 else if (cur->next)
419 {
420 cur = cur->next;
421 }
422 else
423 {
424 while (!cur->next)
425 {
426 cur = cur->parent;
427 if (cur == start)
428 goto done;
429 }
430 cur = cur->next;
431 }
432 }
433done:
434 cur = e->thread;
435 if (cur->message)
436 mutt_set_flag(m, cur->message, flag, bf, true);
437 return 0;
438}
#define mutt_error(...)
Definition logging2.h:93
#define mutt_using_threads()
struct MuttThread * thread
Thread of Emails.
Definition email.h:119
An Email conversation.
Definition thread.h:34
struct MuttThread * parent
Parent of this Thread.
Definition thread.h:44
struct MuttThread * child
Child of this Thread.
Definition thread.h:45
struct Email * message
Email this Thread refers to.
Definition thread.h:49
struct MuttThread * next
Next sibling Thread.
Definition thread.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wcscasecmp()

int wcscasecmp ( const wchar_t * a,
const wchar_t * b )

Compare two wide-character strings, ignoring case.

Parameters
aFirst string
bSecond string
Return values
-1a precedes b
0a and b are identical
1b precedes a

Definition at line 41 of file wcscasecmp.c.

42{
43 if (!a && !b)
44 return 0;
45 if (!a && b)
46 return -1;
47 if (a && !b)
48 return 1;
49
50 for (; *a || *b; a++, b++)
51 {
52 int i = towlower(*a);
53 if ((i - towlower(*b)) != 0)
54 return i;
55 }
56 return 0;
57}
+ Here is the caller graph for this function:

◆ mutt_reply_observer()

int mutt_reply_observer ( struct NotifyCallback * nc)

◆ init_config()

void init_config ( struct ConfigSet * cs)

Initialise the config system.

Parameters
csConfig items

Definition at line 928 of file mutt_config.c.

929{
930 init_types(cs);
931 init_variables(cs);
932}
static void init_types(struct ConfigSet *cs)
Create the config types.
static void init_variables(struct ConfigSet *cs)
Define the config variables.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ PostCount

short PostCount
extern

Number of postponed (draft) emails.

Definition at line 58 of file postpone.c.