NeoMutt
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

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

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

◆ EvMessage

enum EvMessage

Edit or View a message.

Enumerator
EVM_VIEW 

View the message.

EVM_EDIT 

Edit the message.

Definition at line 50 of file protos.h.

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

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 279 of file editmsg.c.

280{
281 struct Email **ep = NULL;
282 ARRAY_FOREACH(ep, ea)
283 {
284 struct Email *e = *ep;
285 if (ev_message(action, m, e) == -1)
286 return -1;
287 }
288
289 return 0;
290}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:211
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:55
The envelope/body of an email.
Definition: email.h:37
+ 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
81 /* reset signals for the child; not really needed, but... */
83 act.sa_handler = SIG_DFL;
84 act.sa_flags = 0;
85 sigemptyset(&act.sa_mask);
86 sigaction(SIGTERM, &act, NULL);
87 sigaction(SIGTSTP, &act, NULL);
88 sigaction(SIGCONT, &act, NULL);
89
90 execle(EXEC_SHELL, "sh", "-c", cmd, NULL, EnvList);
91 _exit(127); /* execl error */
92 }
93 else if (pid != -1)
94 {
95#ifdef USE_IMAP
96 rc = imap_wait_keep_alive(pid);
97#endif
98 }
99
100 sigaction(SIGCONT, &oldcont, NULL);
101 sigaction(SIGTSTP, &oldtstp, NULL);
102
103 /* reset SIGINT, SIGQUIT and SIGCHLD */
105
106 rc = (pid != -1) ? (WIFEXITED(rc) ? WEXITSTATUS(rc) : -1) : -1;
107
108 return rc;
109}
#define EXEC_SHELL
Definition: filter.h:27
char ** EnvList
Private copy of the environment variables.
Definition: globals.c:86
int imap_wait_keep_alive(pid_t pid)
Wait for a process to change state.
Definition: util.c:976
void mutt_sig_block_system(void)
Block signals before calling exec()
Definition: signal.c:196
void mutt_sig_unblock_system(bool restore)
Restore previously blocked signals.
Definition: signal.c:220
+ 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 1482 of file muttlib.c.

1483{
1484 const char *xdg_env = mutt_str_getenv(XdgEnvVars[type]);
1485 char *xdg = xdg_env ? mutt_str_dup(xdg_env) : mutt_str_dup(XdgDefaults[type]);
1486 char *x = xdg; /* mutt_str_sep() changes xdg, so free x instead later */
1487 char *token = NULL;
1488 int rc = 0;
1489
1490 while ((token = mutt_str_sep(&xdg, ":")))
1491 {
1492 if (buf_printf(buf, "%s/%s/neomuttrc", token, PACKAGE) < 0)
1493 continue;
1494 buf_expand_path(buf);
1495 if (access(buf_string(buf), F_OK) == 0)
1496 {
1497 rc = 1;
1498 break;
1499 }
1500
1501 if (buf_printf(buf, "%s/%s/Muttrc", token, PACKAGE) < 0)
1502 continue;
1503 buf_expand_path(buf);
1504 if (access(buf_string(buf), F_OK) == 0)
1505 {
1506 rc = 1;
1507 break;
1508 }
1509 }
1510
1511 FREE(&x);
1512 return rc;
1513}
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:173
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
#define FREE(x)
Definition: memory.h:45
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:251
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition: string.c:918
char * mutt_str_sep(char **stringp, const char *delim)
Find first occurrence of any of delim characters in *stringp.
Definition: string.c:184
static const char * XdgEnvVars[]
Accepted XDG environment variables.
Definition: muttlib.c:68
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:335
static const char * XdgDefaults[]
XDG default locations.
Definition: muttlib.c:74
+ 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 464 of file help.c.

