NeoMutt  2024-10-02-7-gd3e66a
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 menu.
 
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)
 

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 42 of file protos.h.

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

◆ EvMessage

enum EvMessage

Edit or View a message.

Enumerator
EVM_VIEW 

View the message.

EVM_EDIT 

Edit the message.

Definition at line 51 of file protos.h.

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

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:212
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, EnvList);
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}
char ** EnvList
Private copy of the environment variables.
Definition: globals.c:76
int imap_wait_keep_alive(pid_t pid)
Wait for a process to change state.
Definition: util.c:1019
#define EXEC_SHELL
Definition: filter.h:29
void mutt_sig_reset_child_signals(void)
Reset ignored signals back to the default.
Definition: signal.c:321
void mutt_sig_block_system(void)
Block signals before calling exec()
Definition: signal.c:245
void mutt_sig_unblock_system(bool restore)
Restore previously blocked signals.
Definition: signal.c:269
+ 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 897 of file muttlib.c.

898{
899 const char *xdg_env = mutt_str_getenv(XdgEnvVars[type]);
900 char *xdg = xdg_env ? mutt_str_dup(xdg_env) : mutt_str_dup(XdgDefaults[type]);
901 char *x = xdg; /* mutt_str_sep() changes xdg, so free x instead later */
902 char *token = NULL;
903 int rc = 0;
904
905 while ((token = mutt_str_sep(&xdg, ":")))
906 {
907 if (buf_printf(buf, "%s/%s/neomuttrc", token, PACKAGE) < 0)
908 continue;
909 buf_expand_path(buf);
910 if (access(buf_string(buf), F_OK) == 0)
911 {
912 rc = 1;
913 break;
914 }
915
916 if (buf_printf(buf, "%s/%s/Muttrc", token, PACKAGE) < 0)
917 continue;
918 buf_expand_path(buf);
919 if (access(buf_string(buf), F_OK) == 0)
920 {
921 rc = 1;
922 break;
923 }
924 }
925
926 FREE(&x);
927 return rc;
928}
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:45
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:253
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:186
static const char * XdgEnvVars[]
Accepted XDG environment variables.
Definition: muttlib.c:65
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:315
static const char * XdgDefaults[]
XDG default locations.
Definition: muttlib.c:71
+ 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 menu.

Parameters
menuCurrent Menu

Definition at line 467 of file help.c.

