NeoMutt  2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
commands.c
Go to the documentation of this file.
1
23
29
30#include "config.h"
31#include <stdbool.h>
32#include <stdio.h>
33#include <string.h>
34#include "mutt/lib.h"
35#include "config/lib.h"
36#include "email/lib.h"
37#include "core/lib.h"
38#include "gui/lib.h"
39#include "commands.h"
40#include "commands/lib.h"
41#include "ncrypt/lib.h"
42#include "parse/lib.h"
43#include "module_data.h"
44
49{
50 const char *major;
52 const char *minor;
53 regex_t minor_regex;
54};
55
63void attachmatch_free(void **ptr)
64{
65 if (!ptr || !*ptr)
66 return;
67
68 struct AttachMatch **am_ptr = (struct AttachMatch **) ptr;
69 struct AttachMatch *am = *am_ptr;
70 regfree(&am->minor_regex);
71 FREE(&am->major);
72 FREE(am_ptr);
73}
74
80{
81 return MUTT_MEM_CALLOC(1, struct AttachMatch);
82}
83
91static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, bool dflt)
92{
93 /* If list is null, use default behavior. */
94 if (!checklist || STAILQ_EMPTY(checklist))
95 {
96 return false;
97 }
98
99 struct AttachMatch *a = NULL;
100 struct ListNode *np = NULL;
101 STAILQ_FOREACH(np, checklist, entries)
102 {
103 a = (struct AttachMatch *) np->data;
104 mutt_debug(LL_DEBUG3, "%s %d/%s ?? %s/%s [%d]... ", dflt ? "[OK] " : "[EXCL] ",
105 b->type, b->subtype ? b->subtype : "*", a->major, a->minor, a->major_int);
106 if (((a->major_int == TYPE_ANY) || (a->major_int == b->type)) &&
107 (!b->subtype || (regexec(&a->minor_regex, b->subtype, 0, NULL, 0) == 0)))
108 {
109 mutt_debug(LL_DEBUG3, "yes\n");
110 return true;
111 }
112 else
113 {
114 mutt_debug(LL_DEBUG3, "no\n");
115 }
116 }
117
118 return false;
119}
120
122#define MIME_DEPTH_MAX 50
123
130static int count_body_parts(struct Body *b, int depth)
131{
132 if (!b || (depth >= MIME_DEPTH_MAX))
133 return 0;
134
136 ASSERT(mod_data);
137
138 int count = 0;
139
140 for (struct Body *bp = b; bp; bp = bp->next)
141 {
142 /* Initial disposition is to count and not to recurse this part. */
143 bool shallcount = true; /* default */
144 bool shallrecurse = false;
145
146 mutt_debug(LL_DEBUG5, "desc=\"%s\"; fn=\"%s\", type=\"%d/%s\"\n",
147 bp->description ? bp->description : ("none"),
148 bp->filename ? bp->filename :
149 bp->d_filename ? bp->d_filename :
150 "(none)",
151 bp->type, bp->subtype ? bp->subtype : "*");
152
153 if (bp->type == TYPE_MESSAGE)
154 {
155 shallrecurse = true;
156
157 /* If it's an external body pointer, don't recurse it. */
158 if (mutt_istr_equal(bp->subtype, "external-body"))
159 shallrecurse = false;
160 }
161 else if (bp->type == TYPE_MULTIPART)
162 {
163 /* Always recurse multiparts, except multipart/alternative. */
164 shallrecurse = true;
165 if (mutt_istr_equal(bp->subtype, "alternative"))
166 {
167 const bool c_count_alternatives = cs_subset_bool(NeoMutt->sub, "count_alternatives");
168 shallrecurse = c_count_alternatives;
169 }
170 }
171
172 if ((bp->disposition == DISP_INLINE) && (bp->type != TYPE_MULTIPART) &&
173 (bp->type != TYPE_MESSAGE) && (bp == b))
174 {
175 shallcount = false; /* ignore fundamental inlines */
176 }
177
178 /* If this body isn't scheduled for enumeration already, don't bother
179 * profiling it further. */
180 if (shallcount)
181 {
182 /* Turn off shallcount if message type is not in ok list,
183 * or if it is in except list. Check is done separately for
184 * inlines vs. attachments. */
185
186 if (bp->disposition == DISP_ATTACH)
187 {
188 if (!count_body_parts_check(&mod_data->attach_allow, bp, true))
189 shallcount = false; /* attach not allowed */
190 if (count_body_parts_check(&mod_data->attach_exclude, bp, false))
191 shallcount = false; /* attach excluded */
192 }
193 else
194 {
195 if (!count_body_parts_check(&mod_data->inline_allow, bp, true))
196 shallcount = false; /* inline not allowed */
197 if (count_body_parts_check(&mod_data->inline_exclude, bp, false))
198 shallcount = false; /* excluded */
199 }
200 }
201
202 if (shallcount)
203 count++;
204 bp->attach_qualifies = shallcount;
205
206 mutt_debug(LL_DEBUG3, "%p shallcount = %d\n", (void *) bp, shallcount);
207
208 if (shallrecurse)
209 {
210 mutt_debug(LL_DEBUG3, "%p pre count = %d\n", (void *) bp, count);
211 bp->attach_count = count_body_parts(bp->parts, depth + 1);
212 count += bp->attach_count;
213 mutt_debug(LL_DEBUG3, "%p post count = %d\n", (void *) bp, count);
214 }
215 }
216
217 mutt_debug(LL_DEBUG3, "return %d\n", (count < 0) ? 0 : count);
218 return (count < 0) ? 0 : count;
219}
220
227int mutt_count_body_parts(struct Email *e, FILE *fp)
228{
229 if (!e)
230 return 0;
231
233 ASSERT(mod_data);
234
235 bool keep_parts = false;
236
237 if (e->attach_valid)
238 return e->attach_total;
239
240 if (e->body->parts)
241 keep_parts = true;
242 else
244
245 if (!STAILQ_EMPTY(&mod_data->attach_allow) || !STAILQ_EMPTY(&mod_data->attach_exclude) ||
246 !STAILQ_EMPTY(&mod_data->inline_allow) || !STAILQ_EMPTY(&mod_data->inline_exclude))
247 {
249 }
250 else
251 {
252 e->attach_total = 0;
253 }
254
255 e->attach_valid = true;
256
257 if (!keep_parts)
259
260 return e->attach_total;
261}
262
268{
269 if (!mv || !mv->mailbox)
270 return;
271
272 struct Mailbox *m = mv->mailbox;
273
274 for (int i = 0; i < m->msg_count; i++)
275 {
276 struct Email *e = m->emails[i];
277 if (!e)
278 break;
279 e->attach_valid = false;
280 e->attach_total = 0;
281 }
282}
283
292static enum CommandResult parse_attach_list(const struct Command *cmd, struct Buffer *line,
293 struct ListHead *head, struct Buffer *err)
294{
295 struct AttachMatch *a = NULL;
296 char *p = NULL;
297 char *tmpminor = NULL;
298 size_t len;
299 struct Buffer *token = buf_pool_get();
301
303 ASSERT(mod_data);
304
305 do
306 {
307 parse_extract_token(token, line, TOKEN_NONE);
308
309 if (buf_is_empty(token))
310 continue;
311
312 a = attachmatch_new();
313
314 /* some cheap hacks that I expect to remove */
315 if (mutt_istr_equal(token->data, "any"))
316 a->major = mutt_str_dup("*/.*");
317 else if (mutt_istr_equal(token->data, "none"))
318 a->major = mutt_str_dup("cheap_hack/this_should_never_match");
319 else
320 a->major = buf_strdup(token);
321
322 p = strchr(a->major, '/');
323 if (p)
324 {
325 *p = '\0';
326 p++;
327 a->minor = p;
328 }
329 else
330 {
331 a->minor = "unknown";
332 }
333
334 len = strlen(a->minor);
335 tmpminor = MUTT_MEM_MALLOC(len + 3, char);
336 memcpy(&tmpminor[1], a->minor, len);
337 tmpminor[0] = '^';
338 tmpminor[len + 1] = '$';
339 tmpminor[len + 2] = '\0';
340
342 int rc_regex = REG_COMP(&a->minor_regex, tmpminor, REG_ICASE);
343
344 FREE(&tmpminor);
345
346 if (rc_regex != 0)
347 {
348 regerror(rc_regex, &a->minor_regex, err->data, err->dsize);
349 buf_fix_dptr(err);
350 FREE(&a->major);
351 FREE(&a);
352 goto done;
353 }
354
355 mutt_debug(LL_DEBUG3, "added %s/%s [%d]\n", a->major, a->minor, a->major_int);
356
357 mutt_list_insert_tail(head, (char *) a);
358 } while (MoreArgs(line));
359
360 if (!a)
361 goto done;
362
363 mutt_debug(LL_NOTIFY, "NT_ATTACH_ADD: %s/%s\n", a->major, a->minor);
365
366 rc = MUTT_CMD_SUCCESS;
367
368done:
369 buf_pool_release(&token);
370 return rc;
371}
372
381static enum CommandResult parse_unattach_list(const struct Command *cmd, struct Buffer *line,
382 struct ListHead *head, struct Buffer *err)
383{
384 struct Buffer *token = buf_pool_get();
385
387 ASSERT(mod_data);
388
389 struct AttachMatch *a = NULL;
390 char *tmp = NULL;
391 char *minor = NULL;
392
393 do
394 {
395 parse_extract_token(token, line, TOKEN_NONE);
396 FREE(&tmp);
397
398 if (mutt_istr_equal(token->data, "any"))
399 tmp = mutt_str_dup("*/.*");
400 else if (mutt_istr_equal(token->data, "none"))
401 tmp = mutt_str_dup("cheap_hack/this_should_never_match");
402 else
403 tmp = buf_strdup(token);
404
405 minor = strchr(tmp, '/');
406 if (minor)
407 {
408 *minor = '\0';
409 minor++;
410 }
411 else
412 {
413 minor = "unknown";
414 }
415 const enum ContentType major = mutt_check_mime_type(tmp);
416
417 struct ListNode *np = NULL;
418 struct ListNode *tmp2 = NULL;
419 STAILQ_FOREACH_SAFE(np, head, entries, tmp2)
420 {
421 a = (struct AttachMatch *) np->data;
422 mutt_debug(LL_DEBUG3, "check %s/%s [%d] : %s/%s [%d]\n", a->major,
423 a->minor, a->major_int, tmp, minor, major);
424 if ((a->major_int == major) && mutt_istr_equal(minor, a->minor))
425 {
426 mutt_debug(LL_DEBUG3, "removed %s/%s [%d]\n", a->major, a->minor, a->major_int);
427 mutt_debug(LL_NOTIFY, "NT_ATTACH_DELETE: %s/%s\n", a->major, a->minor);
428
429 regfree(&a->minor_regex);
430 FREE(&a->major);
431 STAILQ_REMOVE(head, np, ListNode, entries);
432 FREE(&np->data);
433 FREE(&np);
434 }
435 }
436
437 } while (MoreArgs(line));
438
439 FREE(&tmp);
440
442
443 buf_pool_release(&token);
444 return MUTT_CMD_SUCCESS;
445}
446
454static int print_attach_list(struct ListHead *h, const char op, const char *name)
455{
456 struct ListNode *np = NULL;
457 STAILQ_FOREACH(np, h, entries)
458 {
459 printf("attachments %c%s %s/%s\n", op, name,
460 ((struct AttachMatch *) np->data)->major,
461 ((struct AttachMatch *) np->data)->minor);
462 }
463
464 return 0;
465}
466
474enum CommandResult parse_attachments(const struct Command *cmd, struct Buffer *line,
475 const struct ParseContext *pc, struct ParseError *pe)
476{
478 ASSERT(mod_data);
479
480 struct Buffer *err = pe->message;
481
482 if (!MoreArgs(line))
483 {
484 buf_printf(err, _("%s: too few arguments"), cmd->name);
485 return MUTT_CMD_WARNING;
486 }
487
488 struct Buffer *token = buf_pool_get();
490
491 parse_extract_token(token, line, TOKEN_NONE);
492
493 char *category = token->data;
494 char op = *category++;
495
496 if (op == '?')
497 {
498 mutt_endwin();
499 fflush(stdout);
500 printf("\n%s\n\n", _("Current attachments settings:"));
501 print_attach_list(&mod_data->attach_allow, '+', "A");
502 print_attach_list(&mod_data->attach_exclude, '-', "A");
503 print_attach_list(&mod_data->inline_allow, '+', "I");
504 print_attach_list(&mod_data->inline_exclude, '-', "I");
506
507 rc = MUTT_CMD_SUCCESS;
508 goto done;
509 }
510
511 if ((op != '+') && (op != '-'))
512 {
513 op = '+';
514 category--;
515 }
516
517 struct ListHead *head = NULL;
518 if (mutt_istr_startswith("attachment", category))
519 {
520 if (op == '+')
521 head = &mod_data->attach_allow;
522 else
523 head = &mod_data->attach_exclude;
524 }
525 else if (mutt_istr_startswith("inline", category))
526 {
527 if (op == '+')
528 head = &mod_data->inline_allow;
529 else
530 head = &mod_data->inline_exclude;
531 }
532 else
533 {
534 buf_strcpy(err, _("attachments: invalid disposition"));
535 goto done;
536 }
537
538 rc = parse_attach_list(cmd, line, head, err);
539
540done:
541 buf_pool_release(&token);
542 return rc;
543}
544
552enum CommandResult parse_unattachments(const struct Command *cmd, struct Buffer *line,
553 const struct ParseContext *pc, struct ParseError *pe)
554{
555 struct Buffer *err = pe->message;
556
557 if (!MoreArgs(line))
558 {
559 buf_printf(err, _("%s: too few arguments"), cmd->name);
560 return MUTT_CMD_WARNING;
561 }
562
564 ASSERT(mod_data);
565
566 struct Buffer *token = buf_pool_get();
568
569 char op;
570 const char *p = NULL;
571 struct ListHead *head = NULL;
572
573 parse_extract_token(token, line, TOKEN_NONE);
574
575 p = buf_string(token);
576 op = *p++;
577
578 if (op == '*')
579 {
584
585 mutt_debug(LL_NOTIFY, "NT_ATTACH_DELETE_ALL\n");
587
588 rc = MUTT_CMD_SUCCESS;
589 goto done;
590 }
591
592 if ((op != '+') && (op != '-'))
593 {
594 op = '+';
595 p--;
596 }
597 if (mutt_istr_startswith("attachment", p))
598 {
599 if (op == '+')
600 head = &mod_data->attach_allow;
601 else
602 head = &mod_data->attach_exclude;
603 }
604 else if (mutt_istr_startswith("inline", p))
605 {
606 if (op == '+')
607 head = &mod_data->inline_allow;
608 else
609 head = &mod_data->inline_exclude;
610 }
611 else
612 {
613 buf_strcpy(err, _("unattachments: invalid disposition"));
614 goto done;
615 }
616
617 rc = parse_unattach_list(cmd, line, head, err);
618
619done:
620 buf_pool_release(&token);
621 return rc;
622}
623
629void mutt_parse_mime_message(struct Email *e, FILE *fp)
630{
631 const bool right_type = (e->body->type == TYPE_MESSAGE) ||
632 (e->body->type == TYPE_MULTIPART);
633 const bool not_parsed = (e->body->parts == NULL);
634
635 if (right_type && fp && not_parsed)
636 {
637 mutt_parse_part(fp, e->body);
638 if (WithCrypto)
639 {
640 e->security = crypt_query(e->body);
641 }
642 }
643
644 e->attach_valid = false;
645}
646
654enum CommandResult parse_mime_lookup(const struct Command *cmd, struct Buffer *line,
655 const struct ParseContext *pc, struct ParseError *pe)
656{
658 ASSERT(mod_data);
659
660 return parse_stailq(cmd, line, &mod_data->mime_lookup, pc, pe);
661}
662
670enum CommandResult parse_unmime_lookup(const struct Command *cmd, struct Buffer *line,
671 const struct ParseContext *pc, struct ParseError *pe)
672{
674 ASSERT(mod_data);
675
676 return parse_unstailq(cmd, line, &mod_data->mime_lookup, pc, pe);
677}
678
682const struct Command AttachCommands[] = {
683 // clang-format off
684 { "attachments", CMD_ATTACHMENTS, parse_attachments,
685 N_("Set attachment counting rules"),
686 N_("attachments { + | - }<disposition> <mime-type> [ <mime-type> ... ] | ?"),
687 "mimesupport.html#attachments" },
688 { "mime-lookup", CMD_MIME_LOOKUP, parse_mime_lookup,
689 N_("Map specified MIME types/subtypes to display handlers"),
690 N_("mime-lookup <mime-type>[/<mime-subtype> ] [ ... ]"),
691 "mimesupport.html#mime-lookup" },
692 { "unattachments", CMD_UNATTACHMENTS, parse_unattachments,
693 N_("Remove attachment counting rules"),
694 N_("unattachments { * | { + | - }<disposition> <mime-type> [ ... ] }"),
695 "mimesupport.html#attachments" },
696 { "unmime-lookup", CMD_UNMIME_LOOKUP, parse_unmime_lookup,
697 N_("Remove custom MIME-type handlers"),
698 N_("unmime-lookup { * | [ <mime-type>[/<mime-subtype> ] ... ] }"),
699 "mimesupport.html#mime-lookup" },
700
701 // Deprecated
702 { "mime_lookup", CMD_NONE, NULL, "mime-lookup", NULL, NULL, CF_SYNONYM },
703 { "unmime_lookup", CMD_NONE, NULL, "unmime-lookup", NULL, NULL, CF_SYNONYM },
704
705 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NONE },
706 // clang-format on
707};
static int print_attach_list(struct ListHead *h, const char op, const char *name)
Print a list of attachments.
Definition commands.c:454
static enum CommandResult parse_unattach_list(const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
Parse the "unattachments" command.
Definition commands.c:381
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
Definition commands.c:629
static int count_body_parts(struct Body *b, int depth)
Count the MIME Body parts.
Definition commands.c:130
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
Definition commands.c:267
struct AttachMatch * attachmatch_new(void)
Create a new AttachMatch.
Definition commands.c:79
#define MIME_DEPTH_MAX
Maximum MIME nesting depth for counting body parts.
Definition commands.c:122
static enum CommandResult parse_attach_list(const struct Command *cmd, struct Buffer *line, struct ListHead *head, struct Buffer *err)
Parse the "attachments" command.
Definition commands.c:292
int mutt_count_body_parts(struct Email *e, FILE *fp)
Count the MIME Body parts.
Definition commands.c:227
static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, bool dflt)
Compares mime types to the ok and except lists.
Definition commands.c:91
const struct Command AttachCommands[]
Attach Commands.
Definition commands.c:682
Handle the attachments command.
@ NT_ATTACH_DELETE
Attachment regex has been deleted.
Definition commands.h:45
@ NT_ATTACH_DELETE_ALL
All Attachment regexes have been deleted.
Definition commands.h:46
@ NT_ATTACH_ADD
Attachment regex has been added.
Definition commands.h:44
Attach private Module data.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:168
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:298
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
Definition buffer.c:189
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:401
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition buffer.c:577
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
@ CF_SYNONYM
Command is a synonym for another command.
Definition command.h:50
@ CF_NONE
No flags are set.
Definition command.h:49
@ CMD_MIME_LOOKUP
:mime-lookup
Definition command.h:98
@ CMD_ATTACHMENTS
:attachments
Definition command.h:68
@ CMD_UNMIME_LOOKUP
:unmime-lookup
Definition command.h:141
@ CMD_NONE
No Command.
Definition command.h:62
@ CMD_UNATTACHMENTS
:unattachments
Definition command.h:129
CommandResult
Error codes for command_t parse functions.
Definition command.h:37
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition command.h:40
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition command.h:38
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition command.h:39
NeoMutt Commands.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
Definition crypt.c:693
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition curs_lib.c:174
void mutt_endwin(void)
Shutdown curses.
Definition curs_lib.c:152
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition body.c:58
Structs that make up an email.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition parse.c:1982
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
Definition parse.c:380
int parse_extract_token(struct Buffer *dest, struct Buffer *line, TokenFlags flags)
Extract one token from a string.
Definition extract.c:49
#define MoreArgs(buf)
Definition extract.h:32
@ TOKEN_NONE
No flags are set.
Definition extract.h:50
enum CommandResult parse_attachments(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'attachments' command - Implements Command::parse() -.
Definition commands.c:474
enum CommandResult parse_unmime_lookup(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unmime-lookup' command - Implements Command::parse() -.
Definition commands.c:670
enum CommandResult parse_unattachments(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'unattachments' command - Implements Command::parse() -.
Definition commands.c:552
enum CommandResult parse_stailq(const struct Command *cmd, struct Buffer *line, struct ListHead *list, const struct ParseContext *pc, struct ParseError *pe)
Parse a list command - Implements Command::parse() -.
Definition stailq.c:52
enum CommandResult parse_unstailq(const struct Command *cmd, struct Buffer *line, struct ListHead *list, const struct ParseContext *pc, struct ParseError *pe)
Parse an unlist command - Implements Command::parse() -.
Definition stailq.c:85
enum CommandResult parse_mime_lookup(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'mime-lookup' command - Implements Command::parse() -.
Definition commands.c:654
void attachmatch_free(void **ptr)
Free an AttachMatch - Implements list_free_t -.
Definition commands.c:63
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
Convenience wrapper for the gui headers.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition list.c:65
void mutt_list_free_type(struct ListHead *h, list_free_t fn)
Free a List of type.
Definition list.c:145
@ LL_DEBUG3
Log at debug level 3.
Definition logging2.h:47
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
@ LL_NOTIFY
Log of notifications.
Definition logging2.h:50
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
#define MUTT_MEM_MALLOC(n, type)
Definition memory.h:53
ContentType
Content-Type.
Definition mime.h:30
@ TYPE_MESSAGE
Type: 'message/*'.
Definition mime.h:35
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition mime.h:37
@ TYPE_ANY
Type: '' or '.'.
Definition mime.h:40
@ DISP_ATTACH
Content is attached.
Definition mime.h:63
@ DISP_INLINE
Content is inline.
Definition mime.h:62
@ MODULE_ID_ATTACH
ModuleAttach, Attachments
Definition module_api.h:49
Convenience wrapper for the library headers.
#define N_(a)
Definition message.h:32
#define _(a)
Definition message.h:28
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
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition string.c:678
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition string.c:257
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Definition string.c:246
API for encryption/signing of emails.
#define WithCrypto
Definition lib.h:132
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:666
@ NT_ATTACH
Attachment command changed, NotifyAttach.
Definition notify_type.h:39
Text parsing functions.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
#define STAILQ_REMOVE(head, elm, type, field)
Definition queue.h:441
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
#define STAILQ_EMPTY(head)
Definition queue.h:382
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition queue.h:400
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition regex3.h:49
#define ASSERT(COND)
Definition signal2.h:59
An attachment matching a regex for attachment counter.
Definition commands.c:49
const char * minor
Minor mime type, e.g. "html".
Definition commands.c:52
regex_t minor_regex
Minor mime type regex.
Definition commands.c:53
const char * major
Major mime type, e.g. "text".
Definition commands.c:50
enum ContentType major_int
Major mime type, e.g. TYPE_TEXT.
Definition commands.c:51
Attach private Module data.
Definition module_data.h:32
struct ListHead attach_allow
List of attachment types to be counted.
Definition module_data.h:34
struct ListHead attach_exclude
List of attachment types to be ignored.
Definition module_data.h:35
struct ListHead inline_allow
List of inline types to counted.
Definition module_data.h:36
struct ListHead inline_exclude
List of inline types to ignore.
Definition module_data.h:37
struct ListHead mime_lookup
List of mime types that that shouldn't use the mailcap entry.
Definition module_data.h:42
struct Notify * attachments_notify
Notifications: NotifyAttach.
Definition module_data.h:38
The body of an email.
Definition body.h:36
struct Body * parts
parts of a multipart or message/rfc822
Definition body.h:73
struct Body * next
next attachment in the list
Definition body.h:72
char * subtype
content-type subtype
Definition body.h:61
unsigned int type
content-type primary type, ContentType
Definition body.h:40
String manipulation buffer.
Definition buffer.h:36
size_t dsize
Length of data.
Definition buffer.h:39
char * data
Pointer to data.
Definition buffer.h:37
const char * name
Name of the Command.
Definition command.h:162
The envelope/body of an email.
Definition email.h:39
bool attach_valid
true when the attachment count is valid
Definition email.h:100
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition email.h:43
struct Body * body
List of MIME parts.
Definition email.h:69
short attach_total
Number of qualifying attachments in message, if attach_valid.
Definition email.h:115
A List node for strings.
Definition list.h:37
char * data
String.
Definition list.h:38
View of a Mailbox.
Definition mview.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
A mailbox.
Definition mailbox.h:81
int msg_count
Total number of messages.
Definition mailbox.h:90
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Context for config parsing (history/backtrace).
Definition pcontext.h:34
Detailed error information from config parsing.
Definition perror.h:34
struct Buffer * message
Error message.
Definition perror.h:35