465{
466 char banner[128] = { 0 };
467 FILE *fp = NULL;
468
469 /* We don't use the buffer pool because of the extended lifetime of t */
470 struct Buffer t = buf_make(PATH_MAX);
471 buf_mktemp(&t);
472
473 const struct MenuFuncOp *funcs = km_get_table(menu);
474 const char *desc = mutt_map_get_name(menu, MenuNames);
475 if (!desc)
476 desc = _("<UNKNOWN>");
477
478 struct PagerData pdata = { 0 };
479 struct PagerView pview = { &pdata };
480
481 pview.mode = PAGER_MODE_HELP;
484
485 do
486 {
487 fp = mutt_file_fopen(buf_string(&t), "w");
488 if (!fp)
489 {
490 mutt_perror("%s", buf_string(&t));
491 goto cleanup;
492 }
493
494 const int wraplen = AllDialogsWindow->state.cols;
495 dump_menu(fp, menu, wraplen);
496 if ((menu != MENU_EDITOR) && (menu != MENU_PAGER) && (menu != MENU_GENERIC))
497 {
498 fprintf(fp, "\n%s\n\n", _("Generic bindings:"));
499 dump_menu(fp, MENU_GENERIC, wraplen);
500 }
501
502 fprintf(fp, "\n%s\n\n", _("Unbound functions:"));
503 if (funcs)
504 dump_unbound(fp, funcs, &Keymaps[menu], NULL, wraplen);
505 if ((menu != MENU_EDITOR) && (menu != MENU_PAGER) && (menu != MENU_GENERIC))
506 dump_unbound(fp, OpGeneric, &Keymaps[MENU_GENERIC], &Keymaps[menu], wraplen);
507
508 if (menu == MENU_INDEX)
509 {
510 fprintf(fp, "\n%s\n\n", _("Message flags:"));
511 dump_message_flags(fp, wraplen);
512 }
513
514 mutt_file_fclose(&fp);
515
516 snprintf(banner, sizeof(banner), _("Help for %s"), desc);
517 pdata.fname = buf_string(&t);
518 pview.banner = banner;
519 } while (mutt_do_pager(&pview, NULL) == OP_REFORMAT_WINCH);
520
521cleanup:
522 buf_dealloc(&t);
523}
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:389
struct Buffer buf_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:70
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:123
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:636
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:152
const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Definition: functions.c:297
#define mutt_perror(...)
Definition: logging2.h:93
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:372
static void dump_message_flags(FILE *fp, int wraplen)
Write out all the message flags.
Definition: help.c:407
static void dump_menu(FILE *fp, enum MenuType menu, int wraplen)
Write all the key bindings to a file.
Definition: help.c:317
struct KeymapList Keymaps[MENU_MAX]
Array of key mappings, one for each MenuType.
Definition: lib.c:113
const struct MenuFuncOp * km_get_table(enum MenuType mtype)
Lookup a Menu's functions.
Definition: lib.c:516
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 PATH_MAX
Definition: mutt.h:41
#define MUTT_PAGER_RETWINCH
Need reformatting on SIGWINCH.
Definition: lib.h:70
#define MUTT_PAGER_NSKIP
Preserve whitespace with smartwrap.
Definition: lib.h:68
#define MUTT_PAGER_NOWRAP
Format for term width, ignore $wrap.
Definition: lib.h:72
#define MUTT_PAGER_STRIPES
Striped highlighting.
Definition: lib.h:75
#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:140
String manipulation buffer.
Definition: buffer.h:34
Mapping between a function and an operation.
Definition: lib.h:102
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
Data to be displayed by PagerView.
Definition: lib.h:160
const char * fname
Name of the file to read.
Definition: lib.h:164
Paged view into some data.
Definition: lib.h:171
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition: lib.h:172
enum PagerMode mode
Pager mode.
Definition: lib.h:173
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:174
const char * banner
Title to display in status bar.
Definition: lib.h:175
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:55
@ 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 54 of file flags.c.

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

132{
134}
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:52
static void curses_segv_handler(int sig)
Catch a segfault and print a backtrace - Implements sig_handler_t -.
Definition: mutt_signal.c:108
static void curses_exit_handler(int sig)
Notify the user and shutdown gracefully - Implements sig_handler_t -.
Definition: mutt_signal.c:96
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:101
+ 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 362 of file flags.c.

364{
365 if (!m || !ea || ARRAY_EMPTY(ea))
366 return;
367
368 struct Email **ep = NULL;
369 ARRAY_FOREACH(ep, ea)
370 {
371 struct Email *e = *ep;
372 mutt_set_flag(m, e, flag, bf, true);
373 }
374}
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:73
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:54
+ 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 386 of file flags.c.

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