NeoMutt  2025-12-11-980-ge38c27
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(struct AttachMatch **ptr)
64{
65 if (!ptr || !*ptr)
66 return;
67
68 struct AttachMatch *am = *ptr;
69 regfree(&am->minor_regex);
70 FREE(&am->major);
71 FREE(ptr);
72}
73
79{
80 return MUTT_MEM_CALLOC(1, struct AttachMatch);
81}
82
90static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, bool dflt)
91{
92 /* If list is null, use default behavior. */
93 if (!checklist || STAILQ_EMPTY(checklist))
94 {
95 return false;
96 }
97
98 struct AttachMatch *a = NULL;
99 struct ListNode *np = NULL;
100 STAILQ_FOREACH(np, checklist, entries)
101 {
102 a = (struct AttachMatch *) np->data;
103 mutt_debug(LL_DEBUG3, "%s %d/%s ?? %s/%s [%d]... ", dflt ? "[OK] " : "[EXCL] ",
104 b->type, b->subtype ? b->subtype : "*", a->major, a->minor, a->major_int);
105 if (((a->major_int == TYPE_ANY) || (a->major_int == b->type)) &&
106 (!b->subtype || (regexec(&a->minor_regex, b->subtype, 0, NULL, 0) == 0)))
107 {
108 mutt_debug(LL_DEBUG3, "yes\n");
109 return true;
110 }
111 else
112 {
113 mutt_debug(LL_DEBUG3, "no\n");
114 }
115 }
116
117 return false;
118}
119
121#define MIME_DEPTH_MAX 50
122
129static int count_body_parts(struct Body *b, int depth)
130{
131 if (!b || (depth >= MIME_DEPTH_MAX))
132 return 0;
133
135 ASSERT(mod_data);
136
137 int count = 0;
138
139 for (struct Body *bp = b; bp; bp = bp->next)
140 {
141 /* Initial disposition is to count and not to recurse this part. */
142 bool shallcount = true; /* default */
143 bool shallrecurse = false;
144
145 mutt_debug(LL_DEBUG5, "desc=\"%s\"; fn=\"%s\", type=\"%d/%s\"\n",
146 bp->description ? bp->description : ("none"),
147 bp->filename ? bp->filename :
148 bp->d_filename ? bp->d_filename :
149 "(none)",
150 bp->type, bp->subtype ? bp->subtype : "*");
151
152 if (bp->type == TYPE_MESSAGE)
153 {
154 shallrecurse = true;
155
156 /* If it's an external body pointer, don't recurse it. */
157 if (mutt_istr_equal(bp->subtype, "external-body"))
158 shallrecurse = false;
159 }
160 else if (bp->type == TYPE_MULTIPART)
161 {
162 /* Always recurse multiparts, except multipart/alternative. */
163 shallrecurse = true;
164 if (mutt_istr_equal(bp->subtype, "alternative"))
165 {
166 const bool c_count_alternatives = cs_subset_bool(NeoMutt->sub, "count_alternatives");
167 shallrecurse = c_count_alternatives;
168 }
169 }
170
171 if ((bp->disposition == DISP_INLINE) && (bp->type != TYPE_MULTIPART) &&
172 (bp->type != TYPE_MESSAGE) && (bp == b))
173 {
174 shallcount = false; /* ignore fundamental inlines */
175 }
176
177 /* If this body isn't scheduled for enumeration already, don't bother
178 * profiling it further. */
179 if (shallcount)
180 {
181 /* Turn off shallcount if message type is not in ok list,
182 * or if it is in except list. Check is done separately for
183 * inlines vs. attachments. */
184
185 if (bp->disposition == DISP_ATTACH)
186 {
187 if (!count_body_parts_check(&mod_data->attach_allow, bp, true))
188 shallcount = false; /* attach not allowed */
189 if (count_body_parts_check(&mod_data->attach_exclude, bp, false))
190 shallcount = false; /* attach excluded */
191 }
192 else
193 {
194 if (!count_body_parts_check(&mod_data->inline_allow, bp, true))
195 shallcount = false; /* inline not allowed */
196 if (count_body_parts_check(&mod_data->inline_exclude, bp, false))
197 shallcount = false; /* excluded */
198 }
199 }
200
201 if (shallcount)
202 count++;
203 bp->attach_qualifies = shallcount;
204
205 mutt_debug(LL_DEBUG3, "%p shallcount = %d\n", (void *) bp, shallcount);
206
207 if (shallrecurse)
208 {
209 mutt_debug(LL_DEBUG3, "%p pre count = %d\n", (void *) bp, count);
210 bp->attach_count = count_body_parts(bp->parts, depth + 1);
211 count += bp->attach_count;
212 mutt_debug(LL_DEBUG3, "%p post count = %d\n", (void *) bp, count);
213 }
214 }
215
216 mutt_debug(LL_DEBUG3, "return %d\n", (count < 0) ? 0 : count);
217 return (count < 0) ? 0 : count;
218}
219
226int mutt_count_body_parts(struct Email *e, FILE *fp)
227{
228 if (!e)
229 return 0;
230
232 ASSERT(mod_data);
233
234 bool keep_parts = false;
235
236 if (e->attach_valid)
237 return e->attach_total;
238
239 if (e->body->parts)
240 keep_parts = true;
241 else
243
244 if (!STAILQ_EMPTY(&mod_data->attach_allow) || !STAILQ_EMPTY(&mod_data->attach_exclude) ||
245 !STAILQ_EMPTY(&mod_data->inline_allow) || !STAILQ_EMPTY(&mod_data->inline_exclude))
246 {
248 }
249 else
250 {
251 e->attach_total = 0;
252 }
253
254 e->attach_valid = true;
255
256 if (!keep_parts)
258
259 return e->attach_total;
260}
261
267{
268 if (!mv || !mv->mailbox)
269 return;
270
271 struct Mailbox *m = mv->mailbox;
272
273 for (int i = 0; i < m->msg_count; i++)
274 {
275 struct Email *e = m->emails[i];
276 if (!e)
277 break;
278 e->attach_valid = false;
279 e->attach_total = 0;
280 }
281}
282
291static enum CommandResult parse_attach_list(const struct Command *cmd, struct Buffer *line,
292 struct ListHead *head, struct Buffer *err)
293{
294 struct AttachMatch *a = NULL;
295 char *p = NULL;
296 char *tmpminor = NULL;
297 size_t len;
298 struct Buffer *token = buf_pool_get();
300
302 ASSERT(mod_data);
303
304 do
305 {
306 parse_extract_token(token, line, TOKEN_NONE);
307
308 if (buf_is_empty(token))
309 continue;
310
311 a = attachmatch_new();
312
313 /* some cheap hacks that I expect to remove */
314 if (mutt_istr_equal(token->data, "any"))
315 a->major = mutt_str_dup("*/.*");
316 else if (mutt_istr_equal(token->data, "none"))
317 a->major = mutt_str_dup("cheap_hack/this_should_never_match");
318 else
319 a->major = buf_strdup(token);
320
321 p = strchr(a->major, '/');
322 if (p)
323 {
324 *p = '\0';
325 p++;
326 a->minor = p;
327 }
328 else
329 {
330 a->minor = "unknown";
331 }
332
333 len = strlen(a->minor);
334 tmpminor = MUTT_MEM_MALLOC(len + 3, char);
335 memcpy(&tmpminor[1], a->minor, len);
336 tmpminor[0] = '^';
337 tmpminor[len + 1] = '$';
338 tmpminor[len + 2] = '\0';
339
341 int rc_regex = REG_COMP(&a->minor_regex, tmpminor, REG_ICASE);
342
343 FREE(&tmpminor);
344
345 if (rc_regex != 0)
346 {
347 regerror(rc_regex, &a->minor_regex, err->data, err->dsize);
348 buf_fix_dptr(err);
349 FREE(&a->major);
350 FREE(&a);
351 goto done;
352 }
353
354 mutt_debug(LL_DEBUG3, "added %s/%s [%d]\n", a->major, a->minor, a->major_int);
355
356 mutt_list_insert_tail(head, (char *) a);
357 } while (MoreArgs(line));
358
359 if (!a)
360 goto done;
361
362 mutt_debug(LL_NOTIFY, "NT_ATTACH_ADD: %s/%s\n", a->major, a->minor);
364
365 rc = MUTT_CMD_SUCCESS;
366
367done:
368 buf_pool_release(&token);
369 return rc;
370}
371
380static enum CommandResult parse_unattach_list(const struct Command *cmd, struct Buffer *line,
381 struct ListHead *head, struct Buffer *err)
382{
383 struct Buffer *token = buf_pool_get();
384
386 ASSERT(mod_data);
387
388 struct AttachMatch *a = NULL;
389 char *tmp = NULL;
390 char *minor = NULL;
391
392 do
393 {
394 parse_extract_token(token, line, TOKEN_NONE);
395 FREE(&tmp);
396
397 if (mutt_istr_equal(token->data, "any"))
398 tmp = mutt_str_dup("*/.*");
399 else if (mutt_istr_equal(token->data, "none"))
400 tmp = mutt_str_dup("cheap_hack/this_should_never_match");
401 else
402 tmp = buf_strdup(token);
403
404 minor = strchr(tmp, '/');
405 if (minor)
406 {
407 *minor = '\0';
408 minor++;
409 }
410 else
411 {
412 minor = "unknown";
413 }
414 const enum ContentType major = mutt_check_mime_type(tmp);
415
416 struct ListNode *np = NULL;
417 struct ListNode *tmp2 = NULL;
418 STAILQ_FOREACH_SAFE(np, head, entries, tmp2)
419 {
420 a = (struct AttachMatch *) np->data;
421 mutt_debug(LL_DEBUG3, "check %s/%s [%d] : %s/%s [%d]\n", a->major,
422 a->minor, a->major_int, tmp, minor, major);
423 if ((a->major_int == major) && mutt_istr_equal(minor, a->minor))
424 {
425 mutt_debug(LL_DEBUG3, "removed %s/%s [%d]\n", a->major, a->minor, a->major_int);
426 mutt_debug(LL_NOTIFY, "NT_ATTACH_DELETE: %s/%s\n", a->major, a->minor);
427
428 regfree(&a->minor_regex);
429 FREE(&a->major);
430 STAILQ_REMOVE(head, np, ListNode, entries);
431 FREE(&np->data);
432 FREE(&np);
433 }
434 }
435
436 } while (MoreArgs(line));
437
438 FREE(&tmp);
439
441
442 buf_pool_release(&token);
443 return MUTT_CMD_SUCCESS;
444}
445
453static int print_attach_list(struct ListHead *h, const char op, const char *name)
454{
455 struct ListNode *np = NULL;
456 STAILQ_FOREACH(np, h, entries)
457 {
458 printf("attachments %c%s %s/%s\n", op, name,
459 ((struct AttachMatch *) np->data)->major,
460 ((struct AttachMatch *) np->data)->minor);
461 }
462
463 return 0;
464}
465
473enum CommandResult parse_attachments(const struct Command *cmd, struct Buffer *line,
474 const struct ParseContext *pc, struct ParseError *pe)
475{
477 ASSERT(mod_data);
478
479 struct Buffer *err = pe->message;
480
481 if (!MoreArgs(line))
482 {
483 buf_printf(err, _("%s: too few arguments"), cmd->name);
484 return MUTT_CMD_WARNING;
485 }
486
487 struct Buffer *token = buf_pool_get();
489
490 parse_extract_token(token, line, TOKEN_NONE);
491
492 char *category = token->data;
493 char op = *category++;
494
495 if (op == '?')
496 {
497 mutt_endwin();
498 fflush(stdout);
499 printf("\n%s\n\n", _("Current attachments settings:"));
500 print_attach_list(&mod_data->attach_allow, '+', "A");
501 print_attach_list(&mod_data->attach_exclude, '-', "A");
502 print_attach_list(&mod_data->inline_allow, '+', "I");
503 print_attach_list(&mod_data->inline_exclude, '-', "I");
505
506 rc = MUTT_CMD_SUCCESS;
507 goto done;
508 }
509
510 if ((op != '+') && (op != '-'))
511 {
512 op = '+';
513 category--;
514 }
515
516 struct ListHead *head = NULL;
517 if (mutt_istr_startswith("attachment", category))
518 {
519 if (op == '+')
520 head = &mod_data->attach_allow;
521 else
522 head = &mod_data->attach_exclude;
523 }
524 else if (mutt_istr_startswith("inline", category))
525 {
526 if (op == '+')
527 head = &mod_data->inline_allow;
528 else
529 head = &mod_data->inline_exclude;
530 }
531 else
532 {
533 buf_strcpy(err, _("attachments: invalid disposition"));
534 goto done;
535 }
536
537 rc = parse_attach_list(cmd, line, head, err);
538
539done:
540 buf_pool_release(&token);
541 return rc;
542}
543
551enum CommandResult parse_unattachments(const struct Command *cmd, struct Buffer *line,
552 const struct ParseContext *pc, struct ParseError *pe)
553{
554 struct Buffer *err = pe->message;
555
556 if (!MoreArgs(line))
557 {
558 buf_printf(err, _("%s: too few arguments"), cmd->name);
559 return MUTT_CMD_WARNING;
560 }
561
563 ASSERT(mod_data);
564
565 struct Buffer *token = buf_pool_get();
567
568 char op;
569 const char *p = NULL;
570 struct ListHead *head = NULL;
571
572 parse_extract_token(token, line, TOKEN_NONE);
573
574 p = buf_string(token);
575 op = *p++;
576
577 if (op == '*')
578 {
583
584 mutt_debug(LL_NOTIFY, "NT_ATTACH_DELETE_ALL\n");
586
587 rc = MUTT_CMD_SUCCESS;
588 goto done;
589 }
590
591 if ((op != '+') && (op != '-'))
592 {
593 op = '+';
594 p--;
595 }
596 if (mutt_istr_startswith("attachment", p))
597 {
598 if (op == '+')
599 head = &mod_data->attach_allow;
600 else
601 head = &mod_data->attach_exclude;
602 }
603 else if (mutt_istr_startswith("inline", p))
604 {
605 if (op == '+')
606 head = &mod_data->inline_allow;
607 else
608 head = &mod_data->inline_exclude;
609 }
610 else
611 {
612 buf_strcpy(err, _("unattachments: invalid disposition"));
613 goto done;
614 }
615
616 rc = parse_unattach_list(cmd, line, head, err);
617
618done:
619 buf_pool_release(&token);
620 return rc;
621}
622
628void mutt_parse_mime_message(struct Email *e, FILE *fp)
629{
630 const bool right_type = (e->body->type == TYPE_MESSAGE) ||
631 (e->body->type == TYPE_MULTIPART);
632 const bool not_parsed = (e->body->parts == NULL);
633
634 if (right_type && fp && not_parsed)
635 {
636 mutt_parse_part(fp, e->body);
637 if (WithCrypto)
638 {
639 e->security = crypt_query(e->body);
640 }
641 }
642
643 e->attach_valid = false;
644}
645
653enum CommandResult parse_mime_lookup(const struct Command *cmd, struct Buffer *line,
654 const struct ParseContext *pc, struct ParseError *pe)
655{
657 ASSERT(mod_data);
658
659 return parse_stailq(cmd, line, &mod_data->mime_lookup, pc, pe);
660}
661
669enum CommandResult parse_unmime_lookup(const struct Command *cmd, struct Buffer *line,
670 const struct ParseContext *pc, struct ParseError *pe)
671{
673 ASSERT(mod_data);
674
675 return parse_unstailq(cmd, line, &mod_data->mime_lookup, pc, pe);
676}
677
681const struct Command AttachCommands[] = {
682 // clang-format off
683 { "attachments", CMD_ATTACHMENTS, parse_attachments,
684 N_("Set attachment counting rules"),
685 N_("attachments { + | - }<disposition> <mime-type> [ <mime-type> ... ] | ?"),
686 "mimesupport.html#attachments" },
687 { "mime-lookup", CMD_MIME_LOOKUP, parse_mime_lookup,
688 N_("Map specified MIME types/subtypes to display handlers"),
689 N_("mime-lookup <mime-type>[/<mime-subtype> ] [ ... ]"),
690 "mimesupport.html#mime-lookup" },
691 { "unattachments", CMD_UNATTACHMENTS, parse_unattachments,
692 N_("Remove attachment counting rules"),
693 N_("unattachments { * | { + | - }<disposition> <mime-type> [ ... ] }"),
694 "mimesupport.html#attachments" },
695 { "unmime-lookup", CMD_UNMIME_LOOKUP, parse_unmime_lookup,
696 N_("Remove custom MIME-type handlers"),
697 N_("unmime-lookup { * | [ <mime-type>[/<mime-subtype> ] ... ] }"),
698 "mimesupport.html#mime-lookup" },
699
700 // Deprecated
701 { "mime_lookup", CMD_NONE, NULL, "mime-lookup", NULL, NULL, CF_SYNONYM },
702 { "unmime_lookup", CMD_NONE, NULL, "unmime-lookup", NULL, NULL, CF_SYNONYM },
703
704 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NONE },
705 // clang-format on
706};
static int print_attach_list(struct ListHead *h, const char op, const char *name)
Print a list of attachments.
Definition commands.c:453
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:380
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
Definition commands.c:628
static int count_body_parts(struct Body *b, int depth)
Count the MIME Body parts.
Definition commands.c:129
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
Definition commands.c:266
struct AttachMatch * attachmatch_new(void)
Create a new AttachMatch.
Definition commands.c:78
#define MIME_DEPTH_MAX
Maximum MIME nesting depth for counting body parts.
Definition commands.c:121
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:291
int mutt_count_body_parts(struct Email *e, FILE *fp)
Count the MIME Body parts.
Definition commands.c:226
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:90
const struct Command AttachCommands[]
Attach Commands.
Definition commands.c:681
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:1949
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
Definition parse.c:333
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:473
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:669
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:551
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:653
void attachmatch_free(struct AttachMatch **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
void(* list_free_t)(void **ptr)
Definition list.h:50
@ 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