468{
469 char banner[128] = { 0 };
470 FILE *fp = NULL;
471
472 struct Buffer *tmp_file = buf_pool_get();
473 buf_mktemp(tmp_file);
474
475 const struct MenuFuncOp *funcs = km_get_table(menu);
476 const char *desc = mutt_map_get_name(menu, MenuNames);
477 if (!desc)
478 desc = _("<UNKNOWN>");
479
480 struct PagerData pdata = { 0 };
481 struct PagerView pview = { &pdata };
482
483 pview.mode = PAGER_MODE_HELP;
486
487 do
488 {
489 fp = mutt_file_fopen(buf_string(tmp_file), "w");
490 if (!fp)
491 {
492 mutt_perror("%s", buf_string(tmp_file));
493 goto cleanup;
494 }
495
496 const int wraplen = AllDialogsWindow->state.cols;
497 dump_menu(fp, menu, wraplen);
498 if ((menu != MENU_EDITOR) && (menu != MENU_PAGER) && (menu != MENU_GENERIC))
499 {
500 fprintf(fp, "\n%s\n\n", _("Generic bindings:"));
501 dump_menu(fp, MENU_GENERIC, wraplen);
502 }
503
504 fprintf(fp, "\n%s\n\n", _("Unbound functions:"));
505 if (funcs)
506 dump_unbound(fp, funcs, &Keymaps[menu], NULL, wraplen);
507 if ((menu != MENU_EDITOR) && (menu != MENU_PAGER) && (menu != MENU_GENERIC))
508 dump_unbound(fp, OpGeneric, &Keymaps[MENU_GENERIC], &Keymaps[menu], wraplen);
509
510 if (menu == MENU_INDEX)
511 {
512 fprintf(fp, "\n%s\n\n", _("Message flags:"));
513 dump_message_flags(fp, wraplen);
514 }
515
516 mutt_file_fclose(&fp);
517
518 snprintf(banner, sizeof(banner), _("Help for %s"), desc);
519 pdata.fname = buf_string(tmp_file);
520 pview.banner = banner;
521 } while (mutt_do_pager(&pview, NULL) == OP_REFORMAT_WINCH);
522
523cleanup:
524 buf_pool_release(&tmp_file);
525}
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
Definition: dialog.c:80
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:138
#define mutt_file_fopen(PATH, MODE)
Definition: file.h:137
#define mutt_perror(...)
Definition: logging2.h:93
const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Definition: functions.c:68
static void dump_unbound(FILE *fp, const struct MenuFuncOp *funcs, struct KeymapList *km_list, struct KeymapList *aux, int wraplen)
Write out all the operations with no key bindings.
Definition: help.c:375
static void dump_message_flags(FILE *fp, int wraplen)
Write out all the message flags.
Definition: help.c:410
static void dump_menu(FILE *fp, enum MenuType menu, int wraplen)
Write all the key bindings to a file.
Definition: help.c:320
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:525
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition: mapping.c:42
#define _(a)
Definition: message.h:28
#define MUTT_PAGER_RETWINCH
Need reformatting on SIGWINCH.
Definition: lib.h:71
#define MUTT_PAGER_NSKIP
Preserve whitespace with smartwrap.
Definition: lib.h:69
#define MUTT_PAGER_NOWRAP
Format for term width, ignore $wrap.
Definition: lib.h:73
#define MUTT_PAGER_STRIPES
Striped highlighting.
Definition: lib.h:76
#define MUTT_PAGER_MARKER
Use markers if option is set.
Definition: lib.h:70
@ PAGER_MODE_HELP
Pager is invoked via 3rd path to show help.
Definition: lib.h:141
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
String manipulation buffer.
Definition: buffer.h:36
Mapping between a function and an operation.
Definition: lib.h:101
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:126
Data to be displayed by PagerView.
Definition: lib.h:161
const char * fname
Name of the file to read.
Definition: lib.h:165
Paged view into some data.
Definition: lib.h:172
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition: lib.h:173
enum PagerMode mode
Pager mode.
Definition: lib.h:174
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:175
const char * banner
Title to display in status bar.
Definition: lib.h:176
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
#define buf_mktemp(buf)
Definition: tmp.h:33
const struct Mapping MenuNames[]
Menu name lookup table.
Definition: type.c:37
@ MENU_INDEX
Index panel (list of emails)
Definition: type.h:51
@ MENU_GENERIC
Generic selection list.
Definition: type.h:46
@ MENU_PAGER
Pager pager (email viewer)
Definition: type.h:52
@ 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 57 of file flags.c.

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

131{
133}
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 -.
Definition: mutt_signal.c:107
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:150
+ 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 361 of file flags.c.

363{
364 if (!m || !ea || ARRAY_EMPTY(ea))
365 return;
366
367 struct Email **ep = NULL;
368 ARRAY_FOREACH(ep, ea)
369 {
370 struct Email *e = *ep;
371 mutt_set_flag(m, e, flag, bf, true);
372 }
373}
#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:57
+ 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 385 of file flags.c.

387{
388 struct MuttThread *start = NULL;
389 struct MuttThread *cur = e->thread;
390
391 if (!mutt_using_threads())
392 {
393 mutt_error(_("Threading is not enabled"));
394 return -1;
395 }
396
397 if (!subthread)
398 while (cur->parent)
399 cur = cur->parent;
400
401 start = cur;
402
403 if (cur->message && (cur != e->thread))
404 mutt_set_flag(m, cur->message, flag, bf, true);
405
406 cur = cur->child;
407 if (!cur)
408 goto done;
409
410 while (true)
411 {
412 if (cur->message && (cur != e->thread))
413 mutt_set_flag(m, cur->message, flag, bf, true);
414
415 if (cur->child)
416 {
417 cur = cur->child;
418 }
419 else if (cur->next)
420 {
421 cur = cur->next;
422 }
423 else
424 {
425 while (!cur->next)
426 {
427 cur = cur->parent;
428 if (cur == start)
429 goto done;
430 }
431 cur = cur->next;
432 }
433 }
434done:
435 cur = e->thread;
436 if (cur->message)
437 mutt_set_flag(m, cur->message, flag, bf, true);
438 return 0;
439}
#define mutt_error(...)
Definition: logging2.h:92
#define mutt_using_threads()
Definition: mutt_thread.h:114
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)

Variable Documentation

◆ PostCount

short PostCount
extern

Number of postponed (draft) emails.

Definition at line 59 of file postpone.c.